From 80e9263b85c204f63518496ec6cabe09741daccd Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 26 Aug 2024 02:16:03 -0400 Subject: [PATCH 1/9] fix(cli): doom sync: heuristic for total rebuilds Fix: #8024 --- lisp/cli/sync.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/cli/sync.el b/lisp/cli/sync.el index 5d654a0f9..29be2b278 100644 --- a/lisp/cli/sync.el +++ b/lisp/cli/sync.el @@ -73,12 +73,14 @@ OPTIONS: ;; recompiled. This is necessary because Emacs byte-code is not ;; necessarily back/forward compatible across major versions, and many ;; packages bake in hardcoded data at compile-time. - (pcase-let ((`(,old-version . ,old-host) (doom-file-read doom-cli-sync-info-file :by 'read :noerror t)) + (pcase-let ((`(,old-version . ,hash) + (doom-file-read doom-cli-sync-info-file :by 'read :noerror t)) (to-rebuild nil)) (when (and old-version (not (equal old-version emacs-version))) (print! (warn "Emacs version has changed since last sync (from %s to %s)") old-version emacs-version) (setq to-rebuild t)) - (when (and old-host (not (equal old-host (system-name)))) + (when (and (integerp hash) + (not (equal hash (doom-sync--system-hash)))) (print! (warn "Your system has changed since last sync")) (setq to-rebuild t)) (when (and to-rebuild (not rebuild?) (not (doom-cli-context-suppress-prompts-p context))) @@ -101,7 +103,8 @@ OPTIONS: (run-hooks 'doom-after-sync-hook)) (when (or rebuild? (not (file-exists-p doom-cli-sync-info-file))) (with-temp-file doom-cli-sync-info-file - (prin1 (cons emacs-version (system-name)) (current-buffer)))) + (prin1 (cons emacs-version (doom-sync--system-hash)) + (current-buffer)))) t) (remove-hook 'kill-emacs-hook #'doom-sync--abort-warning-h))) @@ -109,6 +112,9 @@ OPTIONS: ;; ;;; Helpers +(defun doom-sync--system-hash () + (sxhash (list doom-local-dir system-type system-configuration-features))) + (defun doom-sync--abort-warning-h () (print! (warn "Script was abruptly aborted, leaving Doom in an incomplete state!")) (print! (item "Run 'doom sync' to repair it."))) From d6f5fed4a4a0fb7a73fa4e6345e66f42df0aa791 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 26 Aug 2024 02:22:53 -0400 Subject: [PATCH 2/9] refactor(vertico): dabbrev-ignored-buffer-regexps: simplify --- modules/completion/corfu/config.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/completion/corfu/config.el b/modules/completion/corfu/config.el index 46be4ad0f..611c3bc82 100644 --- a/modules/completion/corfu/config.el +++ b/modules/completion/corfu/config.el @@ -140,7 +140,7 @@ TAB/S-TAB.") (setq dabbrev-friend-buffer-function #'+dabbrev-friend-buffer-p dabbrev-ignored-buffer-regexps '("\\` " - "\\(TAGS\\|tags\\|ETAGS\\|etags\\|GTAGS\\|GRTAGS\\|GPATH\\)\\(<[0-9]+>\\)?") + "\\(?:\\(?:[EG]?\\|GR\\)TAGS\\|e?tags\\|GPATH\\)\\(<[0-9]+>\\)?") dabbrev-upcase-means-case-search t) (add-to-list 'dabbrev-ignored-buffer-modes 'pdf-view-mode) (add-to-list 'dabbrev-ignored-buffer-modes 'doc-view-mode) From 67a516cf0dbc15bff66359031a724f1d60e5f0c6 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 26 Aug 2024 16:22:32 -0400 Subject: [PATCH 3/9] perf(org): call yas-reload-all on TAB only once In cases where the user has an empty snippets library (or no snippets for the mode at point), the expensive `yas-reload-all` function would be called each time you press tab. Fix: #8025 --- modules/lang/org/autoload/org.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/lang/org/autoload/org.el b/modules/lang/org/autoload/org.el index 2baf97e79..7b8b3b012 100644 --- a/modules/lang/org/autoload/org.el +++ b/modules/lang/org/autoload/org.el @@ -486,7 +486,8 @@ Made for `org-tab-first-hook'." (evil-emacs-state-p)) (or (and (bound-and-true-p yas--tables) (gethash major-mode yas--tables)) - (progn (yas-reload-all) t)) + (with-memoization (get 'yas-reload-all 'reloaded) + (always (yas-reload-all)))) (yas--templates-for-key-at-point)) (yas-expand) t) From 4f5f9d606555de2f645cb9c6e8367d359ff6bfa9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 26 Aug 2024 17:03:04 -0400 Subject: [PATCH 4/9] refactor(evil): remove unused +evil-repeat-keys variable --- modules/editor/evil/config.el | 8 -------- 1 file changed, 8 deletions(-) diff --git a/modules/editor/evil/config.el b/modules/editor/evil/config.el index 5a20a7007..21aa9dd5c 100644 --- a/modules/editor/evil/config.el +++ b/modules/editor/evil/config.el @@ -1,13 +1,5 @@ ;;; editor/evil/config.el -*- lexical-binding: t; -*- -(defvar +evil-repeat-keys (cons ";" ",") - "The keys to use for universal repeating motions. - -This is a cons cell whose CAR is the key for repeating a motion forward, and -whose CDR is for repeating backward. They should both be `kbd'-able strings. - -Set this to `nil' to disable universal-repeating on these keys.") - (defvar +evil-want-o/O-to-continue-comments t "If non-nil, the o/O keys will continue comment lines if the point is on a line with a linewise comment.") From 6077b6f0d8a679ab94baf75a3978c916d68ed978 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 26 Aug 2024 18:07:47 -0400 Subject: [PATCH 5/9] fix: correct version string in obsoletion calls --- lisp/cli/packages.el | 4 ++-- lisp/doom-lib.el | 2 +- lisp/doom-projects.el | 2 +- modules/app/irc/config.el | 4 ++-- modules/ui/ligatures/config.el | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lisp/cli/packages.el b/lisp/cli/packages.el index c1a515fbe..06762e544 100644 --- a/lisp/cli/packages.el +++ b/lisp/cli/packages.el @@ -13,9 +13,9 @@ ;; ;;; Commands -(defcli-obsolete! ((build b)) (sync "--rebuild") "v3.0.0") +(defcli-obsolete! ((build b)) (sync "--rebuild") "3.0.0") -(defcli-obsolete! ((purge p)) (gc) "v3.0.0") +(defcli-obsolete! ((purge p)) (gc) "3.0.0") ;; TODO Rename to "doom gc" and move to its own file (defcli! (gc) diff --git a/lisp/doom-lib.el b/lisp/doom-lib.el index 587e13e00..52db88af7 100644 --- a/lisp/doom-lib.el +++ b/lisp/doom-lib.el @@ -89,7 +89,7 @@ list is returned as-is." ;; ;;; Public library -(define-obsolete-function-alias 'doom-enlist 'ensure-list "v3.0.0") +(define-obsolete-function-alias 'doom-enlist 'ensure-list "3.0.0") (defun doom-unquote (exp) "Return EXP unquoted." diff --git a/lisp/doom-projects.el b/lisp/doom-projects.el index b3d608551..aa1d22987 100644 --- a/lisp/doom-projects.el +++ b/lisp/doom-projects.el @@ -12,7 +12,7 @@ Emacs.") (defvar doom-projectile-cache-purge-non-projects nil "If non-nil, non-projects are purged from the cache on `kill-emacs-hook'.") -(define-obsolete-variable-alias 'doom-projectile-fd-binary 'doom-fd-executable "v3.0.0") +(define-obsolete-variable-alias 'doom-projectile-fd-binary 'doom-fd-executable "3.0.0") (defvar doom-fd-executable (cl-find-if #'executable-find (list "fdfind" "fd")) "The filename of the fd executable. diff --git a/modules/app/irc/config.el b/modules/app/irc/config.el index cc953f02c..d94ae3b37 100644 --- a/modules/app/irc/config.el +++ b/modules/app/irc/config.el @@ -31,8 +31,8 @@ playback.") (format (format "%%%ds | %%s" +irc-left-padding) (concat "*** " left) right)) -(define-obsolete-variable-alias '+irc-notifications-watch-strings 'circe-notifications-watch-strings "v3.0.0") -(define-obsolete-variable-alias '+irc-time-stamp-format 'lui-time-stamp-format "v3.0.0") +(define-obsolete-variable-alias '+irc-notifications-watch-strings 'circe-notifications-watch-strings "3.0.0") +(define-obsolete-variable-alias '+irc-time-stamp-format 'lui-time-stamp-format "3.0.0") ;; diff --git a/modules/ui/ligatures/config.el b/modules/ui/ligatures/config.el index 61cce4823..097c9ccde 100644 --- a/modules/ui/ligatures/config.el +++ b/modules/ui/ligatures/config.el @@ -63,11 +63,11 @@ font.") (defvar +ligatures-prog-mode-list nil "A list of ligatures to enable in all `prog-mode' buffers.") -(make-obsolete-variable '+ligatures-prog-mode-list "Use `+ligatures-alist' instead" "v3.0.0") +(make-obsolete-variable '+ligatures-prog-mode-list "Use `+ligatures-alist' instead" "3.0.0") (defvar +ligatures-all-modes-list nil "A list of ligatures to enable in all buffers.") -(make-obsolete-variable '+ligatures-all-modes-list "Use `+ligatures-alist' instead" "v3.0.0") +(make-obsolete-variable '+ligatures-all-modes-list "Use `+ligatures-alist' instead" "3.0.0") (defvar +ligatures-extra-alist '((t)) "A map of major modes to symbol lists (for `prettify-symbols-alist').") From 9a6bcc31f96308bc1659d90e6b7f4fcf7b1e3138 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 26 Aug 2024 19:35:53 -0400 Subject: [PATCH 6/9] feat(fold): add +fold-ellipsis var Bring *some* consistency to the text display when text is ellided/folded. Close: #7743 Co-authored-by: seanfarley --- modules/editor/fold/autoload/hideshow.el | 3 ++- modules/editor/fold/config.el | 22 ++++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/modules/editor/fold/autoload/hideshow.el b/modules/editor/fold/autoload/hideshow.el index a12450670..a95f89535 100644 --- a/modules/editor/fold/autoload/hideshow.el +++ b/modules/editor/fold/autoload/hideshow.el @@ -30,7 +30,8 @@ 'empty-line 'vimish-fold-fringe)))) (overlay-put - ov 'display (propertize " [...] " 'face '+fold-hideshow-folded-face)))) + ov 'display (propertize +fold-ellipsis + 'face '+fold-hideshow-folded-face)))) ;; diff --git a/modules/editor/fold/config.el b/modules/editor/fold/config.el index fc9b196e0..60b50f027 100644 --- a/modules/editor/fold/config.el +++ b/modules/editor/fold/config.el @@ -1,5 +1,17 @@ ;;; editor/fold/config.el -*- lexical-binding: t; -*- +(defcustom +fold-ellipsis " [...] " + "The ellipsis to show for ellided regions (folds). + +`org-ellipsis', `truncate-string-ellipsis', and `ts-fold-replacement' are set to +this." + :type 'string + :group '+fold) + + +;; +;;; Global config + (when (modulep! :editor evil) ;; Add vimish-fold, outline-mode & hideshow support to folding commands (define-key! 'global @@ -18,9 +30,15 @@ "zd" #'vimish-fold-delete "zE" #'vimish-fold-delete-all))) +(after! org + (setq org-ellipsis +fold-ellipsis)) + +(after! mule-util + (setq truncate-string-ellipsis +fold-ellipsis)) + ;; -;; Packages +;;; Packages (use-package! hideshow ; built-in :commands (hs-toggle-hiding @@ -97,5 +115,5 @@ :box nil :inherit font-lock-comment-face :weight light)) - (setq ts-fold-replacement " [...] ") + (setq ts-fold-replacement +fold-ellipsis) (global-ts-fold-mode +1)) From 89f5af81041138e208d0257b4750bfae67dc2920 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 26 Aug 2024 19:36:10 -0400 Subject: [PATCH 7/9] refactor(fold): move +fold-hideshow-folded-face & unstyle +ts-fold-replacement-face It is the theme(s) jurisdiction to impose modify external faces. `custom-set-faces!` should be avoided from within modules, in general. --- modules/editor/fold/autoload/hideshow.el | 5 ----- modules/editor/fold/config.el | 11 +++++------ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/modules/editor/fold/autoload/hideshow.el b/modules/editor/fold/autoload/hideshow.el index a95f89535..1ee7ff62f 100644 --- a/modules/editor/fold/autoload/hideshow.el +++ b/modules/editor/fold/autoload/hideshow.el @@ -1,10 +1,5 @@ ;;; editor/fold/autoload/hideshow.el -*- lexical-binding: t; -*- -(defface +fold-hideshow-folded-face - `((t (:inherit font-lock-comment-face :weight light))) - "Face to hightlight `hideshow' overlays." - :group 'doom-themes) - ;;;###autoload (defun +fold-hideshow-haml-forward-sexp-fn (arg) (haml-forward-sexp arg) diff --git a/modules/editor/fold/config.el b/modules/editor/fold/config.el index 60b50f027..6bae1a36e 100644 --- a/modules/editor/fold/config.el +++ b/modules/editor/fold/config.el @@ -8,6 +8,11 @@ this." :type 'string :group '+fold) +(defface +fold-hideshow-folded-face + `((t (:inherit font-lock-comment-face :weight light))) + "Face to hightlight `hideshow' overlays." + :group 'doom-themes) + ;; ;;; Global config @@ -109,11 +114,5 @@ this." :when (modulep! :tools tree-sitter) :after tree-sitter :config - ;; we want to use our own face so we nullify this one to have no effect and - ;; make it more similar to hideshows - (custom-set-faces! '(ts-fold-replacement-face :foreground unspecified - :box nil - :inherit font-lock-comment-face - :weight light)) (setq ts-fold-replacement +fold-ellipsis) (global-ts-fold-mode +1)) From 1430e9c70053e604cf05e73b8eb2822d0ab14b20 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 27 Aug 2024 03:12:13 -0400 Subject: [PATCH 8/9] fix(rust): ensure order of modes in auto-mode-alist Depending on install order, the rust-mode might get precedence, causing rustic to not be loaded on *.rs files. --- modules/lang/rust/config.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/lang/rust/config.el b/modules/lang/rust/config.el index 097649733..5d07f11a8 100644 --- a/modules/lang/rust/config.el +++ b/modules/lang/rust/config.el @@ -9,8 +9,15 @@ ;;; Packages (use-package! rustic + :mode ("\\.rs\\'" . rust-mode) :mode ("\\.rs\\'" . rustic-mode) :preface + ;; HACK: `rust-mode' and `rustic' add entries to `auto-mode-alist', but + ;; package load order makes which gets precedence unpredictable. By removing + ;; them early, we rely on the `:mode' directives above to re-insert them + ;; with the correct order. + (setq auto-mode-alist (assoc-delete-all "\\.rs\\'" auto-mode-alist)) + ;; HACK `rustic' sets up some things too early. I'd rather disable it and let ;; our respective modules standardize how they're initialized. (setq rustic-lsp-client nil) From a5039c4333aac4d90ae0b4d17f3ff504e26ba4a1 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 27 Aug 2024 03:19:57 -0400 Subject: [PATCH 9/9] fix(lib): doom/{reload,upgrade}: expand path to bin/doom A user's shell config might destructively alter the shell's $PATH (also common on MacOS, which destructively sets $PATH with its system dotfiles for ZSH). This prevents the sub-shell spawned from `doom/reload` and `doom/upgrade` from inheriting emacs' `$PATH`, which Doom adds $EMACSDIR/bin to. Without this entry, these commands would fail to find the Doom script. Fix: #8027 Amend: a8ba8feecb1e --- lisp/lib/config.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/lib/config.el b/lisp/lib/config.el index 0bb70caa7..22f511b22 100644 --- a/lisp/lib/config.el +++ b/lisp/lib/config.el @@ -56,7 +56,7 @@ And jumps to your `doom!' block." (defmacro doom--if-compile (command on-success &optional on-failure) (declare (indent 2)) `(let ((default-directory doom-emacs-dir) - (exec-path (cons doom-bin-dir exec-path))) + (doom-bin (expand-file-name "doom" doom-bin-dir))) ;; Ensure the bin/doom operates with the same environment as this ;; running session. (letenv! (("EMACS" (doom-path invocation-directory invocation-name)) @@ -64,7 +64,7 @@ And jumps to your `doom!' block." ("DOOMDIR" doom-user-dir) ("DOOMLOCALDIR" doom-local-dir) ("DEBUG" (and doom-debug-mode "1"))) - (with-current-buffer (compile ,command t) + (with-current-buffer (compile (format ,command doom-bin) t) (let ((w (get-buffer-window (current-buffer)))) (select-window w) (add-hook @@ -77,7 +77,7 @@ And jumps to your `doom!' block." ,on-failure)) nil 'local)))))) -(defvar doom-reload-command "doom sync -B -e" +(defvar doom-reload-command "%s sync -B -e" "Command that `doom/reload' runs.") ;;;###autoload (defun doom/reload () @@ -141,7 +141,7 @@ imported into Emacs." (doom-load-envvars-file doom-env-file) (message "Reloaded %S" (abbreviate-file-name doom-env-file)))))) -(defvar doom-upgrade-command "doom upgrade -B --force" +(defvar doom-upgrade-command "%s upgrade -B --force" "Command that `doom/upgrade' runs.") ;;;###autoload (defun doom/upgrade ()