Skip to main content
16 votes
Accepted

Enable hl-line-mode globally

just add this to your .emacs or init.el file : (global-hl-line-mode 1).
Chakravarthy Raghunandan's user avatar
11 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. ...
Drew's user avatar
  • 78.1k
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 ...
Drew's user avatar
  • 78.1k
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.
rofrol's user avatar
  • 206
10 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-...
db48x's user avatar
  • 18.5k
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 ...
Drew's user avatar
  • 78.1k
8 votes

Highlight current line without changing colours

Just for reference, try (set-face-attribute 'hl-line nil :inherit nil :background "gray6")
Yadoo86's user avatar
  • 81
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 ...
glucas's user avatar
  • 20.7k
8 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://...
SeJ's user avatar
  • 108
7 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/...
bernie's user avatar
  • 609
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 ...
Gilles 'SO- stop being evil''s user avatar
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 ...
db48x's user avatar
  • 18.5k
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>")...
Lorem Ipsum's user avatar
  • 4,527
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 :...
Nicolas Rougier's user avatar
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-...
D. Gillis's user avatar
  • 496
5 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 :...
ohainaut's user avatar
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 ...
Stefan's user avatar
  • 26.5k
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 ...
Drew's user avatar
  • 78.1k
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 ...
purple_arrows's user avatar
5 votes
Accepted

temporarily highlighting current line

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 ...
Drew's user avatar
  • 78.1k
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; ...
Stefan's user avatar
  • 26.5k
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 ...
rotspelikaan's user avatar
4 votes
Accepted

How can I specify the background color for matching search results?

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, ...
Scott Weldon's user avatar
  • 2,715
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 ...
npostavs's user avatar
  • 9,223
4 votes
Accepted

How can I change the parentheses highlight style?

If you don't want such highlighting at all then turn off show-paren-mode. If you do want it, but you want it to use a different color: Put your cursor on that highlighted text and hit C-u C-x =. ...
Drew's user avatar
  • 78.1k
4 votes
Accepted

Highlight missing double-space between sentences?

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-...
Tobias's user avatar
  • 33.4k
4 votes
Accepted

show binary value in different colors

I wrote the following a while ago, it provides a minor mode highlight-c-bits that highlights exactly your pattern. It only highlights the 1:s, but it should be trivial to extend to highlighting both 0:...
Lindydancer's user avatar
  • 6,180
3 votes
Accepted

change how initial parenthesis is highlighted

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 ...
Tyler's user avatar
  • 22.5k
3 votes
Accepted

How to highlight preceeding space-indentation that isn't rounded to current width?

Using font-lock... (font-lock-add-keywords nil '(("^ \\{4\\}*\\( \\{1,3\\}\\)[^ ]" 1 'match)))
politza's user avatar
  • 3,346
3 votes

How to highlight preceeding space-indentation that isn't rounded to current width?

This can be done using font-lock-add-keywords. The example below shows you can can selectively enable this feature in your configuration - for different formats. Note the indentation is read from ...
ideasman42's user avatar
  • 8,935

Only top scored, non community-wiki answers of a minimum length are eligible