From 0ee89cbb5cad96c458b1f4df1b73e56b3c411006 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 10 Sep 2024 17:04:20 -0400 Subject: [PATCH 01/16] tweak(idris): add popup rules --- modules/lang/idris/config.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/lang/idris/config.el b/modules/lang/idris/config.el index 9864a6ab1..8f8d3bc1b 100644 --- a/modules/lang/idris/config.el +++ b/modules/lang/idris/config.el @@ -4,7 +4,8 @@ (add-hook 'idris-mode-hook #'turn-on-idris-simple-indent) (when (modulep! +lsp) (add-hook 'idris-mode-hook #'lsp! 'append)) - (set-repl-handler! 'idris-mode 'idris-pop-to-repl) + (set-popup-rule! "^\\*idris-\\(notes\\|holes\\|info\\)" :select nil :ttl nil) + (set-repl-handler! 'idris-mode #'idris-pop-to-repl) (set-lookup-handlers! 'idris-mode :documentation #'idris-docs-at-point) (map! :localleader From 75763ae786bc314c9f7865526460c4c2a2f97123 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 10 Sep 2024 17:05:19 -0400 Subject: [PATCH 02/16] feat(idris): add flycheck support --- modules/lang/idris/config.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/lang/idris/config.el b/modules/lang/idris/config.el index 8f8d3bc1b..a897155ef 100644 --- a/modules/lang/idris/config.el +++ b/modules/lang/idris/config.el @@ -19,3 +19,9 @@ "m" #'idris-add-missing "p" #'idris-proof-search "h" #'idris-docs-at-point)) + + +(use-package! flycheck-idris + :when (modulep! :checkers syntax) + :when (not (modulep! :checkers syntax +flymake)) + :after idris-mode) From 08f5eef3ce05dc271c9a260a174993471cdd35d5 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 10 Sep 2024 17:05:29 -0400 Subject: [PATCH 03/16] fix(idris): add ".ibc" to completion-ignored-extensions --- modules/lang/idris/config.el | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/lang/idris/config.el b/modules/lang/idris/config.el index a897155ef..a7e63eee1 100644 --- a/modules/lang/idris/config.el +++ b/modules/lang/idris/config.el @@ -1,6 +1,7 @@ ;;; lang/idris/config.el -*- lexical-binding: t; -*- (after! idris-mode + (add-to-list 'completion-ignored-extensions ".ibc") (add-hook 'idris-mode-hook #'turn-on-idris-simple-indent) (when (modulep! +lsp) (add-hook 'idris-mode-hook #'lsp! 'append)) From e6514cdf4747c9bdd7ecad1418d807326c592b60 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 10 Sep 2024 17:16:29 -0400 Subject: [PATCH 04/16] docs(idris): +lsp and idris2 compatibility Close: #7229 --- modules/lang/idris/README.org | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/modules/lang/idris/README.org b/modules/lang/idris/README.org index 60dae66a8..8c4190621 100644 --- a/modules/lang/idris/README.org +++ b/modules/lang/idris/README.org @@ -10,7 +10,9 @@ This module adds rudimentary [[https://www.idris-lang.org/][Idris]] support to D *This module needs a maintainer.* [[doom-contrib-maintainer:][Become a maintainer?]] ** Module flags -/This module has no flags./ +- +lsp :: + Enable LSP support for ~idris-mode~. Requires [[doom-module::tools lsp]] and + [[https://github.com/idris-community/idris2-lsp][idris2-lsp]]. ** Packages - [[doom-package:idris-mode]] @@ -25,23 +27,38 @@ This module adds rudimentary [[https://www.idris-lang.org/][Idris]] support to D * TODO Installation [[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]] +For [[doom-module:+lsp]], [[https://github.com/idris-community/idris2-lsp][idris2-lsp]] is required. + #+begin_quote - 󱌣 /No installation steps have been documented./ [[doom-contrib-module:][Document them?]] +󱌣 /No installation steps have been documented./ [[doom-contrib-module:][Document them?]] #+end_quote * TODO Usage #+begin_quote - 󱌣 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]] +󱌣 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]] #+end_quote -In addition to ~idris-mode~ goodness, adds frequently used functions under the -[[kbd:][]] key. +In addition to ~idris-mode~ goodness, this module adds frequently used functions +under the [[kbd:][]] key. * TODO Configuration #+begin_quote - 󱌣 This module has no configuration documentation yet. [[doom-contrib-module:][Write some?]] + 󱌣 /This module's configuration documentation is incomplete./ [[doom-contrib-module:][Complete it?]] #+end_quote +** Support for Idris 2 +While [[doom-package:idris-mode]] was designed for v1 of the IDE-Protocol of Idris, +it tries to maintain compatibility with v2. However, not all the features have +been realized, so expect a little jank. + +To get this working, simply set [[var:idris-interpreter-path]] to the path of the +=idris2= executable. E.g. +#+begin_src emacs-lisp +;;; add to $DOODMIR/config.el +(after! idris-mode + (setq idris-interpreter-path "idris2")) +#+end_src + * Troubleshooting /There are no known problems with this module./ [[doom-report:][Report one?]] @@ -50,5 +67,5 @@ In addition to ~idris-mode~ goodness, adds frequently used functions under the * TODO Appendix #+begin_quote - 󱌣 This module has no appendix yet. [[doom-contrib-module:][Write one?]] +󱌣 This module has no appendix yet. [[doom-contrib-module:][Write one?]] #+end_quote From 86b7bef5127c48e94df1c4f515f517383913d368 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 10 Sep 2024 17:20:16 -0400 Subject: [PATCH 05/16] fix: type error if default returns nil :foreground/:background Ref: #8059 --- lisp/doom-ui.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/doom-ui.el b/lisp/doom-ui.el index 1d0e5978c..09cd845d2 100644 --- a/lisp/doom-ui.el +++ b/lisp/doom-ui.el @@ -590,8 +590,10 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original (put 'doom-theme 'previous-themes (or last-themes 'none)) ;; DEPRECATED Hook into `enable-theme-functions' when we target 29 (doom-run-hooks 'doom-load-theme-hook) - (setf (alist-get 'foreground-color default-frame-alist) (face-foreground 'default nil t) - (alist-get 'background-color default-frame-alist) (face-background 'default nil t))))))) + (when-let* ((fg (face-foreground 'default nil t)) + (bg (face-background 'default nil t))) + (setf (alist-get 'foreground-color default-frame-alist) fg + (alist-get 'background-color default-frame-alist) bg))))))) ;; From 60083a2626dc5f5e91c39d85b65259d838e06a69 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 10 Sep 2024 17:26:54 -0400 Subject: [PATCH 06/16] fix(lib): doom/sandbox Fixes all the launch paths *except* for `vanilla-doom+` (Doom core + modules - private config), which needs some work from v3 to properly fix. --- lisp/lib/debug.el | 6 +++-- lisp/lib/sandbox.el | 61 +++++++++++++++++++-------------------------- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/lisp/lib/debug.el b/lisp/lib/debug.el index 792acb758..3022f7a32 100644 --- a/lisp/lib/debug.el +++ b/lisp/lib/debug.el @@ -198,13 +198,15 @@ Activate this advice with: -q or -Q, for example: emacs -Q -l init.el -f doom-run-all-startup-hooks-h" - (setq after-init-time (current-time)) + (setq after-init-time (current-time) + doom-init-time (current-time)) (let ((inhibit-startup-hooks nil)) (doom-run-hooks 'after-init-hook 'delayed-warnings-hook 'emacs-startup-hook 'tty-setup-hook - 'window-setup-hook))) + 'window-setup-hook + 'doom-after-init-hook))) ;; diff --git a/lisp/lib/sandbox.el b/lisp/lib/sandbox.el index e55f87920..0c37c8cd0 100644 --- a/lisp/lib/sandbox.el +++ b/lisp/lib/sandbox.el @@ -64,10 +64,9 @@ doom-emacs-dir ,doom-emacs-dir doom-cache-dir ,(expand-file-name "cache/" doom-sandbox-dir) doom-data-dir ,(expand-file-name "data/" doom-sandbox-dir)) - (defun doom--write-to-etc-dir-a (fn &rest args) + (define-advice locate-user-emacs-file (:around (fn &rest args) restrict-to-data-dir) (let ((user-emacs-directory doom-data-dir)) (apply fn args))) - (advice-add #'locate-user-emacs-file :around #'doom--write-to-etc-dir-a) ;; emacs essential variables (setq before-init-time (current-time) after-init-time nil @@ -81,11 +80,8 @@ (setq package--init-file-ensured t package-user-dir ,package-user-dir package-archives ',package-archives) - ;; (add-hook 'kill-emacs-hook - ;; (lambda () - ;; (delete-file user-init-file) - ;; (when (file-equal-p user-emacs-directory ,doom-sandbox-dir) - ;; (delete-directory user-emacs-directory 'recursive)))) + (with-eval-after-load 'doom + (run-hooks 'doom-before-init-hook)) (with-eval-after-load 'undo-tree ;; HACK `undo-tree' sometimes throws errors because ;; `buffer-undo-tree' isn't correctly initialized. @@ -93,15 +89,13 @@ ;; Then launch as much about Emacs as we can (defun --run-- () ,forms) ,(pcase mode - (`doom - '(--run--)) (`vanilla-doom+ ; Doom core + modules - private config + (user-error "Not supported yet!") `(progn - (load-file ,(expand-file-name "doom.el" doom-core-dir)) - (setq doom-modules-dirs (list doom-modules-dir)) - (let ((doom-init-modules-p t)) - (doom-initialize) - (doom-initialize-core-modules)) + (require 'doom ,(expand-file-name "doom.el" doom-core-dir)) + (let ((doom-module-init-file "__does-not-exist__")) + (require 'doom-start)) + (setq doom-module-load-path (list doom-modules-dir)) (setq doom-modules ',doom-modules) (maphash (lambda (key plist) (doom-module-put @@ -116,32 +110,29 @@ (maphash (doom-module-loader doom-module-config-file) doom-modules) (doom-run-hooks 'doom-after-modules-config-hook))) (`vanilla-doom ; only Doom core - `(progn - (load-file ,(expand-file-name "doom.el" doom-core-dir)) - (let ((doom-init-modules-p t)) - (doom-initialize) - (doom-initialize-core-modules)) + `(let ((doom-user-dir "/tmp/does/not/exist")) + (require 'doom ,(expand-file-name "doom.el" doom-core-dir)) + (let ((doom-module-init-file "__does-not-exist__")) + (require 'doom-start)) + (setq doom-modules (make-hash-table :test 'equal)) (--run--))) (`vanilla ; nothing loaded `(progn - (if (boundp 'comp-deferred-compilation) - ;; REVIEW Remove me after a month - (setq comp-deferred-compilation nil - comp-deferred-compilation-deny-list ',(bound-and-true-p native-comp-async-env-modifier-form) - comp-async-env-modifier-form ',(bound-and-true-p native-comp-async-env-modifier-form) - comp-eln-load-path ',(bound-and-true-p native-comp-eln-load-path)) - (setq native-comp-deferred-compilation nil - native-comp-deferred-compilation-deny-list ',(bound-and-true-p native-comp-async-env-modifier-form) - native-comp-async-env-modifier-form ',(bound-and-true-p native-comp-async-env-modifier-form) - native-comp-eln-load-path ',(bound-and-true-p native-comp-eln-load-path))) + (setq native-comp-deferred-compilation nil + native-comp-deferred-compilation-deny-list ',(bound-and-true-p native-comp-async-env-modifier-form) + native-comp-async-env-modifier-form ',(bound-and-true-p native-comp-async-env-modifier-form) + native-comp-eln-load-path ',(bound-and-true-p native-comp-eln-load-path)) (package-initialize t) (--run--)))) - ;; Then rerun Emacs' startup hooks to simulate a fresh Emacs session, - ;; because they've already fired. - (fset 'doom-run-hook #',(symbol-function #'doom-run-hook)) - (fset 'doom-run-hooks #',(symbol-function #'doom-run-hooks)) - (fset 'doom-run-all-startup-hooks-h #',(symbol-function #'doom-run-all-startup-hooks-h)) - (doom-run-all-startup-hooks-h)))))) + (with-eval-after-load 'doom + ;; Then rerun Emacs' startup hooks to simulate a fresh Emacs session, + ;; because they've already fired. + (fset 'doom-run-hook #',(symbol-function #'doom-run-hook)) + (fset 'doom-run-hooks #',(symbol-function #'doom-run-hooks)) + (fset 'doom-run-all-startup-hooks-h #',(symbol-function #'doom-run-all-startup-hooks-h)) + ;; (doom-run-all-startup-hooks-h) + (unless (default-toplevel-value 'mode-line-format) + (setq-default mode-line-format (get 'mode-line-format 'initial-value))))))))) (fset 'doom--run-vanilla-emacs (cmd! (doom--sandbox-run 'vanilla))) (fset 'doom--run-vanilla-doom (cmd! (doom--sandbox-run 'vanilla-doom))) From a022e55c08a18cfed97c0695da45553f7f73ab82 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 10 Sep 2024 17:52:52 -0400 Subject: [PATCH 07/16] fix(lib): doom/sandbox: vanilla-doom+ target Between this and 60083a2, doom/sandbox is now fully functional (this is a stopgap fix until v3.0). Ref: 60083a2626dc Fix: #5845 Fix: #6505 Fix: #7486 --- lisp/doom-profiles.el | 11 ++- lisp/lib/sandbox.el | 152 +++++++++++++++++++----------------------- 2 files changed, 78 insertions(+), 85 deletions(-) diff --git a/lisp/doom-profiles.el b/lisp/doom-profiles.el index 26ae373d1..08a064006 100644 --- a/lisp/doom-profiles.el +++ b/lisp/doom-profiles.el @@ -405,7 +405,16 @@ Defaults to the profile at `doom-profile-default'." (letf! ((defun module-loader (group name file &optional noerror) (doom-module-context-with (cons group name) `(let ((doom-module-context ,doom-module-context)) - (doom-load ,(abbreviate-file-name (file-name-sans-extension file)))))) + (doom-load + ,(pcase (cons group name) + ('(:core . nil) + `(file-name-concat + doom-core-dir ,(file-name-nondirectory (file-name-sans-extension file)))) + ('(:user . nil) + `(file-name-concat + doom-user-dir ,(file-name-nondirectory (file-name-sans-extension file)))) + (_ (abbreviate-file-name (file-name-sans-extension file)))) + t)))) (defun module-list-loader (modules file &optional noerror) (cl-loop for (cat . mod) in modules if (doom-module-locate-path cat mod file) diff --git a/lisp/lib/sandbox.el b/lisp/lib/sandbox.el index 0c37c8cd0..901405e77 100644 --- a/lisp/lib/sandbox.el +++ b/lisp/lib/sandbox.el @@ -49,90 +49,74 @@ (defun doom--sandbox-run (&optional mode) "TODO" - (doom--sandbox-launch - (unless (eq mode 'doom) '("-Q")) - (let ((forms - (read (format "(progn\n%s\n)" - (buffer-substring-no-properties - (point-min) - (point-max)))))) - (if (eq mode 'doom) - forms - `(progn - ;; doom variables - (setq init-file-debug t - doom-emacs-dir ,doom-emacs-dir - doom-cache-dir ,(expand-file-name "cache/" doom-sandbox-dir) - doom-data-dir ,(expand-file-name "data/" doom-sandbox-dir)) - (define-advice locate-user-emacs-file (:around (fn &rest args) restrict-to-data-dir) - (let ((user-emacs-directory doom-data-dir)) - (apply fn args))) - ;; emacs essential variables - (setq before-init-time (current-time) - after-init-time nil - init-file-debug init-file-debug - noninteractive nil - process-environment (get 'process-environment 'initial-value) - exec-path (get 'exec-path 'initial-value) - load-path ',load-path - user-init-file load-file-name) - ;; package.el - (setq package--init-file-ensured t - package-user-dir ,package-user-dir - package-archives ',package-archives) - (with-eval-after-load 'doom - (run-hooks 'doom-before-init-hook)) - (with-eval-after-load 'undo-tree - ;; HACK `undo-tree' sometimes throws errors because - ;; `buffer-undo-tree' isn't correctly initialized. - (setq-default buffer-undo-tree (make-undo-tree))) - ;; Then launch as much about Emacs as we can - (defun --run-- () ,forms) - ,(pcase mode - (`vanilla-doom+ ; Doom core + modules - private config - (user-error "Not supported yet!") - `(progn - (require 'doom ,(expand-file-name "doom.el" doom-core-dir)) - (let ((doom-module-init-file "__does-not-exist__")) - (require 'doom-start)) - (setq doom-module-load-path (list doom-modules-dir)) - (setq doom-modules ',doom-modules) - (maphash (lambda (key plist) - (doom-module-put - (car key) (cdr key) - :path (doom-module-locate-path (car key) (cdr key)))) - doom-modules) - (--run--) - (doom-run-hooks 'doom-before-modules-init-hook) - (maphash (doom-module-loader doom-module-init-file) doom-modules) - (doom-run-hooks 'doom-after-modules-init-hook) - (doom-run-hooks 'doom-before-modules-config-hook) - (maphash (doom-module-loader doom-module-config-file) doom-modules) - (doom-run-hooks 'doom-after-modules-config-hook))) - (`vanilla-doom ; only Doom core - `(let ((doom-user-dir "/tmp/does/not/exist")) - (require 'doom ,(expand-file-name "doom.el" doom-core-dir)) - (let ((doom-module-init-file "__does-not-exist__")) - (require 'doom-start)) - (setq doom-modules (make-hash-table :test 'equal)) - (--run--))) - (`vanilla ; nothing loaded - `(progn - (setq native-comp-deferred-compilation nil - native-comp-deferred-compilation-deny-list ',(bound-and-true-p native-comp-async-env-modifier-form) - native-comp-async-env-modifier-form ',(bound-and-true-p native-comp-async-env-modifier-form) - native-comp-eln-load-path ',(bound-and-true-p native-comp-eln-load-path)) - (package-initialize t) - (--run--)))) - (with-eval-after-load 'doom - ;; Then rerun Emacs' startup hooks to simulate a fresh Emacs session, - ;; because they've already fired. - (fset 'doom-run-hook #',(symbol-function #'doom-run-hook)) - (fset 'doom-run-hooks #',(symbol-function #'doom-run-hooks)) - (fset 'doom-run-all-startup-hooks-h #',(symbol-function #'doom-run-all-startup-hooks-h)) - ;; (doom-run-all-startup-hooks-h) - (unless (default-toplevel-value 'mode-line-format) - (setq-default mode-line-format (get 'mode-line-format 'initial-value))))))))) + (letenv! (("DOOMDIR" (if (eq mode 'vanilla-doom+) + (expand-file-name "___does_not_exist___" temporary-file-directory) + doom-user-dir))) + (doom--sandbox-launch + (unless (memq mode '(doom vanilla-doom+)) '("-Q")) + (let ((forms + (read (format "(progn\n%s\n)" + (buffer-substring-no-properties + (point-min) + (point-max)))))) + (if (memq mode '(doom vanilla-doom+)) + forms + `(progn + ;; doom variables + (setq init-file-debug t + doom-log-level 2 + doom-emacs-dir ,doom-emacs-dir + doom-cache-dir ,(expand-file-name "cache/" doom-sandbox-dir) + doom-data-dir ,(expand-file-name "data/" doom-sandbox-dir)) + (define-advice locate-user-emacs-file (:around (fn &rest args) restrict-to-data-dir) + (let ((user-emacs-directory doom-data-dir)) + (apply fn args))) + ;; emacs essential variables + (setq before-init-time (current-time) + after-init-time nil + init-file-debug init-file-debug + noninteractive nil + process-environment (get 'process-environment 'initial-value) + exec-path (get 'exec-path 'initial-value) + load-path ',load-path + user-init-file load-file-name) + ;; package.el + (setq package--init-file-ensured t + package-user-dir ,package-user-dir + package-archives ',package-archives) + (with-eval-after-load 'doom + (run-hooks 'doom-before-init-hook)) + (with-eval-after-load 'undo-tree + ;; HACK `undo-tree' sometimes throws errors because + ;; `buffer-undo-tree' isn't correctly initialized. + (setq-default buffer-undo-tree (make-undo-tree))) + ;; Then launch as much about Emacs as we can + (defun --run-- () ,forms) + ,(pcase mode + (`vanilla-doom ; only Doom core + `(let ((doom-user-dir "/tmp/does/not/exist")) + (require 'doom ,(expand-file-name "doom.el" doom-core-dir)) + (let ((doom-module-init-file "__does-not-exist__")) + (require 'doom-start)) + (setq doom-modules (make-hash-table :test 'equal)) + (--run--))) + (`vanilla ; nothing loaded + `(progn + (setq native-comp-deferred-compilation nil + native-comp-deferred-compilation-deny-list ',(bound-and-true-p native-comp-async-env-modifier-form) + native-comp-async-env-modifier-form ',(bound-and-true-p native-comp-async-env-modifier-form) + native-comp-eln-load-path ',(bound-and-true-p native-comp-eln-load-path)) + (package-initialize t) + (--run--)))) + (with-eval-after-load 'doom + ;; Then rerun Emacs' startup hooks to simulate a fresh Emacs session, + ;; because they've already fired. + (fset 'doom-run-hook #',(symbol-function #'doom-run-hook)) + (fset 'doom-run-hooks #',(symbol-function #'doom-run-hooks)) + (fset 'doom-run-all-startup-hooks-h #',(symbol-function #'doom-run-all-startup-hooks-h)) + ;; (doom-run-all-startup-hooks-h) + (unless (default-toplevel-value 'mode-line-format) + (setq-default mode-line-format (get 'mode-line-format 'initial-value)))))))))) (fset 'doom--run-vanilla-emacs (cmd! (doom--sandbox-run 'vanilla))) (fset 'doom--run-vanilla-doom (cmd! (doom--sandbox-run 'vanilla-doom))) From 4790db6448cad4886725f456e920392bf66b18c2 Mon Sep 17 00:00:00 2001 From: Ajai Nelson <22969541+AjaiKN@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:59:15 -0400 Subject: [PATCH 08/16] fix(dired): typo in command name ` o p` is bound to `+dired/dirvish-side-and-follow`, but the command was previously called `+dired/dirvish-side-or-follow` instead. --- modules/emacs/dired/autoload.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/emacs/dired/autoload.el b/modules/emacs/dired/autoload.el index c2009ecbf..4e64d2174 100644 --- a/modules/emacs/dired/autoload.el +++ b/modules/emacs/dired/autoload.el @@ -15,7 +15,7 @@ (dired-git-info-mode 1))) ;;;###autoload -(defun +dired/dirvish-side-or-follow (&optional arg) +(defun +dired/dirvish-side-and-follow (&optional arg) "Open `dirvish-side' then find the currently focused file. If dirvish is already open, remotely jump to the file in Dirvish. From 28d0d4c2e9c72f821a33a55e06ff9c9f6686e00e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 10 Sep 2024 19:36:11 -0400 Subject: [PATCH 09/16] fix(indent-guides): bars on blank lines breaking line motions Ref: jdtsmith/indent-bars#22 --- modules/ui/indent-guides/config.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/ui/indent-guides/config.el b/modules/ui/indent-guides/config.el index 24c3c3733..6f086aca9 100644 --- a/modules/ui/indent-guides/config.el +++ b/modules/ui/indent-guides/config.el @@ -63,6 +63,23 @@ be enabled. If any function returns non-nil, the mode will not be activated." (defun +indent-guides-in-childframe-p () (frame-parameter nil 'parent-frame))) + ;; HACK: The way `indent-bars-display-on-blank-lines' functions, it places + ;; text properties with a display property containing a newline, which + ;; confuses `move-to-column'. This breaks `next-line' and `evil-next-line' + ;; without this advice (See jdtsmith/indent-bars#22). Advising + ;; `line-move-to-column' isn't enough for `move-to-column' calls in various + ;; Evil operators (`evil-delete', `evil-change', etc). + (defadvice! +indent-guides--prevent-passing-newline-a (fn col &rest args) + :around #'move-to-column + (if-let* ((indent-bars-mode) + (indent-bars-display-on-blank-lines) + (nlp (line-end-position)) + (dprop (get-text-property nlp 'display)) + ((seq-contains-p dprop ?\n)) + ((> col (- nlp (point))))) + (goto-char nlp) + (apply fn col args))) + ;; HACK: `indent-bars-mode' interactions with some packages poorly, often ;; flooding whole sections of the buffer with indent guides. This section is ;; dedicated to fixing interop with those packages. From fcf8b0f8a10e4b8435a831dcdf8758d7ede47059 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 10 Sep 2024 20:38:01 -0400 Subject: [PATCH 10/16] fix(mu4e): treat *mu4e-main* as real --- modules/email/mu4e/config.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/email/mu4e/config.el b/modules/email/mu4e/config.el index d679ba26b..9279c0488 100644 --- a/modules/email/mu4e/config.el +++ b/modules/email/mu4e/config.el @@ -24,6 +24,11 @@ (add-to-list 'doom-debug-variables 'mu4e-debug) ;; mu4e now uses `display-buffer-alist' so we need to add some rules of our own (set-popup-rule! "^\\*mu4e-\\(main\\|headers\\)\\*" :ignore t) + (set-popup-rule! "^\\*mu4e-log\\*" :select nil) + + ;; Treat mu4e main menu buffer as real, so it can be switched to or fallen + ;; back to when killing other buffers. + (add-hook 'mu4e-main-mode-hook #'doom-mark-buffer-as-real-h) ;; Ensures backward/forward compatibility for mu4e, which is prone to breaking ;; updates, and also cannot be pinned, because it's bundled with mu (which you From 40d67ab5734d881240fd6ae5db4b1e62af6bb51f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 10 Sep 2024 21:52:51 -0400 Subject: [PATCH 11/16] fix(spell): fail gracefully on missing ispell-program-name Instead of stopping things dead with a hard error, emit a more readable warning, instead. --- modules/checkers/spell/config.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/checkers/spell/config.el b/modules/checkers/spell/config.el index 9af450505..168863f75 100644 --- a/modules/checkers/spell/config.el +++ b/modules/checkers/spell/config.el @@ -62,7 +62,9 @@ (_ (doom-log "Spell checker not found. Either install `aspell', `hunspell' or `enchant'"))) - (ispell-check-version)) + (if (executable-find ispell-program-name) + (ispell-check-version) + (warn "Can't find %s in your $PATH" ispell-program-name))) ;; From 88a396148922a2cb5d1e1a731f741e02aada691a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 10 Sep 2024 23:34:20 -0400 Subject: [PATCH 12/16] fix(company): company-backends not set in some buffers Any buffers opened before company-mode was loaded would not have `company-backends` initialized in them. Fix: #6261 Fix: #6180 Fix: #5896 Fix: #5672 Fix: #2015 --- modules/completion/company/config.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/completion/company/config.el b/modules/completion/company/config.el index 6ca06751f..6a1f05ea9 100644 --- a/modules/completion/company/config.el +++ b/modules/completion/company/config.el @@ -61,8 +61,7 @@ :before #'company-begin-backend (company-abort))) - (add-hook 'after-change-major-mode-hook #'+company-init-backends-h 'append) - + (add-hook 'company-mode-hook #'+company-init-backends-h 'append) ;; NOTE Fix #1335: ensure `company-emulation-alist' is the first item of ;; `emulation-mode-map-alists', thus higher priority than keymaps of From 30988a9720daea55b31e4587e00ca65f5a78e4ad Mon Sep 17 00:00:00 2001 From: Nguyen Thai <39090621+tk-nguyen@users.noreply.github.com> Date: Wed, 11 Sep 2024 11:29:34 +0700 Subject: [PATCH 13/16] fix(lsp): lsp-terraform removal condition Amend: d4357c173a33 Ref: #7713 --- modules/tools/lsp/+lsp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tools/lsp/+lsp.el b/modules/tools/lsp/+lsp.el index ae8ef434a..5961172cc 100644 --- a/modules/tools/lsp/+lsp.el +++ b/modules/tools/lsp/+lsp.el @@ -85,7 +85,7 @@ Can be a list of backends; accepts any value `company-backends' accepts.") :type-definition #'lsp-find-type-definition) ;; HACK: See emacs-lsp/lsp-mode#3577 - (unless (modulep! :lang terraform) + (unless (modulep! :tools terraform) (setq lsp-client-packages (delete 'lsp-terraform lsp-client-packages))) (defadvice! +lsp--respect-user-defined-checkers-a (fn &rest args) From 29c661aa3e10114c8787fa49333d5bb5c5d90934 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 11 Sep 2024 01:46:02 -0400 Subject: [PATCH 14/16] fix(cli): doom: improve shebang portability Amend: 498966179f2e --- bin/doom | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/doom b/bin/doom index 5f64df4cd..f976aa25a 100755 --- a/bin/doom +++ b/bin/doom @@ -1,8 +1,8 @@ #!/usr/bin/env sh :; # -*- mode: emacs-lisp; lexical-binding: t -*- :; case "$EMACS" in *term*) EMACS=emacs ;; *) EMACS="${EMACS:-emacs}" ;; esac -:; [ "$EMACS" = emacs ] && { type emacs >/dev/null 2>&1 || err=1; } -:; [ -n "$err" ] && { echo "Error: failed to run Emacs with command '$EMACS'"; echo; echo "Are you sure Emacs is installed and in your \$PATH?"; exit 1; } >&2 +:; [ "x$EMACS" = xemacs ] && { type emacs >/dev/null 2>&1 || err=1; } +:; [ "x$err" = x ] || { echo "Error: failed to run Emacs with command '$EMACS'"; echo; echo "Are you sure Emacs is installed and in your \$PATH?"; exit 1; } >&2 :; emacs="$EMACS ${DEBUG:+--debug-init} -q --no-site-file --batch" :; export __DOOMPID="${__DOOMPID:-$$}" :; export __DOOMSTEP="${__DOOMSTEP:-0}" @@ -10,7 +10,7 @@ :; export __DOOMGPIPE=${__DOOMGPIPE:-$__DOOMPIPE} :; export __DOOMPIPE=; [ -t 0 ] || __DOOMPIPE="${__DOOMPIPE}0"; [ -t 1 ] || __DOOMPIPE="${__DOOMPIPE}1" :; $emacs --load "$0" -- "$@" || exit=$? -:; [ "${exit:-0}" -eq 254 ] && { export TMPDIR="${TMPDIR:-${TEMP:-`$emacs -Q --eval '(princ (temporary-file-directory))' 2>/dev/null`}}"; sh "${TMPDIR}/doom.${__DOOMPID}.${__DOOMSTEP}.sh" "$0" "$@" && true; exit="$?"; } +:; [ "${exit:-0}" -eq 254 ] && { export TMPDIR="${TMPDIR:-${TMP:-${TEMP:-`$emacs -Q --eval '(princ temporary-file-directory)' 2>/dev/null`}}}"; sh "${TMPDIR}/doom.${__DOOMPID}.${__DOOMSTEP}.sh" "$0" "$@" && true; exit="$?"; } :; exit $exit ;; This magical mess of a shebang is necessary for any script that relies on From 5a4aa916bc0470ce63e57855eb1483e87414a21a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 11 Sep 2024 02:30:29 -0400 Subject: [PATCH 15/16] fix: adding newly created project to known-projects Fix: #7413 --- lisp/doom-projects.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/doom-projects.el b/lisp/doom-projects.el index 3a7739833..70e17c4c4 100644 --- a/lisp/doom-projects.el +++ b/lisp/doom-projects.el @@ -247,7 +247,12 @@ the command instead." (projectile-mode +1) ;; HACK: See bbatsov/projectile@3c92d28c056c (remove-hook 'buffer-list-update-hook #'projectile-track-known-projects-find-file-hook) - (add-hook 'doom-switch-buffer-hook #'projectile-track-known-projects-find-file-hook t))) + (add-hook 'doom-switch-buffer-hook #'projectile-track-known-projects-find-file-hook t) + (add-hook! 'dired-after-readin-hook + (defun doom-project-track-known-project-h () + (when projectile-mode + (setq projectile-project-root-cache (make-hash-table :test 'equal)) + (projectile-track-known-projects-find-file-hook)))))) ;; From 5ad99220b86ae1bf421861dfad24492d768ac4d9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 11 Sep 2024 03:21:05 -0400 Subject: [PATCH 16/16] fix(ligatures): no prettify-symbols-mode w/o +extra Also removes unused variables and functions, and obsoletes `+ligatures-in-modes`, since it is no longer used. Fix: #7440 --- modules/ui/ligatures/config.el | 72 +++++++++------------------------- 1 file changed, 19 insertions(+), 53 deletions(-) diff --git a/modules/ui/ligatures/config.el b/modules/ui/ligatures/config.el index 23389f76b..abed3896e 100644 --- a/modules/ui/ligatures/config.el +++ b/modules/ui/ligatures/config.el @@ -61,6 +61,10 @@ font.") (t)) "A alist of ligatures to enable in specific modes.") +(defvar +ligatures-in-modes nil + "List of major modes where ligatures should be enabled.") +(make-obsolete-variable '+ligatures-in-modes "Use `ligature-ignored-major-modes' instead" "24.10.0") + (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" "24.09.0") @@ -72,15 +76,6 @@ font.") (defvar +ligatures-extra-alist '((t)) "A map of major modes to symbol lists (for `prettify-symbols-alist').") -(defvar +ligatures-in-modes - '(not special-mode comint-mode eshell-mode term-mode vterm-mode Info-mode - elfeed-search-mode elfeed-show-mode) - "List of major modes where ligatures should be enabled. - - If t, enable it everywhere (except `fundamental-mode'). - If the first element is 'not, enable it in any mode besides what is listed. - If nil, don't enable ligatures anywhere.") - (defvar +ligatures-extras-in-modes t "List of major modes where extra ligatures should be enabled. @@ -89,24 +84,10 @@ Extra ligatures are mode-specific substituions, defined in controls where these are enabled. If t, enable it everywhere (except `fundamental-mode'). - If the first element is 'not, enable it in any mode besides what is listed. + If the first element is not, enable it in any mode besides what is listed. If nil, don't enable these extra ligatures anywhere (though it's more efficient to remove the `+extra' flag from the :ui ligatures module instead).") -(defvar +ligatures--init-font-hook nil) - -(defun +ligatures--correct-symbol-bounds (ligature-alist) - "Prepend non-breaking spaces to a ligature. - -This way `compose-region' (called by `prettify-symbols-mode') will use the -correct width of the symbols instead of the width measured by `char-width'." - (let ((len (length (car ligature-alist))) - (acc (list (cdr ligature-alist)))) - (while (> len 1) - (setq acc (cons #X00a0 (cons '(Br . Bl) acc)) - len (1- len))) - (cons (car ligature-alist) acc))) - (defun +ligatures--enable-p (modes) "Return t if ligatures should be enabled in this buffer depending on MODES." (unless (eq major-mode 'fundamental-mode) @@ -115,38 +96,24 @@ correct width of the symbols instead of the width measured by `char-width'." (not (apply #'derived-mode-p (cdr modes))) (apply #'derived-mode-p modes))))) -(defun +ligatures-init-buffer-h () - "Set up ligatures for the current buffer. +(defun +ligatures-init-extra-symbols-h () + "Set up `prettify-symbols-mode' for the current buffer. Extra ligatures are mode-specific substituions, defined in `+ligatures-extra-symbols', assigned with `set-ligatures!', and made possible with `prettify-symbols-mode'. This variable controls where these are enabled. See `+ligatures-extras-in-modes' to control what major modes this function can and cannot run in." - (when after-init-time - (let ((in-mode-p - (+ligatures--enable-p +ligatures-in-modes)) - (in-mode-extras-p - (and (modulep! +extra) - (+ligatures--enable-p +ligatures-extras-in-modes)))) - (when in-mode-p - ;; If ligature-mode has been installed, there's no - ;; need to do anything, we activate global-ligature-mode - ;; later and handle all settings from `set-ligatures!' later. - (unless (fboundp #'ligature-mode-turn-on) - (run-hooks '+ligatures--init-font-hook) - (setq +ligatures--init-font-hook nil))) - (when in-mode-extras-p - (prependq! prettify-symbols-alist - (or (alist-get major-mode +ligatures-extra-alist) - (cl-loop for (mode . symbols) in +ligatures-extra-alist - if (derived-mode-p mode) - return symbols)))) - (when (and (or in-mode-p in-mode-extras-p) - prettify-symbols-alist) - (when prettify-symbols-mode - (prettify-symbols-mode -1)) - (prettify-symbols-mode +1))))) + (when (and after-init-time (+ligatures--enable-p +ligatures-extras-in-modes)) + (prependq! prettify-symbols-alist + (or (alist-get major-mode +ligatures-extra-alist) + (cl-loop for (mode . symbols) in +ligatures-extra-alist + if (derived-mode-p mode) + return symbols))) + (when prettify-symbols-alist + (when prettify-symbols-mode + (prettify-symbols-mode -1)) + (prettify-symbols-mode +1)))) ;; @@ -156,9 +123,8 @@ and cannot run in." ;; When you get to the right edge, it goes back to how it normally prints (setq prettify-symbols-unprettify-at-point 'right-edge) -(add-hook! 'doom-init-ui-hook :append - (defun +ligatures-init-h () - (add-hook 'after-change-major-mode-hook #'+ligatures-init-buffer-h))) +(when (modulep! +extra) + (add-hook 'after-change-major-mode-hook #'+ligatures-init-extra-symbols-h)) (cond ;; The emacs-mac build of Emacs appears to have built-in support for ligatures,