💥 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
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -16,8 +16,8 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
emacs_version:
|
emacs_version:
|
||||||
- 25.3
|
|
||||||
- 26.1
|
- 26.1
|
||||||
|
- 26.3
|
||||||
- snapshot
|
- snapshot
|
||||||
include:
|
include:
|
||||||
- emacs_version: 26.3
|
- emacs_version: 26.3
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<img src="https://img.shields.io/github/tag/hlissner/doom-emacs.svg?label=release&color=orange" alt="Made with Doom Emacs">
|
<img src="https://img.shields.io/github/tag/hlissner/doom-emacs.svg?label=release&color=orange" alt="Made with Doom Emacs">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://emacs.org">
|
<a href="https://emacs.org">
|
||||||
<img src="https://img.shields.io/badge/Made_for-Emacs_25.3+-blueviolet.svg" alt="Made for Emacs 25.3+">
|
<img src="https://img.shields.io/badge/Made_for-Emacs_26.1+-blueviolet.svg" alt="Made for Emacs 26.1+">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/hlissner/doom-emacs/actions">
|
<a href="https://github.com/hlissner/doom-emacs/actions">
|
||||||
<img src="https://github.com/hlissner/doom-emacs/workflows/CI/badge.svg" alt="Build status: develop">
|
<img src="https://github.com/hlissner/doom-emacs/workflows/CI/badge.svg" alt="Build status: develop">
|
||||||
|
|
|
@ -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)))
|
#'projectile-find-file)))
|
||||||
((fboundp 'counsel-file-jump) ; ivy only
|
((fboundp 'counsel-file-jump) ; ivy only
|
||||||
(call-interactively #'counsel-file-jump))
|
(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))
|
(project-find-file-in nil (list default-directory) nil))
|
||||||
((fboundp 'helm-find-files)
|
((fboundp 'helm-find-files)
|
||||||
(call-interactively #'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."
|
See `display-line-numbers' for what these values mean."
|
||||||
(interactive)
|
(interactive)
|
||||||
(defvar doom--line-number-style display-line-numbers-type)
|
(defvar doom--line-number-style display-line-numbers-type)
|
||||||
;; DEPRECATED
|
(let* ((styles `(t ,(if visual-line-mode 'visual 'relative) nil))
|
||||||
(let* ((styles `(t ,(if (and EMACS26+ visual-line-mode) 'visual 'relative) nil))
|
|
||||||
(order (cons display-line-numbers-type (remq display-line-numbers-type styles)))
|
(order (cons display-line-numbers-type (remq display-line-numbers-type styles)))
|
||||||
(queue (memq doom--line-number-style order))
|
(queue (memq doom--line-number-style order))
|
||||||
(next (if (= (length queue) 1)
|
(next (if (= (length queue) 1)
|
||||||
(car order)
|
(car order)
|
||||||
(car (cdr queue)))))
|
(car (cdr queue)))))
|
||||||
(setq doom--line-number-style next)
|
(setq doom--line-number-style next)
|
||||||
;; DEPRECATED
|
(setq display-line-numbers next)
|
||||||
(if EMACS26+
|
|
||||||
(setq display-line-numbers next)
|
|
||||||
(pcase next
|
|
||||||
(`t (nlinum-relative-off) (nlinum-mode +1))
|
|
||||||
(`relative (nlinum-relative-on))
|
|
||||||
(`nil (nlinum-mode -1))))
|
|
||||||
(message "Switched to %s line numbers"
|
(message "Switched to %s line numbers"
|
||||||
(pcase next
|
(pcase next
|
||||||
(`t "normal")
|
(`t "normal")
|
||||||
|
|
|
@ -3,41 +3,6 @@
|
||||||
(require 'cl-lib)
|
(require 'cl-lib)
|
||||||
(require 'subr-x)
|
(require 'subr-x)
|
||||||
|
|
||||||
;; DEPRECATED Polyfills
|
|
||||||
(unless EMACS26+
|
|
||||||
(with-no-warnings
|
|
||||||
;; `kill-current-buffer' was introduced in Emacs 26
|
|
||||||
(defalias 'kill-current-buffer #'kill-this-buffer)
|
|
||||||
;; if-let and when-let were moved to (if|when)-let* in Emacs 26+ so we alias
|
|
||||||
;; them for 25 users.
|
|
||||||
(defalias 'if-let* #'if-let)
|
|
||||||
(defalias 'when-let* #'when-let)
|
|
||||||
|
|
||||||
;; `mapcan' was introduced in 26.1. `cl-mapcan' isn't a perfect replacement,
|
|
||||||
;; but it's close enough.
|
|
||||||
(defalias 'mapcan #'cl-mapcan)
|
|
||||||
|
|
||||||
(defun alist-get (key alist &optional default remove testfn)
|
|
||||||
"Return the value associated with KEY in ALIST.
|
|
||||||
If KEY is not found in ALIST, return DEFAULT.
|
|
||||||
Use TESTFN to lookup in the alist if non-nil. Otherwise, use `assq'.
|
|
||||||
|
|
||||||
This is a generalized variable suitable for use with `setf'.
|
|
||||||
When using it to set a value, optional argument REMOVE non-nil
|
|
||||||
means to remove KEY from ALIST if the new value is `eql' to DEFAULT."
|
|
||||||
(ignore remove) ;;Silence byte-compiler.
|
|
||||||
(let ((x (if (not testfn)
|
|
||||||
(assq key alist)
|
|
||||||
;; In Emacs<26, `assoc' has no testfn arg, so we have to
|
|
||||||
;; implement it ourselves
|
|
||||||
(if testfn
|
|
||||||
(cl-loop for entry in alist
|
|
||||||
if (funcall testfn key entry)
|
|
||||||
return entry)
|
|
||||||
(assoc key alist)))))
|
|
||||||
(if x (cdr x) default)))))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Helpers
|
;;; Helpers
|
||||||
|
|
||||||
|
|
|
@ -512,79 +512,6 @@ treat Emacs as a non-application window."
|
||||||
(defun doom-enable-line-numbers-h () (display-line-numbers-mode +1))
|
(defun doom-enable-line-numbers-h () (display-line-numbers-mode +1))
|
||||||
(defun doom-disable-line-numbers-h () (display-line-numbers-mode -1))
|
(defun doom-disable-line-numbers-h () (display-line-numbers-mode -1))
|
||||||
|
|
||||||
;; DEPRECATED `nlinum' is used for Emacs 25 users; 26+ has native line numbers.
|
|
||||||
(use-package! nlinum
|
|
||||||
;; Line number column. A faster (or equivalent, in the worst case) line number
|
|
||||||
;; plugin than `linum-mode'.
|
|
||||||
:unless EMACS26+
|
|
||||||
:defer t
|
|
||||||
:init
|
|
||||||
(defvar doom-line-number-lpad 4
|
|
||||||
"How much padding to place before line numbers.")
|
|
||||||
(defvar doom-line-number-rpad 1
|
|
||||||
"How much padding to place after line numbers.")
|
|
||||||
(defvar doom-line-number-pad-char 32
|
|
||||||
"Character to use for padding line numbers.
|
|
||||||
|
|
||||||
By default, this is a space character. If you use `whitespace-mode' with
|
|
||||||
`space-mark', the whitespace in line numbers will be affected (this can look
|
|
||||||
ugly). In this case, you can change this to ?\u2002, which is a unicode
|
|
||||||
character that looks like a space that `whitespace-mode' won't affect.")
|
|
||||||
:config
|
|
||||||
(setq nlinum-highlight-current-line t)
|
|
||||||
|
|
||||||
;; Fix lingering hl-line overlays (caused by nlinum)
|
|
||||||
(add-hook! 'hl-line-mode-hook
|
|
||||||
(remove-overlays (point-min) (point-max) 'face 'hl-line))
|
|
||||||
|
|
||||||
(defun doom-nlinum-format-fn (line _width)
|
|
||||||
"A more customizable `nlinum-format-function'. See `doom-line-number-lpad',
|
|
||||||
`doom-line-number-rpad' and `doom-line-number-pad-char'. Allows a fix for
|
|
||||||
`whitespace-mode' space-marks appearing inside the line number."
|
|
||||||
(let ((str (number-to-string line)))
|
|
||||||
(setq str (concat (make-string (max 0 (- doom-line-number-lpad (length str)))
|
|
||||||
doom-line-number-pad-char)
|
|
||||||
str
|
|
||||||
(make-string doom-line-number-rpad doom-line-number-pad-char)))
|
|
||||||
(put-text-property 0 (length str) 'face
|
|
||||||
(if (and nlinum-highlight-current-line
|
|
||||||
(= line nlinum--current-line))
|
|
||||||
'nlinum-current-line
|
|
||||||
'linum)
|
|
||||||
str)
|
|
||||||
str))
|
|
||||||
(setq nlinum-format-function #'doom-nlinum-format-fn)
|
|
||||||
|
|
||||||
(add-hook! 'nlinum-mode-hook
|
|
||||||
(defun doom-init-nlinum-width-h ()
|
|
||||||
"Calculate line number column width beforehand (optimization)."
|
|
||||||
(setq nlinum--width
|
|
||||||
(length (save-excursion (goto-char (point-max))
|
|
||||||
(format-mode-line "%l")))))))
|
|
||||||
|
|
||||||
(use-package! nlinum-hl
|
|
||||||
;; Fixes disappearing line numbers in nlinum and other quirks
|
|
||||||
:unless EMACS26+
|
|
||||||
:after nlinum
|
|
||||||
:config
|
|
||||||
;; With `markdown-fontify-code-blocks-natively' enabled in `markdown-mode',
|
|
||||||
;; line numbers tend to vanish next to code blocks.
|
|
||||||
(advice-add #'markdown-fontify-code-block-natively
|
|
||||||
:after #'nlinum-hl-do-markdown-fontify-region)
|
|
||||||
;; When using `web-mode's code-folding an entire range of line numbers will
|
|
||||||
;; vanish in the affected area.
|
|
||||||
(advice-add #'web-mode-fold-or-unfold :after #'nlinum-hl-do-generic-flush)
|
|
||||||
;; Changing fonts can leave nlinum line numbers in their original size; this
|
|
||||||
;; forces them to resize.
|
|
||||||
(add-hook 'after-setting-font-hook #'nlinum-hl-flush-all-windows))
|
|
||||||
|
|
||||||
(use-package! nlinum-relative
|
|
||||||
:unless EMACS26+
|
|
||||||
:defer t
|
|
||||||
:config
|
|
||||||
(setq nlinum-format " %d ")
|
|
||||||
(add-hook 'evil-mode-hook #'nlinum-relative-setup-evil))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Theme & font
|
;;; Theme & font
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
;;; core.el --- the heart of the beast -*- lexical-binding: t; -*-
|
;;; core.el --- the heart of the beast -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(when (version< emacs-version "25.3")
|
(when (version< emacs-version "26.1")
|
||||||
(error "Detected Emacs %s. Doom only supports Emacs 25.3 and higher"
|
(error "Detected Emacs %s. Doom only supports Emacs 26.1 and higher"
|
||||||
emacs-version))
|
emacs-version))
|
||||||
|
|
||||||
(defconst doom-version "2.0.9"
|
(defconst doom-version "2.0.9"
|
||||||
"Current version of Doom Emacs.")
|
"Current version of Doom Emacs.")
|
||||||
|
|
||||||
(defconst EMACS26+ (> emacs-major-version 25))
|
|
||||||
(defconst EMACS27+ (> emacs-major-version 26))
|
(defconst EMACS27+ (> emacs-major-version 26))
|
||||||
(defconst IS-MAC (eq system-type 'darwin))
|
(defconst IS-MAC (eq system-type 'darwin))
|
||||||
(defconst IS-LINUX (eq system-type 'gnu/linux))
|
(defconst IS-LINUX (eq system-type 'gnu/linux))
|
||||||
|
|
|
@ -9,12 +9,6 @@
|
||||||
(package! all-the-icons)
|
(package! all-the-icons)
|
||||||
(package! hide-mode-line)
|
(package! hide-mode-line)
|
||||||
(package! highlight-numbers)
|
(package! highlight-numbers)
|
||||||
;; Some early 26.x builds of Emacs do not have `display-line-numbers' yet, so
|
|
||||||
;; check for it instead of Emacs' version.
|
|
||||||
(unless (locate-library "display-line-numbers")
|
|
||||||
(package! nlinum)
|
|
||||||
(package! nlinum-hl)
|
|
||||||
(package! nlinum-relative))
|
|
||||||
(package! rainbow-delimiters)
|
(package! rainbow-delimiters)
|
||||||
(package! restart-emacs)
|
(package! restart-emacs)
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
|
|
||||||
|
|
||||||
(use-package! company-box
|
(use-package! company-box
|
||||||
:when (and EMACS26+ (featurep! +childframe))
|
:when (featurep! +childframe)
|
||||||
:hook (company-mode . company-box-mode)
|
:hook (company-mode . company-box-mode)
|
||||||
:config
|
:config
|
||||||
(setq company-box-show-single-candidate t
|
(setq company-box-show-single-candidate t
|
||||||
|
|
|
@ -4,5 +4,5 @@
|
||||||
(package! company)
|
(package! company)
|
||||||
(package! company-dict)
|
(package! company-dict)
|
||||||
(package! company-prescient)
|
(package! company-prescient)
|
||||||
(when (and EMACS26+ (featurep! +childframe))
|
(when (featurep! +childframe)
|
||||||
(package! company-box))
|
(package! company-box))
|
||||||
|
|
|
@ -82,7 +82,7 @@ be negative.")
|
||||||
(setq helm-default-prompt-display-function #'+helm--set-prompt-display))
|
(setq helm-default-prompt-display-function #'+helm--set-prompt-display))
|
||||||
|
|
||||||
:init
|
:init
|
||||||
(when (and EMACS26+ (featurep! +childframe))
|
(when (featurep! +childframe)
|
||||||
(setq helm-display-function #'+helm-posframe-display-fn))
|
(setq helm-display-function #'+helm-posframe-display-fn))
|
||||||
|
|
||||||
(let ((fuzzy (featurep! +fuzzy)))
|
(let ((fuzzy (featurep! +fuzzy)))
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
(package! swiper-helm)
|
(package! swiper-helm)
|
||||||
(when (featurep! +fuzzy)
|
(when (featurep! +fuzzy)
|
||||||
(package! helm-flx))
|
(package! helm-flx))
|
||||||
(when (and EMACS26+ (featurep! +childframe))
|
(when (featurep! +childframe)
|
||||||
(package! posframe))
|
(package! posframe))
|
||||||
(when (featurep! :lang org)
|
(when (featurep! :lang org)
|
||||||
(package! helm-org))
|
(package! helm-org))
|
||||||
|
|
|
@ -324,7 +324,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
|
||||||
|
|
||||||
|
|
||||||
(use-package! ivy-posframe
|
(use-package! ivy-posframe
|
||||||
:when (and EMACS26+ (featurep! +childframe))
|
:when (featurep! +childframe)
|
||||||
:hook (ivy-mode . ivy-posframe-mode)
|
:hook (ivy-mode . ivy-posframe-mode)
|
||||||
:config
|
:config
|
||||||
(setq ivy-fixed-height-minibuffer nil
|
(setq ivy-fixed-height-minibuffer nil
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
;; -*- lexical-binding: t; no-byte-compile: t; -*-
|
;; -*- lexical-binding: t; no-byte-compile: t; -*-
|
||||||
;;; completion/ivy/doctor.el
|
;;; completion/ivy/doctor.el
|
||||||
|
|
||||||
(when (and (not EMACS26+) (featurep! +childframe))
|
|
||||||
(error! "The +childframe feature requires Emacs 26+"))
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
(when (featurep! +fuzzy)
|
(when (featurep! +fuzzy)
|
||||||
(package! flx)))
|
(package! flx)))
|
||||||
|
|
||||||
(when (and EMACS26+ (featurep! +childframe))
|
(when (featurep! +childframe)
|
||||||
(package! ivy-posframe))
|
(package! ivy-posframe))
|
||||||
|
|
||||||
(when (featurep! +icons)
|
(when (featurep! +icons)
|
||||||
|
|
|
@ -220,7 +220,7 @@ and complains if a module is loaded too early (during startup)."
|
||||||
(add-transient-hook! 'emacs-lisp-mode
|
(add-transient-hook! 'emacs-lisp-mode
|
||||||
(+evil-collection-init 'elisp-mode))
|
(+evil-collection-init 'elisp-mode))
|
||||||
(add-transient-hook! 'occur-mode
|
(add-transient-hook! 'occur-mode
|
||||||
(+evil-collection-init (if EMACS26+ 'replace "replace")))
|
(+evil-collection-init 'replace))
|
||||||
|
|
||||||
(evil-define-key* 'normal process-menu-mode-map
|
(evil-define-key* 'normal process-menu-mode-map
|
||||||
"q" #'kill-current-buffer
|
"q" #'kill-current-buffer
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
(setq ibuffer-show-empty-filter-groups nil
|
(setq ibuffer-show-empty-filter-groups nil
|
||||||
ibuffer-filter-group-name-face '(:inherit (success bold))
|
ibuffer-filter-group-name-face '(:inherit (success bold))
|
||||||
ibuffer-formats
|
ibuffer-formats
|
||||||
`((mark modified read-only ,(if EMACS26+ 'locked "")
|
`((mark modified read-only locked
|
||||||
,@(if (featurep! +icons)
|
,@(if (featurep! +icons)
|
||||||
`(;; Here you may adjust by replacing :right with :center
|
`(;; Here you may adjust by replacing :right with :center
|
||||||
;; or :left According to taste, if you want the icon
|
;; or :left According to taste, if you want the icon
|
||||||
|
|
|
@ -66,14 +66,3 @@ otherwise in default state."
|
||||||
(when (and (bound-and-true-p evil-mode)
|
(when (and (bound-and-true-p evil-mode)
|
||||||
(bobp) (eolp))
|
(bobp) (eolp))
|
||||||
(evil-insert-state)))))
|
(evil-insert-state)))))
|
||||||
|
|
||||||
|
|
||||||
(after! smerge-mode
|
|
||||||
(unless EMACS26+
|
|
||||||
(with-no-warnings
|
|
||||||
(defalias #'smerge-keep-upper #'smerge-keep-mine)
|
|
||||||
(defalias #'smerge-keep-lower #'smerge-keep-other)
|
|
||||||
(defalias #'smerge-diff-base-upper #'smerge-diff-base-mine)
|
|
||||||
(defalias #'smerge-diff-upper-lower #'smerge-diff-mine-other)
|
|
||||||
(defalias #'smerge-diff-base-lower #'smerge-diff-base-other))))
|
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,5 @@
|
||||||
(package! yaml-mode)
|
(package! yaml-mode)
|
||||||
(package! csv-mode)
|
(package! csv-mode)
|
||||||
(package! dhall-mode)
|
(package! dhall-mode)
|
||||||
(package! protobuf-mode :recipe (:host github :repo "emacsmirror/protobuf-mode" :files (:defaults "*")))
|
(package! protobuf-mode
|
||||||
|
:recipe (:host github :repo "emacsmirror/protobuf-mode" :files (:defaults "*")))
|
||||||
;; DEPRECATED `conf-toml-mode' exists in Emacs 26+
|
|
||||||
(unless (fboundp 'conf-toml-mode)
|
|
||||||
(package! toml-mode))
|
|
||||||
|
|
|
@ -7,43 +7,13 @@
|
||||||
;;
|
;;
|
||||||
;;; Packages
|
;;; Packages
|
||||||
|
|
||||||
(use-package! rust-mode
|
|
||||||
:defer t
|
|
||||||
:config
|
|
||||||
(setq rust-indent-method-chain t)
|
|
||||||
(add-hook 'rust-mode-hook #'rainbow-delimiters-mode)
|
|
||||||
|
|
||||||
;; This is necessary because both plugins are fighting for supremacy in
|
|
||||||
;; `auto-mode-alist', so rustic-mode *must* load second. It only needs to
|
|
||||||
;; happen once.
|
|
||||||
;;
|
|
||||||
;; rust-mode is still required for `racer'.
|
|
||||||
(add-hook! 'rust-mode-hook
|
|
||||||
(defun +rust-init-h ()
|
|
||||||
"Switch to `rustic-mode', if it's available."
|
|
||||||
(when (require 'rustic nil t)
|
|
||||||
(rustic-mode))))
|
|
||||||
|
|
||||||
(set-docsets! '(rust-mode rustic-mode) "Rust")
|
|
||||||
(when (featurep! +lsp)
|
|
||||||
(add-hook 'rust-mode-local-vars-hook #'lsp!)))
|
|
||||||
|
|
||||||
|
|
||||||
(use-package! racer
|
|
||||||
:unless (featurep! +lsp)
|
|
||||||
:hook ((rust-mode rustic-mode) . racer-mode)
|
|
||||||
:config
|
|
||||||
(set-lookup-handlers! 'rust-mode
|
|
||||||
:definition '(racer-find-definition :async t)
|
|
||||||
:documentation '+rust-racer-lookup-documentation))
|
|
||||||
|
|
||||||
|
|
||||||
(use-package! rustic
|
(use-package! rustic
|
||||||
:when EMACS26+
|
:mode ("\\.rs$" . rustic-mode)
|
||||||
:after rust-mode
|
|
||||||
:preface
|
:preface
|
||||||
(setq rustic-rls-pkg (if (featurep! +lsp) 'lsp-mode))
|
(setq rustic-rls-pkg (if (featurep! +lsp) 'lsp-mode))
|
||||||
:config
|
:config
|
||||||
|
(set-docsets! 'rustic-mode "Rust")
|
||||||
|
|
||||||
(setq rustic-indent-method-chain t
|
(setq rustic-indent-method-chain t
|
||||||
rustic-flycheck-setup-mode-line-p nil
|
rustic-flycheck-setup-mode-line-p nil
|
||||||
;; use :editor format instead
|
;; use :editor format instead
|
||||||
|
@ -52,38 +22,35 @@
|
||||||
;; buffers, so we disable it, but only for evil users, because it
|
;; buffers, so we disable it, but only for evil users, because it
|
||||||
;; affects `forward-sexp' and its ilk. See
|
;; affects `forward-sexp' and its ilk. See
|
||||||
;; https://github.com/rust-lang/rust-mode/issues/288.
|
;; https://github.com/rust-lang/rust-mode/issues/288.
|
||||||
rustic-match-angle-brackets (not (featurep! :editor evil)))
|
rustic-match-angle-brackets (not (featurep! :editor evil))
|
||||||
|
;; `rustic-setup-rls' uses `package-installed-p' to determine if
|
||||||
|
;; lsp-mode/elgot are available. This breaks because Doom doesn't use
|
||||||
|
;; package.el to begin with (and lazy loads it). This is already handled
|
||||||
|
;; by the :tools lsp module, so...
|
||||||
|
rustic-lsp-setup-p nil)
|
||||||
|
|
||||||
(add-hook 'rustic-mode-hook #'rainbow-delimiters-mode)
|
(add-hook 'rustic-mode-hook #'rainbow-delimiters-mode)
|
||||||
|
|
||||||
(defadvice! +rust--dont-install-packages-p (orig-fn &rest args)
|
(when (featurep! +lsp)
|
||||||
:around #'rustic-setup-rls
|
(add-hook 'rustic-mode-local-vars-hook #'lsp!)))
|
||||||
(cl-letf (;; `rustic-setup-rls' uses `package-installed-p' to determine if
|
|
||||||
;; lsp-mode/elgot are available. This breaks because Doom doesn't
|
|
||||||
;; use package.el to begin with (and lazy loads it).
|
(use-package! racer
|
||||||
((symbol-function #'package-installed-p)
|
:unless (featurep! +lsp)
|
||||||
(lambda (pkg)
|
:hook (rustic-mode . racer-mode)
|
||||||
(require pkg nil t)))
|
:config
|
||||||
;; If lsp/elgot isn't available, it attempts to install lsp-mode
|
(set-lookup-handlers! 'rustic-mode
|
||||||
;; via package.el. Doom manages its own dependencies so we disable
|
:definition '(racer-find-definition :async t)
|
||||||
;; that behavior.
|
:documentation '+rust-racer-lookup-documentation))
|
||||||
((symbol-function #'rustic-install-rls-client-p)
|
|
||||||
(lambda (&rest _)
|
|
||||||
(message "No RLS server running"))))
|
|
||||||
(apply orig-fn args))))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Tools
|
;;; Tools
|
||||||
|
|
||||||
(use-package! cargo
|
(use-package! cargo
|
||||||
:after rust-mode
|
:after rustic-mode
|
||||||
:config
|
:config
|
||||||
(defvar +rust-keymap
|
(map! :map rustic-mode-map
|
||||||
(if (boundp 'rustic-mode-map)
|
|
||||||
rustic-mode-map
|
|
||||||
rust-mode-map))
|
|
||||||
(map! :map +rust-keymap
|
|
||||||
:localleader
|
:localleader
|
||||||
(:prefix ("b" . "build")
|
(:prefix ("b" . "build")
|
||||||
:desc "cargo add" "a" #'cargo-process-add
|
:desc "cargo add" "a" #'cargo-process-add
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
;; -*- no-byte-compile: t; -*-
|
;; -*- no-byte-compile: t; -*-
|
||||||
;;; lang/rust/packages.el
|
;;; lang/rust/packages.el
|
||||||
|
|
||||||
(when EMACS26+
|
(package! rustic)
|
||||||
(package! rustic))
|
|
||||||
(package! rust-mode)
|
|
||||||
(unless (featurep! +lsp)
|
(unless (featurep! +lsp)
|
||||||
(package! racer))
|
(package! racer))
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,6 @@
|
||||||
(after! css-mode
|
(after! css-mode
|
||||||
;; css-mode hooks apply to scss and less-css modes
|
;; css-mode hooks apply to scss and less-css modes
|
||||||
(add-hook 'css-mode-hook #'rainbow-delimiters-mode)
|
(add-hook 'css-mode-hook #'rainbow-delimiters-mode)
|
||||||
(set-company-backend! '(css-mode scss-mode)
|
|
||||||
(if EMACS26+
|
|
||||||
;; DEPRECATED css-mode's built in completion is superior in 26+
|
|
||||||
'company-capf
|
|
||||||
'company-css))
|
|
||||||
|
|
||||||
(map! :localleader
|
(map! :localleader
|
||||||
:map scss-mode-map
|
:map scss-mode-map
|
||||||
"b" #'+css/scss-build
|
"b" #'+css/scss-build
|
||||||
|
|
|
@ -41,12 +41,7 @@
|
||||||
(setcdr alist
|
(setcdr alist
|
||||||
(cl-loop for pair in (cdr alist)
|
(cl-loop for pair in (cdr alist)
|
||||||
unless (string-match-p "^[a-z-]" (cdr pair))
|
unless (string-match-p "^[a-z-]" (cdr pair))
|
||||||
collect (cons (car pair)
|
collect (cons (car pair) (string-trim-right (cdr pair))))))
|
||||||
;; TODO Replace with `string-trim-right' (Emacs 26+)
|
|
||||||
(let ((string (cdr pair)))
|
|
||||||
(if (string-match "\\(?:>\\|]\\|}\\)+\\'" string)
|
|
||||||
(replace-match "" t t string)
|
|
||||||
string))))))
|
|
||||||
(delq! nil web-mode-engines-auto-pairs))
|
(delq! nil web-mode-engines-auto-pairs))
|
||||||
|
|
||||||
(map! :map web-mode-map
|
(map! :map web-mode-map
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
;; +css.el
|
;; +css.el
|
||||||
(package! css-mode :built-in t)
|
(package! css-mode :built-in t)
|
||||||
(package! less-css-mode :built-in (not (version< emacs-version "26.1")))
|
(package! less-css-mode :built-in t)
|
||||||
|
|
||||||
(package! sass-mode)
|
(package! sass-mode)
|
||||||
(package! stylus-mode)
|
(package! stylus-mode)
|
||||||
|
|
|
@ -63,7 +63,6 @@ errors.")
|
||||||
|
|
||||||
|
|
||||||
(use-package! flycheck-posframe
|
(use-package! flycheck-posframe
|
||||||
:when EMACS26+
|
|
||||||
:when (featurep! +childframe)
|
:when (featurep! +childframe)
|
||||||
:defer t
|
:defer t
|
||||||
:init (add-hook 'flycheck-mode-hook #'+flycheck-init-popups-h)
|
:init (add-hook 'flycheck-mode-hook #'+flycheck-init-popups-h)
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
|
|
||||||
(package! flycheck)
|
(package! flycheck)
|
||||||
(package! flycheck-popup-tip)
|
(package! flycheck-popup-tip)
|
||||||
(when (and EMACS26+ (featurep! +childframe))
|
(when (featurep! +childframe)
|
||||||
(package! flycheck-posframe))
|
(package! flycheck-posframe))
|
||||||
|
|
|
@ -106,8 +106,7 @@ Also logs the resolved project root, if found."
|
||||||
(defun +lsp-init-ui-flycheck-or-flymake-h ()
|
(defun +lsp-init-ui-flycheck-or-flymake-h ()
|
||||||
"Sets up flymake-mode or flycheck-mode, depending on `lsp-prefer-flymake'."
|
"Sets up flymake-mode or flycheck-mode, depending on `lsp-prefer-flymake'."
|
||||||
(cond ((eq :none lsp-prefer-flymake))
|
(cond ((eq :none lsp-prefer-flymake))
|
||||||
((and (not (version< emacs-version "26.1"))
|
(lsp-prefer-flymake
|
||||||
lsp-prefer-flymake)
|
|
||||||
(lsp--flymake-setup))
|
(lsp--flymake-setup))
|
||||||
((require 'flycheck nil t)
|
((require 'flycheck nil t)
|
||||||
(require 'lsp-ui-flycheck)
|
(require 'lsp-ui-flycheck)
|
||||||
|
|
|
@ -36,5 +36,5 @@
|
||||||
|
|
||||||
|
|
||||||
;; Is built into Emacs 26+
|
;; Is built into Emacs 26+
|
||||||
(when (and EMACS26+ (featurep! +auth))
|
(when (featurep! +auth)
|
||||||
(auth-source-pass-enable))
|
(auth-source-pass-enable))
|
||||||
|
|
|
@ -61,8 +61,8 @@
|
||||||
|
|
||||||
;; On Emacs 26+, when point is on the last line and solaire-mode is remapping
|
;; On Emacs 26+, when point is on the last line and solaire-mode is remapping
|
||||||
;; the hl-line face, hl-line's highlight bleeds into the rest of the window
|
;; the hl-line face, hl-line's highlight bleeds into the rest of the window
|
||||||
;; after eob.
|
;; after eob. On Emacs 27 this no longer happens.
|
||||||
(when EMACS26+
|
(unless EMACS27+
|
||||||
(defun +doom--line-range-fn ()
|
(defun +doom--line-range-fn ()
|
||||||
(cons (line-beginning-position)
|
(cons (line-beginning-position)
|
||||||
(cond ((let ((eol (line-end-position)))
|
(cond ((let ((eol (line-end-position)))
|
||||||
|
|
|
@ -28,9 +28,7 @@ Meant for `doom-change-font-size-hook'."
|
||||||
xlfd-regexp-pixelsize-subnum)))
|
xlfd-regexp-pixelsize-subnum)))
|
||||||
(scale (frame-parameter nil 'font-scale)))
|
(scale (frame-parameter nil 'font-scale)))
|
||||||
(setq doom-modeline-height (+ default-height (* scale doom-font-increment))))
|
(setq doom-modeline-height (+ default-height (* scale doom-font-increment))))
|
||||||
(setq doom-modeline-height default-height))
|
(setq doom-modeline-height default-height))))
|
||||||
;; already has a variable watcher in Emacs 26+
|
|
||||||
(unless EMACS26+ (doom-modeline-refresh-bars))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +modeline-update-env-in-all-windows-h (&rest _)
|
(defun +modeline-update-env-in-all-windows-h (&rest _)
|
||||||
|
|
|
@ -139,11 +139,6 @@ default window parameters for popup windows, clears leftover transient timers
|
||||||
and enables `+popup-buffer-mode'."
|
and enables `+popup-buffer-mode'."
|
||||||
(with-selected-window window
|
(with-selected-window window
|
||||||
(setq alist (delq (assq 'actions alist) alist))
|
(setq alist (delq (assq 'actions alist) alist))
|
||||||
(when (and alist +popup--populate-wparams)
|
|
||||||
;; Emacs 26+ will automatically map the window-parameters alist entry to
|
|
||||||
;; the popup window, so we need this for Emacs 25.x users
|
|
||||||
(dolist (param (cdr (assq 'window-parameters alist)))
|
|
||||||
(set-window-parameter window (car param) (cdr param))))
|
|
||||||
(set-window-parameter window 'popup t)
|
(set-window-parameter window 'popup t)
|
||||||
(set-window-parameter window 'split-window #'+popup--split-window)
|
(set-window-parameter window 'split-window #'+popup--split-window)
|
||||||
(set-window-parameter window 'delete-window #'+popup--delete-window)
|
(set-window-parameter window 'delete-window #'+popup--delete-window)
|
||||||
|
@ -617,94 +612,3 @@ This advice ensures backwards compatibility for Emacs <= 26 users."
|
||||||
(when (and (windowp window) display-buffer-mark-dedicated)
|
(when (and (windowp window) display-buffer-mark-dedicated)
|
||||||
(set-window-dedicated-p window display-buffer-mark-dedicated))
|
(set-window-dedicated-p window display-buffer-mark-dedicated))
|
||||||
window))
|
window))
|
||||||
|
|
||||||
;; DEPRECATED
|
|
||||||
(unless EMACS26+
|
|
||||||
(defvar window-sides-reversed nil)
|
|
||||||
|
|
||||||
(defun window--sides-reverse-on-frame-p (frame)
|
|
||||||
"Return non-nil when side windows should appear reversed on FRAME.
|
|
||||||
This uses some heuristics to guess the user's intentions when the
|
|
||||||
selected window of FRAME is a side window ."
|
|
||||||
(cond
|
|
||||||
;; Reverse when `window-sides-reversed' is t. Do not reverse when
|
|
||||||
;; `window-sides-reversed' is nil.
|
|
||||||
((memq window-sides-reversed '(nil t))
|
|
||||||
window-sides-reversed)
|
|
||||||
;; Reverse when FRAME's selected window shows a right-to-left buffer.
|
|
||||||
((let ((window (frame-selected-window frame)))
|
|
||||||
(when (and (not (window-parameter window 'window-side))
|
|
||||||
(or (not (window-minibuffer-p window))
|
|
||||||
(setq window (minibuffer-selected-window))))
|
|
||||||
(with-current-buffer (window-buffer window)
|
|
||||||
(eq bidi-paragraph-direction 'right-to-left)))))
|
|
||||||
;; Reverse when FRAME's `window-sides-main-selected-window' parameter
|
|
||||||
;; specifies a live window showing a right-to-left buffer.
|
|
||||||
((let ((window (frame-parameter
|
|
||||||
frame 'window-sides-main-selected-window)))
|
|
||||||
(when (window-live-p window)
|
|
||||||
(with-current-buffer (window-buffer window)
|
|
||||||
(eq bidi-paragraph-direction 'right-to-left)))))
|
|
||||||
;; Reverse when all windows in FRAME's main window show right-to-left
|
|
||||||
;; buffers.
|
|
||||||
(t
|
|
||||||
(catch 'found
|
|
||||||
(walk-window-subtree
|
|
||||||
(lambda (window)
|
|
||||||
(with-current-buffer (window-buffer window)
|
|
||||||
(when (eq bidi-paragraph-direction 'left-to-right)
|
|
||||||
(throw 'found nil))))
|
|
||||||
(window-main-window frame))
|
|
||||||
t))))
|
|
||||||
|
|
||||||
(defun window--make-major-side-window (buffer side slot &optional alist)
|
|
||||||
"Display BUFFER in a new major side window on the selected frame.
|
|
||||||
SIDE must be one of `left', `top', `right' or `bottom'. SLOT
|
|
||||||
specifies the slot to use. ALIST is an association list of
|
|
||||||
symbols and values as passed to `display-buffer-in-side-window'.
|
|
||||||
Return the new window, nil if its creation failed.
|
|
||||||
|
|
||||||
This is an auxiliary function of `display-buffer-in-side-window'
|
|
||||||
and may be called only if no window on SIDE exists yet."
|
|
||||||
(let* ((left-or-right (memq side '(left right)))
|
|
||||||
(next-to (window--make-major-side-window-next-to side))
|
|
||||||
(on-side (cond
|
|
||||||
((eq side 'top) 'above)
|
|
||||||
((eq side 'bottom) 'below)
|
|
||||||
(t side)))
|
|
||||||
(window--sides-inhibit-check t)
|
|
||||||
;; The following two bindings will tell `split-window' to take
|
|
||||||
;; the space for the new window from the selected frame's main
|
|
||||||
;; window and not make a new parent window unless needed.
|
|
||||||
(window-combination-resize 'side)
|
|
||||||
(window-combination-limit nil)
|
|
||||||
(window (ignore-errors (split-window next-to nil on-side))))
|
|
||||||
(when window
|
|
||||||
;; Initialize `window-side' parameter of new window to SIDE and
|
|
||||||
;; make that parameter persistent.
|
|
||||||
(set-window-parameter window 'window-side side)
|
|
||||||
(add-to-list 'window-persistent-parameters '(window-side . writable))
|
|
||||||
;; Install `window-slot' parameter of new window and make that
|
|
||||||
;; parameter persistent.
|
|
||||||
(set-window-parameter window 'window-slot slot)
|
|
||||||
(add-to-list 'window-persistent-parameters '(window-slot . writable))
|
|
||||||
;; Auto-adjust height/width of new window unless a size has been
|
|
||||||
;; explicitly requested.
|
|
||||||
(unless (if left-or-right
|
|
||||||
(cdr (assq 'window-width alist))
|
|
||||||
(cdr (assq 'window-height alist)))
|
|
||||||
(setq alist
|
|
||||||
(cons
|
|
||||||
(cons
|
|
||||||
(if left-or-right 'window-width 'window-height)
|
|
||||||
(/ (window-total-size (frame-root-window) left-or-right)
|
|
||||||
;; By default use a fourth of the size of the frame's
|
|
||||||
;; root window.
|
|
||||||
4))
|
|
||||||
alist)))
|
|
||||||
(with-current-buffer buffer
|
|
||||||
(setq window--sides-shown t))
|
|
||||||
;; Install BUFFER in new window and return WINDOW.
|
|
||||||
(window--display-buffer buffer window 'window alist 'side))))
|
|
||||||
|
|
||||||
(advice-add #'window--sides-check :override #'ignore))
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ Modifying this has no effect, unless done before ui/popup loads.")
|
||||||
"Size of the margins to give popup windows. Set this to nil to disable margin
|
"Size of the margins to give popup windows. Set this to nil to disable margin
|
||||||
adjustment.")
|
adjustment.")
|
||||||
|
|
||||||
(defvar +popup--populate-wparams (not EMACS26+))
|
|
||||||
(defvar +popup--inhibit-transient nil)
|
(defvar +popup--inhibit-transient nil)
|
||||||
(defvar +popup--inhibit-select nil)
|
(defvar +popup--inhibit-select nil)
|
||||||
(defvar +popup--old-display-buffer-alist nil)
|
(defvar +popup--old-display-buffer-alist nil)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue