💥 Drop Emacs 25.x support
Emacs 26.1 is Doom's new minimum supported version Closes #2026
This commit is contained in:
parent
9cb535043c
commit
99cd52e70f
33 changed files with 48 additions and 426 deletions
|
@ -1,92 +0,0 @@
|
|||
;;; core/autoload/line-numbers.el -*- lexical-binding: t; -*-
|
||||
;;;###if (version< emacs-version "26.1")
|
||||
|
||||
;; DEPRECATED This was lifted out of the display-line-numbers library in Emacs
|
||||
;; 26.1 and modified to use nlinum for Emacs 25.x users. It should be removed
|
||||
;; should Emacs 25 support be removed.
|
||||
|
||||
;;;###autoload
|
||||
(defvar display-line-numbers t
|
||||
"Non-nil means display line numbers.
|
||||
|
||||
If the value is t, display the absolute number of each line of a buffer
|
||||
shown in a window. Absolute line numbers count from the beginning of
|
||||
the current narrowing, or from buffer beginning. If the value is
|
||||
relative, display for each line not containing the window's point its
|
||||
relative number instead, i.e. the number of the line relative to the
|
||||
line showing the window's point.
|
||||
|
||||
In either case, line numbers are displayed at the beginning of each
|
||||
non-continuation line that displays buffer text, i.e. after each newline
|
||||
character that comes from the buffer. The value visual is like
|
||||
relative but counts screen lines instead of buffer lines. In practice
|
||||
this means that continuation lines count as well when calculating the
|
||||
relative number of a line.
|
||||
|
||||
Lisp programs can disable display of a line number of a particular
|
||||
buffer line by putting the display-line-numbers-disable text property
|
||||
or overlay property on the first visible character of that line.")
|
||||
|
||||
(defgroup display-line-numbers nil "Display line number preferences"
|
||||
:group 'emacs)
|
||||
|
||||
;;;###autoload
|
||||
(defcustom display-line-numbers-type t
|
||||
"The default type of line numbers to use in `display-line-numbers-mode'.
|
||||
See `display-line-numbers' for value options."
|
||||
:type '(choice (const :tag "Relative line numbers" relative)
|
||||
(const :tag "Relative visual line numbers" visual)
|
||||
(other :tag "Absolute line numbers" t)))
|
||||
|
||||
;;;###autoload
|
||||
(defcustom display-line-numbers-grow-only nil
|
||||
"If non-nil, do not shrink line number width."
|
||||
:type 'boolean)
|
||||
|
||||
;;;###autoload
|
||||
(defcustom display-line-numbers-width-start nil
|
||||
"If non-nil, count number of lines to use for line number width.
|
||||
When `display-line-numbers-mode' is turned on,
|
||||
`display-line-numbers-width' is set to the minimum width necessary
|
||||
to display all line numbers in the buffer."
|
||||
:type 'boolean)
|
||||
|
||||
;;;###autoload
|
||||
(defun line-number-display-width (&optional _)
|
||||
"Return the width used for displaying line numbers in the
|
||||
selected window."
|
||||
(length (save-excursion (goto-char (point-max))
|
||||
(format-mode-line "%l"))))
|
||||
|
||||
(defun display-line-numbers-update-width ()
|
||||
"Prevent the line number width from shrinking."
|
||||
(let ((width (line-number-display-width)))
|
||||
(when (> width (or display-line-numbers-width 1))
|
||||
(setq display-line-numbers-width width))))
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode display-line-numbers-mode
|
||||
"Toggle display of line numbers in the buffer.
|
||||
This uses `display-line-numbers' internally.
|
||||
|
||||
To change the type of line numbers displayed by default,
|
||||
customize `display-line-numbers-type'. To change the type while
|
||||
the mode is on, set `display-line-numbers' directly."
|
||||
:lighter nil
|
||||
(cond ((null display-line-numbers-type))
|
||||
((eq display-line-numbers-type 'relative)
|
||||
(if display-line-numbers-mode
|
||||
(nlinum-relative-off)
|
||||
(nlinum-relative-on)))
|
||||
((nlinum-mode (if display-line-numbers-mode +1 -1)))))
|
||||
|
||||
(defun display-line-numbers--turn-on ()
|
||||
"Turn on `display-line-numbers-mode'."
|
||||
(unless (or (minibufferp)
|
||||
;; taken from linum.el
|
||||
(and (daemonp) (null (frame-parameter nil 'client))))
|
||||
(display-line-numbers-mode)))
|
||||
|
||||
;;;###autoload
|
||||
(define-globalized-minor-mode global-display-line-numbers-mode
|
||||
display-line-numbers-mode display-line-numbers--turn-on)
|
|
@ -117,8 +117,7 @@ If DIR is not a project, it will be indexed (but not cached)."
|
|||
#'projectile-find-file)))
|
||||
((fboundp 'counsel-file-jump) ; ivy only
|
||||
(call-interactively #'counsel-file-jump))
|
||||
((and (fboundp 'project-find-file-in) ; emacs 26.1+ only
|
||||
(project-current))
|
||||
((project-current)
|
||||
(project-find-file-in nil (list default-directory) nil))
|
||||
((fboundp 'helm-find-files)
|
||||
(call-interactively #'helm-find-files))
|
||||
|
|
|
@ -72,21 +72,14 @@ visual-line-mode is on, this skips relative and uses visual instead.
|
|||
See `display-line-numbers' for what these values mean."
|
||||
(interactive)
|
||||
(defvar doom--line-number-style display-line-numbers-type)
|
||||
;; DEPRECATED
|
||||
(let* ((styles `(t ,(if (and EMACS26+ visual-line-mode) 'visual 'relative) nil))
|
||||
(let* ((styles `(t ,(if visual-line-mode 'visual 'relative) nil))
|
||||
(order (cons display-line-numbers-type (remq display-line-numbers-type styles)))
|
||||
(queue (memq doom--line-number-style order))
|
||||
(next (if (= (length queue) 1)
|
||||
(car order)
|
||||
(car (cdr queue)))))
|
||||
(setq doom--line-number-style next)
|
||||
;; DEPRECATED
|
||||
(if EMACS26+
|
||||
(setq display-line-numbers next)
|
||||
(pcase next
|
||||
(`t (nlinum-relative-off) (nlinum-mode +1))
|
||||
(`relative (nlinum-relative-on))
|
||||
(`nil (nlinum-mode -1))))
|
||||
(setq display-line-numbers next)
|
||||
(message "Switched to %s line numbers"
|
||||
(pcase next
|
||||
(`t "normal")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue