This page describes package Lisp:highline.el, by ViniciusJoseLatorre.
This package is a minor mode to highlight the current line in buffer.
Lisp:highline.el was inspired by:
linemenu.el – Bill Brodie <wbrodie@panix.com> hl-line.el – DaveLove To use Lisp:highline.el, insert in your ~/.emacs:
(require 'highline)
For good performance, be sure to byte-compile Lisp:highline.el, e.g.
M-x byte-compile-file <give the path to highline.el when prompted>
This will generate highline.elc, which will be loaded instead of Lisp:highline.el.
Lisp:highline.el was tested with GNU Emacs 21, 22, 23 and 24, XEmacs 21.4.20, and Aquamacs Emacs 1.5.
(I am using this with 21.4 (patch 19) – StefanKamphausen)
To customize HighlineMode, type:
M-x highline-customize RET
LOCAL HighlineMode (see NOTE 1 below):
C-u 1 M-x highline-mode RET C-u 0 M-x highline-mode RETM-x highline-mode RET GLOBAL HighlineMode (see NOTE 1 below):
C-u 1 M-x global-highline-mode RET C-u 0 M-x global-highline-mode RETM-x global-highline-mode RET INDIRECT HighlineMode (see NOTE 2 below):
C-u 1 M-x highline-view-mode RET C-u 0 M-x highline-view-mode RETM-x highline-view-mode RET M-x highline-split-window-vertically RETM-x highline-split-window-horizontally RETYou can also bind ‘highline-mode’, ‘global-highline-mode’, ‘highline-customize’, ‘highline-view-mode’, ‘highline-split-window-vertically’ and ‘highline-split-window-horizontally’ to some key, like:
(global-set-key "\C-c-h" 'highline-mode) (global-set-key "\C-c-g" 'global-highline-mode) (global-set-key "\C-c-c" 'highline-customize) (global-set-key "\C-c-v" 'highline-view-mode) (global-set-key "\C-c-2" 'highline-split-window-vertically) (global-set-key "\C-c-3" 'highline-split-window-horizontally)
‘highline-view-mode’) is useful when you wish to have various visions of the same buffer. Indirect HighlineMode uses an indirect buffer to get the vision of the buffer. So, if you kill an indirect buffer, the base buffer is not affected; if you kill the base buffer, all indirect buffer related with the base buffer is automagically killed. Also, any text insertion/deletion in any indirect or base buffer is updated in all related buffers.As an example, try to insert this in your ~/.emacs file:
(require 'highline)
(defun highline-mode-on () (highline-mode 1))
;; Turn on local highlighting for Dired (C-x d)
(add-hook 'dired-after-readin-hook #'highline-mode-on)
;; Turn on local highlighting for list-buffers (C-x C-b)
(defadvice list-buffers (after highlight-line activate)
(save-excursion
(set-buffer "*Buffer List*")
(highline-mode-on)))HighlineMode has the following hook variables:
‘global-highline-mode-hook’ ‘highline-mode-hook’ ‘highline-view-mode-hook’ ‘highline-load-hook’ Below it’s shown a brief description of HighlineMode options, please, see the options declaration in the code for a long documentation.
‘highline-face’ ‘highline-vertical-face’ ‘highline-line’ ‘highline-vertical’ ‘highline-ignore-regexp’ ‘highline-priority’ ‘highline-selected-window’ nil means highlight current line on current window.‘highline-view-prefix’ ‘highline-keep-highlight’ nil means keep highlight on nonselected windows with highline mode on.To set the above options you may:
a. insert the code in your ~/.emacs, like:
(setq highline-face 'highlight)
This way always keep your default settings when you enter a new Emacs session.
b. or use ‘set-variable’ in your Emacs session, like:
M-x set-variable RET highline-face RET highlight RET
This way keep your settings only during the current Emacs session.
c. or use customization, for example:
In Emacs 21 or lower:
Help option,Customize,Browse Customization Groups,Editing group,Highline groupIn Emacs 22 or higher:
Options option,Customize Emacs,Browse Customization Groups,Editing group,Highline groupThrough this way, you may choose if the settings are kept or not when you leave out the current Emacs session.
d. or see the option value:
C-h v highline-face RET
and click the customize hypertext button.
Through this way, you may choose if the settings are kept or not when you leave out the current Emacs session.
e. or invoke:
M-x highline-customize RET
and then customize HighlineMode options.
Through this way, you may choose if the settings are kept or not when you leave out the current Emacs session.
Thanks to LeWang for not highlight a line when region is active.
Thanks to DavidReitter for ‘highline-face’ less contrastive default values.
Thanks to StefanKamphausen and Steven Tate <state@odnosam.com> for testing.
Thanks to Gwern Branwen <gwern0@gmail.com> for indicating defface :group attribute.
Thanks to Sandip Chitale <sandip.chitale@brokat.com> for byte-compilation tests.
Thanks to Stephan Engelke <engelke@gmx.ne> for XEmacs tests.
Thanks to Roman Belenov <roman@nstl.nnov.ru> for ‘pre-command-hook’ suggestion.
Thanks to Trey Jackson <bigfaceworm@hotmail.com> for ‘highline-line’ enhancements.
Thanks to Fredrik Sundstroem <fresun-7@sm.luth.se> for permanent-local overlay property indication.
Thanks to:
linemenu.elhl-line.elAnd to all people who contributed with them.