19
votes
Accepted
How to unhighlight symbol highlighted with highlight-symbol-at-point
Is there a better way to unhighlight all highlighted symbols in a buffer?
From C-h f unhighlight-regexp, we get
(unhighlight-regexp REGEXP)
Remove highlighting of each match to REGEXP set by ...
14
votes
Accepted
Enable hl-line-mode globally
just add this to your .emacs or init.el file : (global-hl-line-mode 1).
11
votes
Accepted
How to highlight specific keywords inside strings/quotes?
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 ...
11
votes
Accepted
Highlight region
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 ...
10
votes
Accepted
How to highlight current line only in selected window?
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 ...
10
votes
How to unhighlight symbol highlighted with highlight-symbol-at-point
C-u C-x w r
(unhighlight-regexp REGEXP)
(...) If REGEXP is t (or if C-u
was specified interactively), then remove all hi-lock highlighting.
9
votes
Enable hl-line-mode globally
@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. ...
9
votes
Accepted
Mysterious highlight in emacs
It's the secondary selection. Clicking and dragging sets the primary selection, and middle click pastes from that selection. Holding alt while clicking and dragging sets the secondary selection, and M-...
8
votes
Combine highlight-symbol-mode and hl-line-mode
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 ...
8
votes
Accepted
Emacs equivalent to :set list in vim
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 ...
7
votes
Highlight current line without changing colours
Just for reference, try
(set-face-attribute 'hl-line nil :inherit nil :background "gray6")
7
votes
Accepted
Why does mousing over one button also highlight adjacent buttons?
Buttons are based on text properties. Each character in a buffer has its own properties. Emacs doesn't record start and end positions for properties: properties are not intervals. When it needs to ...
7
votes
Accepted
Highlight rectangle and non-rectangle selection at the same time
There’s no simple variable you can set to control this, but you can do it with some programming if you want.
There is a variable called redisplay-highlight-region-function whose value is a function to ...
6
votes
Accepted
Turn off mouse highlighting in org-agenda
I removed the mouse face as a whole in the agenda:
(add-hook 'org-agenda-finalize-hook
(lambda () (remove-text-properties
(point-min) (point-max) '(mouse-face t))))
6
votes
Highlight region
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.
https://www.gnu.org/software/emacs/manual/html_node/...
6
votes
Accepted
Bookmarking / Highlighting lines in a file
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:
(require 'bm)
(global-set-key (kbd "<C-f2>")...
6
votes
Accepted
How do I highlight the current line?
Likely many ways to do this but the built in package called hl-line works very nicely. M-x hl-line-mode works as a local minor mode. or M-x global-hl-line-mode works as a global mode. goto https://...
6
votes
Accepted
Color calendar day according to number of event in org-agenda
I ended up with the code below. I guess it can be shorten/optimized (it's a bit slow) but it does the job.
(defface busy-1 '((t :foreground "black" :background "#eceff1")) "")
(defface busy-2 '((t :...
6
votes
minor mode to display long integers?
I did some searching and surprisingly couldn't find any existing minor modes that seemed to do this. I thought it would be a fun little project, however, so I've written a minimal minor mode (rainbow-...
5
votes
Accepted
Line highlighting canceling out syntax highlighting
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 ...
5
votes
Change highlight color when window isn't in focus?
I've implemented this for hl-line-mode using the buffer-list-update-hook.
Here's the code:
(defface hl-line-inactive
'((t nil))
"Inactive variant of `hl-line'."
:group 'hl-line)
(defun hl-...
5
votes
Accepted
Whitespace highlighting
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 ...
5
votes
Highlight current line without changing colours
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 ...
5
votes
Accepted
Turn off whitespace-mode highlighting
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 ...
5
votes
Accepted
How to make new text highlighted as well?
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; ...
4
votes
How to unhighlight symbol highlighted with highlight-symbol-at-point
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. ...
4
votes
Accepted
How can I get VolatileHighlights to work with evil-yank, evil-delete, etc?
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-...
4
votes
Turn off mouse highlighting in org-agenda
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 ...
4
votes
Highlight current line without changing colours
This works for me, with this in my .emacs. See how the syntax colours are nicely preserved? (thx Yadoo86)
;; highlight line with the cursor, preserving the colours.
(set-face-attribute 'hl-line nil :...
4
votes
Accepted
Stop highlighting parentheses when I start typing
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
highlighting × 179syntax-highlighting × 18
faces × 16
org-mode × 15
hl-line-mode × 15
font-lock × 14
regular-expressions × 8
region × 8
whitespace × 7
isearch × 6
parentheses × 6
highlight-chars × 6
latex × 5
auctex × 5
fonts × 5
search × 5
colors × 5
overlays × 5
org-agenda × 4
bookmarks × 4
syntax × 4
whitespace-mode × 4
spacemacs × 3
init-file × 3
magit × 3