I have done something similar.
It's in French, but the code should speak for itself. I use ‰ for
the marker (I use a bepo layout), and when I do, the
marked text as a pressed-button style.
I am not fluent in lisp, so there may be room for improvement.
What I have done is that, when using ‰ for marker, the marked text has a pressed-button style, and when ...
You will need to tell Org to
Use minted for listings
Include minted in the default package list
Change the compilation switches to accommodate for minted:
(setq org-latex-listings 'minted
org-latex-packages-alist '(("" "minted"))
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
When using JS2 ...
Well, s-expressions are essentially “abstract syntax”, in the sense that they are merely a concrete syntax for abstract syntax trees, and thus any language can be represented as s-expressions, and manipulated with s-expression commands. Hence, syntax-ppss speaking of “Sexps” is simply the Lisp way to talk about abstract syntax trees.
Practically, though, ...
The problem is that it is not more robust.
Firstly, the major modes are precisely the ones responsible for deciding what's a comment or a string. If they were able to successfully define them for the purpose of font-locking, they should be able to do the same for other purposes.
Secondly, reading the syntax to determine the context that point is inside is ...
The following elisp snippet should do. The important details are:
Strings are handled by syntax highlighting and not by pattern matching (i.e., keyword highlighting). This has very high priority. So one needs to override it explicitly by the value t for the MATCHER flag OVERRIDE (see doc of font-lock-keywords).
One cannot use a regexp as keyword MATCHER ...
AFAIK the example you give are actually 2-char comment delimiters, except that depending on the 3rd character, these comments are treated in different ways (but always as comments in the sense that the semantics of the code is unaffected).
So, the support offered by Emacs's syntax tables should be sufficient in most cirsumstances. If you want to highlight ...
With show-paren-mode you can highlight the whole expression. You need to have the following code in your init file. You can try different style and choose what you like to highlight.
(show-paren-mode t) ;; enable show paren mode
(setq show-paren-style 'expression) ;; highlight whole expression
Refer : http://emacs-fu.blogspot.in/2009/01/balancing-your-...
You can use font-lock-add-keywords to add custom highlights.
In the below example, I am highlighting any string
that begins with _ preceded by a white-space character or beginning of the line
followed by a single alpha-numeric character
followed by anything else
ending with :
The highlight color chosen is font-lock-warning-face; you can choose any other ...
The solution for this spans elisp, org-mode and css customization.
By default, the fontification information is embedded in the exported html file. We need to disable that and tell org-mode that we are planning to specify the font formatting information using an external css file.
I have chosen to prefix the html class names with org- string.
It is correct, but it is not being refontified just because you change major modes.
Enable your major mode and put your cursor in the comment then run M-x eval-expression (syntax-ppss-context (syntax-ppss (point))), it should yield 'comment and you'll see that the syntax table is setup correctly.
A simple fix would be to call (font-lock-fontify-buffer) ...
Take a look at the C-hv value of font-lock-type-face the value is just the symbol font-lock-type-face. Now look at the C-hv value of my-mode-foo-face. Oh no! you can't! It's not a variable!
You need a variable to access your face. Declaring the foo-face face does not declare the foo-face variable.
Add (defvar my-mode-foo-face 'my-mode-foo-face) after the ...
They are documented in the manual, but it doesn't use the word “fence”. The characters ! and | are listed as “generic comment delimiters” and “generic string delimiters” in the syntax class reference.
These characters were introduced in Emacs 20.1. Quoting the NEWS file:
There are two new syntax-codes, ! and | (numeric values 14
and 15). A character ...
Ok, let's get some basics straight.
Nesting syntax tables is possible
Syntax tables don't have to be global to the entire buffer.
You can apply them as text properties to specific regions. This means
you can indeed apply the elisp syntax table only to regions
surrounded by backticks.
How do you do that?
Here's one way you can do that. This method does it ...
You don't want to nest one syntax table (which is a vector structure) inside another, you want to set up a buffer where, depending on the position, one syntax table would be used instead of the other.
The other answer describes how to do this using the syntax-table text property. Here's how to do it using one of the "multiple major mode" packages, mmm-mode. ...
The Emacs one is actually better. Here's why, The purpose of syntax highlighting in text editors is not being pretty, but to make important code structures stand out.
If you look at the Emacs sample, you'll see 'MyClass' being colored in the 'type name' color and 'obj' in 'variable' color, which makes the important information that you have one variable '...
In org-9 it might be as simple as this for file links:
:face (lambda (path) (if (file-exists-p path) 'org-link 'org-warning)))
For internal links I don't know an easy way to do it.
Using a keyboard macro is a valid option, as is defining a custom command. The main advantage of using a keyboard macro is that you don't have to know any Elisp to create it. On the other hand, custom commands are easier to modify later on. I'm going to outline both solutions; feel free to pick the one you're most comfortable with.
Solution 1: Keyboard ...
When you modify the buffer, only the lines you modified get re-highlighted right away. If the modification affects highlighting of lines futher down, these get re-highlighted later via an idle timer (i.e. it happens after you stop typing).
This delay is controlled by jit-lock-context-time and defaults to 0.5s. Note that it really means "Emacs has been ...
To disable the behavior..
(setq web-mode-enable-current-element-highlight nil)
web-mode-enable-current-element-highlight is a variable defined in
‘web-mode.el’. Its value is nil
Documentation: Disable element highlight.
M-x web-mode-toggle-current-element-highlight return
font-lock-syntactic-face-function is a regular variable from Font Lock, more specifically from the Syntactic Font Lock phase (emphasis mine):
If this variable is non-nil, it should be a function to determine which face to use for a given syntactic element (a string or a comment). The value is normally set through an other-vars element in font-lock-...
There's code in sql-interactive-mode which says:
;; Note that making KEYWORDS-ONLY nil will cause havoc if you try
;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column
;; will have just one quote. Therefore syntactic highlighting is
;; disabled for interactive buffers. No imenu support.
(sql-product-font-lock t nil)
and the t says "only ...
@lawlist is correct: This question is a (not-so-obvious) duplicate of How to change word wrap highlighting in Emacs on StackOverflow. Since we can't close questions against posts on other StackExchange sites, I'm going to repeat the answer that I gave over there:
Highlighting of content that exceeds word wrap bounds is provided by whitespace-mode (which is ...
The problem is that sometimes text property face is used for highlighting, and hl-line-mode uses an overlay. And overlays always appear "on top of" text property face highlighting.
diff-mode, for example, uses the text property, not an overlay. So for cases like this you are out of luck.
But for highlighting that is produced by an overlay you can just ...
Taken from syntax.h:
/* A syntax table is a chartable whose elements are cons cells
(CODE+FLAGS . MATCHING-CHAR). MATCHING-CHAR can be nil if the char
is not a kind of parenthesis.
The low 8 bits of CODE+FLAGS is a code, as follows: */
Swhitespace, /* for a whitespace character */
Spunct, /* for random ...
Better yet, is there a pastebin site that can disentangle Emacs discussions and highlight syntax correctly in lines based on SRC tags like the following, including both the code snippet and the non-lisp commentary?
There is a "gist mode" you can install from MELPA that can do that--Github and Gist both support Org-mode files.
After you have that repo, you ...