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 ...
You can set hl-line-sticky-flag to nil
hl-line-sticky-flag is a variable defined in hl-line.el.
Non-nil means the HL-Line mode highlight appears in all windows.
Otherwise Hl-Line mode will highlight only in the selected
window. Setting this variable takes effect the next time you use
the command hl-line-mode to turn Hl-Line mode on.
@Chakravarthy Raghunandan answered your question completely and succinctly.
But you owe it to yourself to learn to ask Emacs -- that will help you much more, both immediately and in the long run. One of the goals of this particular Stack-Exchange site is to help not only by answering specific questions, but by helping you learn to help yourself.
This kind ...
Is there a better way to unhighlight all highlighted symbols in a buffer?
From C-h f unhighlight-regexp, we get
Remove highlighting of each match to REGEXP set by hi-lock.
Interactively, prompt for REGEXP, accepting only regexps
previously inserted by hi-lock interactive functions.
If REGEXP is t (or if C-u was ...
Library Highlight (highlight.el) lets you highlight any number of regions in various ways, including using regexps, using any number of faces.
One easy way to highlight an expanse of text (and have it persist until you remove it) is to sweep your mouse over it - like using a highlighter pen. This is command hlt-highlighter. By default, the command is ...
highlight-symbol-mode uses text properties, not an overlay.
hl-line-mode uses an overlay, not text properties.
Overlays always take precedence over text properties, no matter how low the overlay priority is.
So without some coding or code tweaking, I don't see a solution.
However, if you use the Highlight library (highlight.el) then the solution is ...
Try M-x whitespace-mode to toggle display of space, line breaks, etc. You can set whitespace-style to control what gets displayed. (Try M-x customize-variable whitespace-style to see what options are available.)
You might also try: M-x customize-group whitespace, to see all the related options -- whether to turn on whitespace-mode globally, how to display ...
This should do what you want. Define regexps that match what you want, and faces.
Then match the subgroups in the function you add to font-lock-keywords. The subgroups are used to say that you want only the spaces after indenting tabs, and only non-indenting tabs.
(defface my-tab '((t (:background "LemonChiffon"))) "..." :group 'faces)
(defface my-space '...
I've implemented this for hl-line-mode using the buffer-list-update-hook.
Here's the code:
"Inactive variant of `hl-line'."
(defun hl-line-update-face (window)
"Update the `hl-line' face in WINDOW to indicate whether the window is selected."
(with-current-buffer (window-buffer window)
Basically, the hl-line face is defining a :foreground property, which is overriding the other foreground colors in your theme.
misterioso defines hl-line in terms of highlight using inheritance, and because of an awkward issue (which I asked about here), it's not possible AFAIK to directly inherit from a face, and override one of the properties to be unset.
This is the case by default for me: hl-line-mode by default uses a face which only specifies a background color. That face is hl-line which by default just inherits from highlight. So maybe the problem is simply your that highlight face specifies both a background and a foreground color. I recommend you M-x customize-face and either change your highlight ...
Are you looking for hi-lock-mode? You can highlight matching regexps or highlight regions by using highlight-phrase: C-x w p phrase RET face RET.
Read the source code of volatile-highlights and you'll find you don't need advice at all, supporting any command is built into volatile-highlights. All you need is two lines of code:
(vhl/define-extension 'my-evil-highlights 'evil-yank 'evil-move 'some-other-functions ...)
Read the docs for the two functions ...
Quoting from the manual:
The kinds of whitespace visualized are determined by the list variable
whitespace-style. Individual elements in that list can be toggled on
or off in the current buffer by typing M-x whitespace-toggle-options.
You're setting whitespace-style with this code:
(setq whitespace-style (quote (face spaces tabs newline space-mark ...
It should work like this: [...] Use cursor keys. Highlighting disappears immediately!
I want show-paren-delay only when navigating the code. If I actually type a new parenthesis, I want immediate highlighting.
You can make it work like that with the following code. show-paren-clear-highlight should be added to Emacs since it's accessing internal ...
You can use command flash-line-highlight (e.g., bind it to a key) to highlight the current line for line-show-period seconds (which you can customize). This is in library hl-line+.el. See Highlight Current Line.
If you want to highlight both the line and the column temporarily then you can use command flash-crosshairs (bind it to a key). This is in library ...
There are several ways to do this. One of my preferred methods is the bm package. The package provides visual bookmarks:
The setup is dead simple:
(global-set-key (kbd "<C-f2>") 'bm-toggle)
(global-set-key (kbd "<f2>") 'bm-next)
(global-set-key (kbd "<S-f2>") 'bm-previous)
You can change the color of the bookmark with
The problem is that you're trying it out in fundamental-mode. As explained in the docstring of hi-lock-mode:
[...] In buffers where Font Lock mode is
disabled, patterns are applied using overlays; in this case, the
highlighting will not be updated as you type.
so in order for the matching to be done as you type, you need to be using font-lock in that ...
In my comment I suggested to use highlight-regexp. But meanwhile I discovered that that method does not keep the highlighting correctly updated (it actually should).
So I wrote up a minor mode hlds-mode that does the job.
I assume that with this minor mode the variable sentence-end-double-space becomes obsolete.
You just only hook the minor mode into those ...
I realize you asked specifically about org-mode,
but this might be of interest to others reading this.
A general variable exists: mouse-highlight.
Setting it to nil disables highlighting of clickable text in all modes, keeping intact the click function.
It is documented in the emacs manual.
The original behaviour you describe sounds like blink-matching-paren:
blink-matching-paren is a variable defined in simple.el.
Non-nil means show matching open-paren when close-paren is inserted.
If t, highlight the paren. If `jump', move cursor to its position.
The new behaviour you are seeing sounds like show-paren-mode. From the help for ...
You are looking for the lazy-highlight face.
You didn't mention what color your background is, so modify the below as needed:
(set-face-attribute 'lazy-highlight nil :background "green")
Similarly, you can set the foreground color with:
(set-face-attribute 'lazy-highlight nil :foreground "black")
And you can combine the two with:
Not sure what the question is. Are you asking for code that gives you the behavior you want? Are you asking that Emacs Dev change simple.el so that it behaves as you want?
At any rate, this is the problem: Each window has its own window point, which is the position that point would have if that window were selected. This means that the region when that ...
Another way is to use library Highlight (highlight.el), commands hlt-highlight-symbol-at-point and hlt-unhighlight-symbol-at-point.
They are bound default to C-x X h s and C-x X u s, respectively. All of the highlighting and unhighlighting commands are bound on prefix key C-x X by default. Highlighting commands use prefix key C-x X h. Unhighlighting ...
First, you can get highlighting to "stick" by using property font-lock-face instead of property face.
Second, you can do what you want (using either property) with library highlight.el.
You can use command hlt-highlight to highlight or unhighlight
the region, or to highlight or unhighlight a regexp throughout the
region, depending on the prefix argument. ...