Juneki Hong


Underline the current line in emacs

When editing files, I like to delete lines by using Ctrl+k. However, for things like Python files, the code can be indented in a way such that its hard to tell which line you are deleting. So my solution for this is to underline the current line.

In your .emacs config file add the line

(global-hl-line-mode 1)

To enable current line highlighting. If you like the default bright green, then you are done. However, if you want to change the color, you need to add the line

(set-face-background ‘highlight “#222”)

Taken from: here

After trying out some different colors, I decided that I didn’t like highlighting my current line. So I looked to see how to underline the current line. In order to do this, you need to add two more lines. Here are all four lines in my .emacs file:

(global-hl-line-mode 1)

(set-face-background ‘highlight “#222”)

(set-face-foreground ‘highlight nil)

(set-face-underline-p ‘highlight t)

Taken from the second post of: here

And so if you restart emacs, you should see this neat underline that does not override the preexisting color configuration.

Published by juneki, on July 22nd, 2014 at 6:19 am. Filled under: ConfigsNo Comments