Function: linum-mode

linum-mode is an interactive and byte-compiled function defined in linum.el.gz.

This command is obsolete since 29.1; use display-line-numbers-mode(var)/display-line-numbers-mode(fun) instead.

Signature

(linum-mode &optional ARG)

Documentation

Toggle display of line numbers in the left margin (Linum mode).

This mode has been largely replaced by display-line-numbers-mode(var)/display-line-numbers-mode(fun)
(which is much faster and has fewer interaction problems with other
modes).

Linum mode is a buffer-local minor 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.

Probably introduced at or before Emacs version 26.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/linum.el.gz
;;;###autoload
(define-minor-mode linum-mode
  "Toggle display of line numbers in the left margin (Linum mode).
This mode has been largely replaced by `display-line-numbers-mode'
(which is much faster and has fewer interaction problems with other
modes).

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)
        (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-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)))