From 99cd52e70fac33b46c7ef3ab868ef4ccf19ba4ce Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 7 Nov 2019 12:49:30 -0500 Subject: [PATCH] :boom: Drop Emacs 25.x support Emacs 26.1 is Doom's new minimum supported version Closes #2026 --- .github/workflows/test.yml | 2 +- README.md | 2 +- core/autoload/line-numbers.el | 92 ------------------------ core/autoload/projects.el | 3 +- core/autoload/ui.el | 11 +-- core/core-lib.el | 35 ---------- core/core-ui.el | 73 -------------------- core/core.el | 5 +- core/packages.el | 6 -- modules/completion/company/config.el | 2 +- modules/completion/company/packages.el | 2 +- modules/completion/helm/config.el | 2 +- modules/completion/helm/packages.el | 2 +- modules/completion/ivy/config.el | 2 +- modules/completion/ivy/doctor.el | 2 - modules/completion/ivy/packages.el | 2 +- modules/editor/evil/+everywhere.el | 2 +- modules/emacs/ibuffer/config.el | 2 +- modules/emacs/vc/config.el | 11 --- modules/lang/data/packages.el | 7 +- modules/lang/rust/config.el | 77 ++++++--------------- modules/lang/rust/packages.el | 4 +- modules/lang/web/+css.el | 6 -- modules/lang/web/+html.el | 7 +- modules/lang/web/packages.el | 2 +- modules/tools/flycheck/config.el | 1 - modules/tools/flycheck/packages.el | 2 +- modules/tools/lsp/config.el | 3 +- modules/tools/pass/config.el | 2 +- modules/ui/doom/config.el | 4 +- modules/ui/modeline/autoload.el | 4 +- modules/ui/popup/autoload/popup.el | 96 -------------------------- modules/ui/popup/config.el | 1 - 33 files changed, 48 insertions(+), 426 deletions(-) delete mode 100644 core/autoload/line-numbers.el diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d04c1f39..65dbb2818 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,8 +16,8 @@ jobs: strategy: matrix: emacs_version: - - 25.3 - 26.1 + - 26.3 - snapshot include: - emacs_version: 26.3 diff --git a/README.md b/README.md index 7645d96e9..4ad52f31c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Made with Doom Emacs - Made for Emacs 25.3+ + Made for Emacs 26.1+ Build status: develop diff --git a/core/autoload/line-numbers.el b/core/autoload/line-numbers.el deleted file mode 100644 index df144180a..000000000 --- a/core/autoload/line-numbers.el +++ /dev/null @@ -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) diff --git a/core/autoload/projects.el b/core/autoload/projects.el index 364941ab5..6decf3501 100644 --- a/core/autoload/projects.el +++ b/core/autoload/projects.el @@ -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)) diff --git a/core/autoload/ui.el b/core/autoload/ui.el index f5a8ba544..7a0b8a447 100644 --- a/core/autoload/ui.el +++ b/core/autoload/ui.el @@ -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") diff --git a/core/core-lib.el b/core/core-lib.el index f605a626c..caed77b53 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -3,41 +3,6 @@ (require 'cl-lib) (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 diff --git a/core/core-ui.el b/core/core-ui.el index eb82cb3e5..620feb24b 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -512,79 +512,6 @@ treat Emacs as a non-application window." (defun doom-enable-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 diff --git a/core/core.el b/core/core.el index 5321799fd..81762e1ed 100644 --- a/core/core.el +++ b/core/core.el @@ -1,13 +1,12 @@ ;;; core.el --- the heart of the beast -*- lexical-binding: t; -*- -(when (version< emacs-version "25.3") - (error "Detected Emacs %s. Doom only supports Emacs 25.3 and higher" +(when (version< emacs-version "26.1") + (error "Detected Emacs %s. Doom only supports Emacs 26.1 and higher" emacs-version)) (defconst doom-version "2.0.9" "Current version of Doom Emacs.") -(defconst EMACS26+ (> emacs-major-version 25)) (defconst EMACS27+ (> emacs-major-version 26)) (defconst IS-MAC (eq system-type 'darwin)) (defconst IS-LINUX (eq system-type 'gnu/linux)) diff --git a/core/packages.el b/core/packages.el index 84504da62..ff2ee9115 100644 --- a/core/packages.el +++ b/core/packages.el @@ -9,12 +9,6 @@ (package! all-the-icons) (package! hide-mode-line) (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! restart-emacs) diff --git a/modules/completion/company/config.el b/modules/completion/company/config.el index ef84516a1..a98bcca9c 100644 --- a/modules/completion/company/config.el +++ b/modules/completion/company/config.el @@ -62,7 +62,7 @@ (use-package! company-box - :when (and EMACS26+ (featurep! +childframe)) + :when (featurep! +childframe) :hook (company-mode . company-box-mode) :config (setq company-box-show-single-candidate t diff --git a/modules/completion/company/packages.el b/modules/completion/company/packages.el index 1e2b7a64b..91b9e88a7 100644 --- a/modules/completion/company/packages.el +++ b/modules/completion/company/packages.el @@ -4,5 +4,5 @@ (package! company) (package! company-dict) (package! company-prescient) -(when (and EMACS26+ (featurep! +childframe)) +(when (featurep! +childframe) (package! company-box)) diff --git a/modules/completion/helm/config.el b/modules/completion/helm/config.el index b559b34d7..1753c416f 100644 --- a/modules/completion/helm/config.el +++ b/modules/completion/helm/config.el @@ -82,7 +82,7 @@ be negative.") (setq helm-default-prompt-display-function #'+helm--set-prompt-display)) :init - (when (and EMACS26+ (featurep! +childframe)) + (when (featurep! +childframe) (setq helm-display-function #'+helm-posframe-display-fn)) (let ((fuzzy (featurep! +fuzzy))) diff --git a/modules/completion/helm/packages.el b/modules/completion/helm/packages.el index 870759b66..eb343b566 100644 --- a/modules/completion/helm/packages.el +++ b/modules/completion/helm/packages.el @@ -10,7 +10,7 @@ (package! swiper-helm) (when (featurep! +fuzzy) (package! helm-flx)) -(when (and EMACS26+ (featurep! +childframe)) +(when (featurep! +childframe) (package! posframe)) (when (featurep! :lang org) (package! helm-org)) diff --git a/modules/completion/ivy/config.el b/modules/completion/ivy/config.el index 17ad1c5a6..f12ddf55d 100644 --- a/modules/completion/ivy/config.el +++ b/modules/completion/ivy/config.el @@ -324,7 +324,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex." (use-package! ivy-posframe - :when (and EMACS26+ (featurep! +childframe)) + :when (featurep! +childframe) :hook (ivy-mode . ivy-posframe-mode) :config (setq ivy-fixed-height-minibuffer nil diff --git a/modules/completion/ivy/doctor.el b/modules/completion/ivy/doctor.el index d730f1552..a79d37c56 100644 --- a/modules/completion/ivy/doctor.el +++ b/modules/completion/ivy/doctor.el @@ -1,5 +1,3 @@ ;; -*- lexical-binding: t; no-byte-compile: t; -*- ;;; completion/ivy/doctor.el -(when (and (not EMACS26+) (featurep! +childframe)) - (error! "The +childframe feature requires Emacs 26+")) diff --git a/modules/completion/ivy/packages.el b/modules/completion/ivy/packages.el index e804e9ead..5571641fd 100644 --- a/modules/completion/ivy/packages.el +++ b/modules/completion/ivy/packages.el @@ -15,7 +15,7 @@ (when (featurep! +fuzzy) (package! flx))) -(when (and EMACS26+ (featurep! +childframe)) +(when (featurep! +childframe) (package! ivy-posframe)) (when (featurep! +icons) diff --git a/modules/editor/evil/+everywhere.el b/modules/editor/evil/+everywhere.el index ea8ba4ddc..c5e1312eb 100644 --- a/modules/editor/evil/+everywhere.el +++ b/modules/editor/evil/+everywhere.el @@ -220,7 +220,7 @@ and complains if a module is loaded too early (during startup)." (add-transient-hook! 'emacs-lisp-mode (+evil-collection-init 'elisp-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 "q" #'kill-current-buffer diff --git a/modules/emacs/ibuffer/config.el b/modules/emacs/ibuffer/config.el index e928358d7..72755c9d3 100644 --- a/modules/emacs/ibuffer/config.el +++ b/modules/emacs/ibuffer/config.el @@ -6,7 +6,7 @@ (setq ibuffer-show-empty-filter-groups nil ibuffer-filter-group-name-face '(:inherit (success bold)) ibuffer-formats - `((mark modified read-only ,(if EMACS26+ 'locked "") + `((mark modified read-only locked ,@(if (featurep! +icons) `(;; Here you may adjust by replacing :right with :center ;; or :left According to taste, if you want the icon diff --git a/modules/emacs/vc/config.el b/modules/emacs/vc/config.el index 68cfe853c..a8a595052 100644 --- a/modules/emacs/vc/config.el +++ b/modules/emacs/vc/config.el @@ -66,14 +66,3 @@ otherwise in default state." (when (and (bound-and-true-p evil-mode) (bobp) (eolp)) (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)))) - diff --git a/modules/lang/data/packages.el b/modules/lang/data/packages.el index 8feed097b..9cb3322eb 100644 --- a/modules/lang/data/packages.el +++ b/modules/lang/data/packages.el @@ -7,8 +7,5 @@ (package! yaml-mode) (package! csv-mode) (package! dhall-mode) -(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)) +(package! protobuf-mode + :recipe (:host github :repo "emacsmirror/protobuf-mode" :files (:defaults "*"))) diff --git a/modules/lang/rust/config.el b/modules/lang/rust/config.el index 6bbe39b04..87f8bb602 100644 --- a/modules/lang/rust/config.el +++ b/modules/lang/rust/config.el @@ -7,43 +7,13 @@ ;; ;;; 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 - :when EMACS26+ - :after rust-mode + :mode ("\\.rs$" . rustic-mode) :preface (setq rustic-rls-pkg (if (featurep! +lsp) 'lsp-mode)) :config + (set-docsets! 'rustic-mode "Rust") + (setq rustic-indent-method-chain t rustic-flycheck-setup-mode-line-p nil ;; use :editor format instead @@ -52,38 +22,35 @@ ;; buffers, so we disable it, but only for evil users, because it ;; affects `forward-sexp' and its ilk. See ;; 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) - (defadvice! +rust--dont-install-packages-p (orig-fn &rest args) - :around #'rustic-setup-rls - (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). - ((symbol-function #'package-installed-p) - (lambda (pkg) - (require pkg nil t))) - ;; If lsp/elgot isn't available, it attempts to install lsp-mode - ;; via package.el. Doom manages its own dependencies so we disable - ;; that behavior. - ((symbol-function #'rustic-install-rls-client-p) - (lambda (&rest _) - (message "No RLS server running")))) - (apply orig-fn args)))) + (when (featurep! +lsp) + (add-hook 'rustic-mode-local-vars-hook #'lsp!))) + + +(use-package! racer + :unless (featurep! +lsp) + :hook (rustic-mode . racer-mode) + :config + (set-lookup-handlers! 'rustic-mode + :definition '(racer-find-definition :async t) + :documentation '+rust-racer-lookup-documentation)) ;; ;;; Tools (use-package! cargo - :after rust-mode + :after rustic-mode :config - (defvar +rust-keymap - (if (boundp 'rustic-mode-map) - rustic-mode-map - rust-mode-map)) - (map! :map +rust-keymap + (map! :map rustic-mode-map :localleader (:prefix ("b" . "build") :desc "cargo add" "a" #'cargo-process-add diff --git a/modules/lang/rust/packages.el b/modules/lang/rust/packages.el index 250637459..05fab0577 100644 --- a/modules/lang/rust/packages.el +++ b/modules/lang/rust/packages.el @@ -1,9 +1,7 @@ ;; -*- no-byte-compile: t; -*- ;;; lang/rust/packages.el -(when EMACS26+ - (package! rustic)) -(package! rust-mode) +(package! rustic) (unless (featurep! +lsp) (package! racer)) diff --git a/modules/lang/web/+css.el b/modules/lang/web/+css.el index 1ef7b6d03..7f8162814 100644 --- a/modules/lang/web/+css.el +++ b/modules/lang/web/+css.el @@ -28,12 +28,6 @@ (after! css-mode ;; css-mode hooks apply to scss and less-css modes (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 scss-mode-map "b" #'+css/scss-build diff --git a/modules/lang/web/+html.el b/modules/lang/web/+html.el index 0444fb481..6869b89c0 100644 --- a/modules/lang/web/+html.el +++ b/modules/lang/web/+html.el @@ -41,12 +41,7 @@ (setcdr alist (cl-loop for pair in (cdr alist) unless (string-match-p "^[a-z-]" (cdr pair)) - collect (cons (car pair) - ;; TODO Replace with `string-trim-right' (Emacs 26+) - (let ((string (cdr pair))) - (if (string-match "\\(?:>\\|]\\|}\\)+\\'" string) - (replace-match "" t t string) - string)))))) + collect (cons (car pair) (string-trim-right (cdr pair)))))) (delq! nil web-mode-engines-auto-pairs)) (map! :map web-mode-map diff --git a/modules/lang/web/packages.el b/modules/lang/web/packages.el index 2efb16915..d0933030a 100644 --- a/modules/lang/web/packages.el +++ b/modules/lang/web/packages.el @@ -12,7 +12,7 @@ ;; +css.el (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! stylus-mode) diff --git a/modules/tools/flycheck/config.el b/modules/tools/flycheck/config.el index 1c9fb0f5a..dc77b4790 100644 --- a/modules/tools/flycheck/config.el +++ b/modules/tools/flycheck/config.el @@ -63,7 +63,6 @@ errors.") (use-package! flycheck-posframe - :when EMACS26+ :when (featurep! +childframe) :defer t :init (add-hook 'flycheck-mode-hook #'+flycheck-init-popups-h) diff --git a/modules/tools/flycheck/packages.el b/modules/tools/flycheck/packages.el index e5e2f0885..b9bcdfd82 100644 --- a/modules/tools/flycheck/packages.el +++ b/modules/tools/flycheck/packages.el @@ -3,5 +3,5 @@ (package! flycheck) (package! flycheck-popup-tip) -(when (and EMACS26+ (featurep! +childframe)) +(when (featurep! +childframe) (package! flycheck-posframe)) diff --git a/modules/tools/lsp/config.el b/modules/tools/lsp/config.el index e37dcf8dd..c31591ff9 100644 --- a/modules/tools/lsp/config.el +++ b/modules/tools/lsp/config.el @@ -106,8 +106,7 @@ Also logs the resolved project root, if found." (defun +lsp-init-ui-flycheck-or-flymake-h () "Sets up flymake-mode or flycheck-mode, depending on `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)) ((require 'flycheck nil t) (require 'lsp-ui-flycheck) diff --git a/modules/tools/pass/config.el b/modules/tools/pass/config.el index 59094000b..4017d6f56 100644 --- a/modules/tools/pass/config.el +++ b/modules/tools/pass/config.el @@ -36,5 +36,5 @@ ;; Is built into Emacs 26+ -(when (and EMACS26+ (featurep! +auth)) +(when (featurep! +auth) (auth-source-pass-enable)) diff --git a/modules/ui/doom/config.el b/modules/ui/doom/config.el index 749757728..f95c73a0d 100644 --- a/modules/ui/doom/config.el +++ b/modules/ui/doom/config.el @@ -61,8 +61,8 @@ ;; 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 - ;; after eob. - (when EMACS26+ + ;; after eob. On Emacs 27 this no longer happens. + (unless EMACS27+ (defun +doom--line-range-fn () (cons (line-beginning-position) (cond ((let ((eol (line-end-position))) diff --git a/modules/ui/modeline/autoload.el b/modules/ui/modeline/autoload.el index 514a6d245..7162bd069 100644 --- a/modules/ui/modeline/autoload.el +++ b/modules/ui/modeline/autoload.el @@ -28,9 +28,7 @@ Meant for `doom-change-font-size-hook'." xlfd-regexp-pixelsize-subnum))) (scale (frame-parameter nil 'font-scale))) (setq doom-modeline-height (+ default-height (* scale doom-font-increment)))) - (setq doom-modeline-height default-height)) - ;; already has a variable watcher in Emacs 26+ - (unless EMACS26+ (doom-modeline-refresh-bars)))) + (setq doom-modeline-height default-height)))) ;;;###autoload (defun +modeline-update-env-in-all-windows-h (&rest _) diff --git a/modules/ui/popup/autoload/popup.el b/modules/ui/popup/autoload/popup.el index 24202a760..30159d815 100644 --- a/modules/ui/popup/autoload/popup.el +++ b/modules/ui/popup/autoload/popup.el @@ -139,11 +139,6 @@ default window parameters for popup windows, clears leftover transient timers and enables `+popup-buffer-mode'." (with-selected-window window (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 'split-window #'+popup--split-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) (set-window-dedicated-p window display-buffer-mark-dedicated)) 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)) diff --git a/modules/ui/popup/config.el b/modules/ui/popup/config.el index 3381554ee..f34a49835 100644 --- a/modules/ui/popup/config.el +++ b/modules/ui/popup/config.el @@ -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 adjustment.") -(defvar +popup--populate-wparams (not EMACS26+)) (defvar +popup--inhibit-transient nil) (defvar +popup--inhibit-select nil) (defvar +popup--old-display-buffer-alist nil)