;; highlight the current line; set a custom face, so we can ;; recognize from the normal marking (selection) (defface hl-line '((t (:background "Gray"))) "Face to use for `hl-line-face'." :group 'hl-line) (setq hl-line-face 'hl-line) (global-hl-line-mode t) ; turn it on for all modes by defaultWhat this does:
- first, we define a special font ('face' in emacs-jargon) and we call it hl-line; there is a special format for that, which is discussed in detail in the ELisp Manual;
- second, we assign this 'face' to the hl-line-face-variable; this determines the face that will be used for highlighting;
- third, we turn the highlighting on for all modes.
- You can of course experiment with the font/face: you can change the foreground and background colors, make things bold or italic, bigger or smaller, etc. -- personally I like to keep things a bit subtle;
- In some emacs-versions, hl-line-mode may not be available; if you need to use your .emacs which such an emacs, the entry on using functions only if they are available might come handy.