Function: linum-mode
linum-mode is an autoloaded, interactive and byte-compiled function
defined in linum.el.gz.
Signature
(linum-mode &optional ARG)
Documentation
Toggle display of line numbers in the left margin (Linum mode).
This is a minor mode. If called interactively, toggle the Linum
mode mode. If the prefix argument is positive, enable the mode, and
if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is toggle. Enable the
mode if ARG is nil, omitted, or is a positive number. Disable the
mode if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate linum-mode(var)/linum-mode(fun).
The mode's hook is called both when the mode is enabled and when it is disabled.
Linum mode is a buffer-local minor mode.
Probably introduced at or before Emacs version 26.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/linum.el.gz
;;;###autoload
(define-minor-mode linum-mode
"Toggle display of line numbers in the left margin (Linum mode).
Linum mode is a buffer-local minor mode."
:lighter "" ; for desktop.el
:append-arg-docstring t
(if linum-mode
(progn
(if linum-eager
(add-hook 'post-command-hook (if linum-delay
'linum-schedule
'linum-update-current) nil t)
(add-hook 'after-change-functions 'linum-after-change nil t))
(add-hook 'window-scroll-functions 'linum-after-scroll nil t)
;; Using both window-size-change-functions and
;; window-configuration-change-hook seems redundant. --Stef
;; (add-hook 'window-size-change-functions 'linum-after-size nil t)
(add-hook 'change-major-mode-hook 'linum-delete-overlays nil t)
(add-hook 'window-configuration-change-hook
;; FIXME: If the buffer is shown in N windows, this
;; will be called N times rather than once. We should use
;; something like linum-update-window instead.
'linum-update-current nil t)
(linum-update-current))
(remove-hook 'post-command-hook 'linum-update-current t)
(remove-hook 'post-command-hook 'linum-schedule t)
;; (remove-hook 'window-size-change-functions 'linum-after-size t)
(remove-hook 'window-scroll-functions 'linum-after-scroll t)
(remove-hook 'after-change-functions 'linum-after-change t)
(remove-hook 'window-configuration-change-hook 'linum-update-current t)
(remove-hook 'change-major-mode-hook 'linum-delete-overlays t)
(linum-delete-overlays)))