From 19482ee5823b426969574a4cc45302b9257efd04 Mon Sep 17 00:00:00 2001 From: Vu Quoc Huy <5112602+vqhuy@users.noreply.github.com> Date: Wed, 24 Jan 2024 18:06:35 +0100 Subject: [PATCH 01/23] feat(latex): allow fill-paragraph in description Ref: #1849 --- modules/lang/latex/config.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/lang/latex/config.el b/modules/lang/latex/config.el index ed8e59fd5..c24273487 100644 --- a/modules/lang/latex/config.el +++ b/modules/lang/latex/config.el @@ -182,19 +182,21 @@ Math faces should stay fixed by the mixed-pitch blacklist, this is mostly for (dolist (env '("itemize" "enumerate" "description")) (add-to-list 'LaTeX-indent-environment-list `(,env +latex-indent-item-fn))) - ;; Fix #1849: allow fill-paragraph in itemize/enumerate. - (defadvice! +latex--re-indent-itemize-and-enumerate-a (fn &rest args) + ;; Fix #1849: allow fill-paragraph in itemize/enumerate/description. + (defadvice! +latex--re-indent-itemize-and-enumerate-and-description-a (fn &rest args) :around #'LaTeX-fill-region-as-para-do (let ((LaTeX-indent-environment-list (append LaTeX-indent-environment-list - '(("itemize" +latex-indent-item-fn) - ("enumerate" +latex-indent-item-fn))))) + '(("itemize" +latex-indent-item-fn) + ("enumerate" +latex-indent-item-fn) + ("description" +latex-indent-item-fn))))) (apply fn args))) - (defadvice! +latex--dont-indent-itemize-and-enumerate-a (fn &rest args) + (defadvice! +latex--dont-indent-itemize-and-enumerate-and-description-a (fn &rest args) :around #'LaTeX-fill-region-as-paragraph (let ((LaTeX-indent-environment-list LaTeX-indent-environment-list)) (delq! "itemize" LaTeX-indent-environment-list 'assoc) (delq! "enumerate" LaTeX-indent-environment-list 'assoc) + (delq! "description" LaTeX-indent-environment-list 'assoc) (apply fn args)))) From 1ee429406bc24055d18ab0dfaee5f29b8fbc301d Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Tue, 9 Jan 2024 23:14:40 +0100 Subject: [PATCH 02/23] fix(org): restart org-mode before indirect buffer Fix: #5714 --- modules/lang/org/config.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 9f614017b..6d162f428 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -852,6 +852,17 @@ can grow up to be fully-fledged org-mode buffers." (add-hook 'doom-switch-buffer-hook #'+org--restart-mode-h nil 'local)))))) + (defadvice! +org--restart-mode-before-indirect-buffer-a (base-buffer &rest _) + "Restart `org-mode' in buffers in which the mode has been deferred (see +`+org-defer-mode-in-agenda-buffers-h') before they become the base buffer for an +indirect buffer. This ensures that the buffer is fully functional not only when +the *user* visits it, but also when some code interacts with it via an indirect +buffer as done, e.g., by `org-capture'." + :before #'make-indirect-buffer + (with-current-buffer base-buffer + (when (memq #'+org--restart-mode-h doom-switch-buffer-hook) + (+org--restart-mode-h)))) + (defvar recentf-exclude) (defadvice! +org--optimize-backgrounded-agenda-buffers-a (fn file) "Prevent temporarily opened agenda buffers from polluting recentf." From 2b54b5732c8b01c70a543db970b32b9a91602deb Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Thu, 21 Dec 2023 17:59:51 +0100 Subject: [PATCH 03/23] docs(lib): improve docs of doom-file-read/-write --- lisp/lib/files.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/lib/files.el b/lisp/lib/files.el index 5e5bfc5c1..2d94f66a6 100644 --- a/lisp/lib/files.el +++ b/lisp/lib/files.el @@ -245,7 +245,8 @@ special values: 'read* -- read all forms in FILE and return it as a list of S-exps. '(read . N) -- read the first N (an integer) S-exps in FILE. -CODING dictates the encoding of the buffer. This defaults to `utf-8'. +CODING dictates the encoding of the buffer. This defaults to `utf-8'. If set to +nil, `binary' is used. If NOERROR is non-nil, don't throw an error if FILE doesn't exist. This will still throw an error if FILE is unreadable, however. @@ -305,7 +306,7 @@ MODE dictates the permissions of the file. If FILE already exists, its permissions will be changed. CODING dictates the encoding to read/write with (see `coding-system-for-write'). -If set to nil, `binary' is used. +This defaults to `utf-8'. If set to nil, `binary' is used. APPEND dictates where CONTENTS will be written. If neither is set, the file will be overwritten. If both are, the contents will be written to both From efe8d476bcca6c0ef64ee0538c32b1a3f4733c25 Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Thu, 21 Dec 2023 18:03:18 +0100 Subject: [PATCH 04/23] fix(lib): use unibyte in binary temp buffers --- lisp/lib/files.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/lib/files.el b/lisp/lib/files.el index 2d94f66a6..906d9504f 100644 --- a/lisp/lib/files.el +++ b/lisp/lib/files.el @@ -220,7 +220,7 @@ single file or nested compound statement of `and' and `or' statements." (let* ((buffer-file-name (doom-path ,file)) (coding-system-for-read (or ,coding 'binary)) (coding-system-for-write (or coding-system-for-write coding-system-for-read 'binary))) - (unless (eq coding-system-for-read 'binary) + (when (eq coding-system-for-read 'binary) (set-buffer-multibyte nil) (setq-local buffer-file-coding-system 'binary)) ,@body)) From fcf63d615a1cb3837e051f24d76fe2630bf714fd Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Thu, 21 Dec 2023 18:03:55 +0100 Subject: [PATCH 05/23] tweak(lib): write elisp in escaped form to files --- lisp/lib/files.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/lib/files.el b/lisp/lib/files.el index 906d9504f..d850596be 100644 --- a/lisp/lib/files.el +++ b/lisp/lib/files.el @@ -326,7 +326,12 @@ ends. Set either APPEND or PREPEND to `noerror' to silently ignore read errors." ((let ((standard-output (current-buffer)) (print-quoted t) (print-level nil) - (print-length nil)) + (print-length nil) + ;; Escape special chars to avoid any shenanigans + (print-escape-newlines t) + (print-escape-control-characters t) + (print-escape-nonascii t) + (print-escape-multibyte t)) (funcall printfn datum)))))) (let (write-region-annotate-functions write-region-post-annotation-function) From dca4e4a8ed41e0a025d41500297d6fa662d8e22b Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Sun, 24 Dec 2023 02:25:56 +0100 Subject: [PATCH 06/23] fix(popup): find internal major side windows Fix: #5485 --- modules/ui/popup/autoload/popup.el | 13 ++++++++++++- modules/ui/popup/test/test-popup.el | 16 +++++++++------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/modules/ui/popup/autoload/popup.el b/modules/ui/popup/autoload/popup.el index 46bd5e2f0..27880b432 100644 --- a/modules/ui/popup/autoload/popup.el +++ b/modules/ui/popup/autoload/popup.el @@ -505,11 +505,22 @@ Accepts the same arguments as `display-buffer-in-side-window'. You must set ((not (numberp vslot)) (error "Invalid vslot %s specified" vslot))) - (let* ((major (get-window-with-predicate + (let* ((live (get-window-with-predicate (lambda (window) (and (eq (window-parameter window 'window-side) side) (eq (window-parameter window 'window-vslot) vslot))) nil)) + ;; As opposed to the `window-side' property, the `window-vslot' + ;; property is set only on a single live window and never on internal + ;; windows. Moreover, as opposed to `window-with-parameter' (as used + ;; by the original `display-buffer-in-side-window'), + ;; `get-window-with-predicate' only returns live windows anyway. In + ;; any case, we will have missed the major side window and got a + ;; child instead if the major side window happens to be an internal + ;; window. In that case, the major side window is the parent of the + ;; live window. + (major (and live + (if (window-next-sibling live) (window-parent live) live))) (reversed (window--sides-reverse-on-frame-p (selected-frame))) (windows (cond ((window-live-p major) diff --git a/modules/ui/popup/test/test-popup.el b/modules/ui/popup/test/test-popup.el index 945f5a937..569e3ebbc 100644 --- a/modules/ui/popup/test/test-popup.el +++ b/modules/ui/popup/test/test-popup.el @@ -44,14 +44,14 @@ :to-contain '(size . 5))))) (describe "popup rules" - :var (origin a b c d e f g) + :var (origin a b c d e f g h i) (before-all (setq origin (current-buffer))) (before-each - (dolist (name '(a b c d e f g)) + (dolist (name '(a b c d e f g h i)) (set name (get-buffer-create (symbol-name name))))) (after-each (let (kill-buffer-query-functions kill-buffer-hook) - (dolist (x (list a b c d e f g)) + (dolist (x (list a b c d e f g h i)) (ignore-errors (delete-window (get-buffer-window x))) (kill-buffer x)))) @@ -64,11 +64,13 @@ ("d" :slot 2 :vslot 2) ("e" :slot 1 :vslot 3) ("f" :slot 1 :vslot 3) - ("g")))) + ("g" :slot 2 :vslot 3) + ("h" :slot 2 :vslot 3) + ("i")))) (it "replaces popups with the same slots" - (mapc #'display-buffer (list e f)) - (expect (length (+popup-windows)) :to-be 1)) + (mapc #'display-buffer (list e f g h)) + (expect (length (+popup-windows)) :to-be 2)) (it "replaces popups among multiple that have the same slots" (let ((first (display-buffer a)) @@ -92,7 +94,7 @@ (expect (window-in-direction 'right first t) :to-equal second))) (it "obeys default :slot" - (let ((window (display-buffer g))) + (let ((window (display-buffer i))) (expect (window-parameter window 'window-slot) :to-be 1) (expect (window-parameter window 'window-vslot) :to-be 1)))) From 41289cfef6fcf785a0b789d0dd6c8fdeff9acb09 Mon Sep 17 00:00:00 2001 From: Colin Woodbury Date: Sun, 31 Dec 2023 22:57:21 +0900 Subject: [PATCH 07/23] fix(lib): doom/bumpify-diff: respect structure of given list The old check was a bug fix to work around noisy values that somehow made it into diff checks. The `package!` symbol is never actually present in the list of values yielded by the search in `read-package`, so this commit alters the lookup to respect what is actually present, thus guaranteeing that `destructuring-bind` succeeds and bump diffs are actually detected. --- lisp/lib/packages.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/lib/packages.el b/lisp/lib/packages.el index 496091155..0b86a9085 100644 --- a/lisp/lib/packages.el +++ b/lisp/lib/packages.el @@ -239,7 +239,7 @@ Must be run from a magit diff buffer." (unless (= (length before) (length after)) (user-error "Uneven number of packages being bumped")) (dolist (p1 before) - (when (and (listp p1) (eq (car p1) 'package!)) + (when (and (listp p1) (plist-get (cdr p1) :package)) (cl-destructuring-bind (package &key plist _beg _end &allow-other-keys) p1 (let ((p2 (cdr (assq package after)))) (if (null p2) From 68d59f726d1d8b40cb0069b43edfff1fedbd37db Mon Sep 17 00:00:00 2001 From: Vitaly Slobodin Date: Wed, 24 Jan 2024 18:25:30 +0100 Subject: [PATCH 08/23] bump: :term eshell ambrevar/emacs-fish-completion@df42e1530829 -> LemonBreezes/emacs-fish-completion@d34d0b96fde6 The emacs-fish-completion package has changed owners and moved to https://github.com/Ambrevar/emacs-fish-completion. --- modules/term/eshell/packages.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/term/eshell/packages.el b/modules/term/eshell/packages.el index 4bbff9fe5..fc1385f0b 100644 --- a/modules/term/eshell/packages.el +++ b/modules/term/eshell/packages.el @@ -9,5 +9,5 @@ (package! eshell-syntax-highlighting :pin "4ac27eec6595ba116a6151dfaf0b0e0440101e10") (unless IS-WINDOWS - (package! fish-completion :pin "df42e153082927536763bdf408184152a7c938c3") + (package! fish-completion :pin "d34d0b96fde63feedf13c4288183d8d4d4d748cf") (package! bash-completion :pin "f1daac0386c24cbe8a244a62c7588cc6847b07ae")) From 819f3f11ccb8f8185dbeb48afd8988a5f0ba6214 Mon Sep 17 00:00:00 2001 From: Ivan Necas Date: Wed, 3 Jan 2024 22:14:34 +0100 Subject: [PATCH 09/23] bump: :ui doom doomemacs/themes@4aee1f5a0e54 -> doomemacs/themes@ff26f26ea3d7 Improves Emacs 30 compatibility (see ref). Ref: https://github.com/doomemacs/themes/issues/809 --- modules/ui/doom/packages.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ui/doom/packages.el b/modules/ui/doom/packages.el index edbc97da6..15cc260ba 100644 --- a/modules/ui/doom/packages.el +++ b/modules/ui/doom/packages.el @@ -1,5 +1,5 @@ ;; -*- no-byte-compile: t; -*- ;;; ui/doom/packages.el -(package! doom-themes :pin "4aee1f5a0e54552669f747aa7c25e6027e73d76d") +(package! doom-themes :pin "ff26f26ea3d761375f5fc4070438fbd0f3473d33") (package! solaire-mode :pin "8af65fbdc50b25ed3214da949b8a484527c7cc14") From c1516edd66b2cd108f07f1be9ef08db8d9dde2a8 Mon Sep 17 00:00:00 2001 From: Colin Woodbury Date: Sun, 31 Dec 2023 23:07:04 +0900 Subject: [PATCH 10/23] bump: :lang common-lisp joaotavora/sly@f34c22289a2b -> joaotavora/sly@ed17d2c2bd7a --- modules/lang/common-lisp/packages.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lang/common-lisp/packages.el b/modules/lang/common-lisp/packages.el index 47e185dd6..d6b13ff87 100644 --- a/modules/lang/common-lisp/packages.el +++ b/modules/lang/common-lisp/packages.el @@ -1,6 +1,6 @@ ;; -*- no-byte-compile: t; -*- ;;; lang/common-lisp/packages.el -(when (package! sly :pin "f34c22289a2b3ab10e607f9f8822d62bb5c98cf5") +(when (package! sly :pin "ed17d2c2bd7aead0fbb09c3d22861c80a522a097") (package! sly-macrostep :pin "5113e4e926cd752b1d0bcc1508b3ebad5def5fad") (package! sly-repl-ansi-color :pin "b9cd52d1cf927bf7e08582d46ab0bcf1d4fb5048")) From 2853982447926f561d448ac5f1f15ce2bef836dd Mon Sep 17 00:00:00 2001 From: Colin Woodbury Date: Sun, 31 Dec 2023 23:44:29 +0900 Subject: [PATCH 11/23] feat(common-lisp): use `sly-asdf` This allows us to offload system loading and testing to a third-party library. --- .../lang/common-lisp/autoload/common-lisp.el | 45 +------------------ modules/lang/common-lisp/config.el | 9 +++- modules/lang/common-lisp/packages.el | 1 + 3 files changed, 10 insertions(+), 45 deletions(-) diff --git a/modules/lang/common-lisp/autoload/common-lisp.el b/modules/lang/common-lisp/autoload/common-lisp.el index 33cc28ef1..087ae51b2 100644 --- a/modules/lang/common-lisp/autoload/common-lisp.el +++ b/modules/lang/common-lisp/autoload/common-lisp.el @@ -18,50 +18,9 @@ (t (recurse (1+ attempt)))))) (recurse 1)))) -;;;###autoload -(defun +lisp/load-project-systems () - "Load all systems of the current Lisp project into Sly." - (interactive) - (thread-last (+lisp--project-asd-file) - (+lisp--systems-from-asd) - (mapcar (lambda (s) (format ":%s" s))) - (funcall (lambda (ss) (string-join ss " "))) - (format "(ql:quickload '(%s))") - (sly-interactive-eval))) - -(defun +lisp--project-asd-file () - "Yield an absolute file path to the current project's `.asd' file." - (let* ((proot (doom-project-root)) - (files (doom-files-in proot :depth 1 :match "[.]asd$"))) - (pcase files - ('() (error "No .asd file found in: %s" proot)) - (`(,asdf) asdf) - (_ (error "Too many .asd files found in : %s" proot))))) - -(defun +lisp--systems-from-asd (asdf) - "Given a path to an ASDF project definition, extract the names of -the systems defined therein." - (let ((file (doom-file-read asdf)) - (patt "defsystem \"\\([a-z-/]+\\)")) - (when (not (string-match patt file)) - (error "No systems defined in: %s" asdf)) - (thread-last (s-match-strings-all patt file) - (mapcar #'cl-second)))) - -;; TODO Get this to run in a comint buffer? -;;;###autoload -(defun +lisp/test-system () - "Run `asdf:test-system' on the selected system of the current project." - (interactive) - (thread-last (+lisp--project-asd-file) - (+lisp--systems-from-asd) - (completing-read "Test which Lisp system?") - (format "(asdf:test-system :%s)") - (sly-interactive-eval))) - ;;;###autoload (defun +lisp/reload-project () - "Restart the Sly session and reload the current project." + "Restart the Sly session and reload a chosen system." (interactive) (sly-restart-inferior-lisp) (cl-labels ((recurse (attempt) @@ -72,7 +31,7 @@ the systems defined therein." (error "Failed to reload Lisp project in 5 attempts.") (recurse (1+ attempt))))))) (recurse 1) - (+lisp/load-project-systems))) + (sly-asdf-load-system))) ;;;###autoload (defun +lisp/find-file-in-quicklisp () diff --git a/modules/lang/common-lisp/config.el b/modules/lang/common-lisp/config.el index 83a0a3030..3acb60bc5 100644 --- a/modules/lang/common-lisp/config.el +++ b/modules/lang/common-lisp/config.el @@ -141,7 +141,7 @@ :desc "Who sets" "S" #'sly-who-sets) (:prefix ("r" . "repl") :desc "Clear REPL" "c" #'sly-mrepl-clear-repl - :desc "Load Project" "l" #'+lisp/load-project-systems + :desc "Load System" "l" #'sly-asdf-load-system :desc "Quit connection" "q" #'sly-quit-lisp :desc "Restart connection" "r" #'sly-restart-inferior-lisp :desc "Reload Project" "R" #'+lisp/reload-project @@ -154,7 +154,7 @@ :desc "Replay stickers" "r" #'sly-stickers-replay :desc "Add/remove sticker" "s" #'sly-stickers-dwim) (:prefix ("t" . "test") - :desc "Test System" "s" #'+lisp/test-system) + :desc "Test System" "s" #'sly-asdf-test-system) (:prefix ("T" . "trace") :desc "Toggle" "t" #'sly-toggle-trace-fdefinition :desc "Toggle (fancy)" "T" #'sly-toggle-fancy-trace @@ -168,3 +168,8 @@ :defer t :init (add-to-list 'sly-contribs 'sly-repl-ansi-color)) + +(use-package! sly-asdf + :defer t + :init + (add-to-list 'sly-contribs 'sly-asdf 'append)) diff --git a/modules/lang/common-lisp/packages.el b/modules/lang/common-lisp/packages.el index d6b13ff87..0917fe0c4 100644 --- a/modules/lang/common-lisp/packages.el +++ b/modules/lang/common-lisp/packages.el @@ -2,5 +2,6 @@ ;;; lang/common-lisp/packages.el (when (package! sly :pin "ed17d2c2bd7aead0fbb09c3d22861c80a522a097") + (package! sly-asdf :pin "6f9d751469bb82530db1673c22e7437ca6c95f45") (package! sly-macrostep :pin "5113e4e926cd752b1d0bcc1508b3ebad5def5fad") (package! sly-repl-ansi-color :pin "b9cd52d1cf927bf7e08582d46ab0bcf1d4fb5048")) From 56b6169ae739fb67a33746cc5863030b3e4fc6d3 Mon Sep 17 00:00:00 2001 From: John Goff <33040621+John-Goff@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:31:20 -0500 Subject: [PATCH 12/23] fix(default): read correct manpath on MacOS Versions of `man` shipped with the latest MacOS do not support the `--path` argument, which causes `M-x woman` in Emacs to break. However the `manpath` command gives the same information and exists on MacOS and Linux, at least the systems that I tested. Check for its existence, and if there is no `manpath` command then fall back to the logic that existed before. Fix: #7021 --- modules/config/default/config.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/config/default/config.el b/modules/config/default/config.el index f4a301488..14bed119c 100644 --- a/modules/config/default/config.el +++ b/modules/config/default/config.el @@ -59,11 +59,16 @@ (after! woman ;; The woman-manpath default value does not necessarily match man. If we have ;; man available but aren't using it for performance reasons, we can extract - ;; it's manpath. - (when (executable-find "man") - (setq woman-manpath - (split-string (cdr (doom-call-process "man" "--path")) - path-separator t)))) + ;; its manpath. + (let ((manpath (cond + ((executable-find "manpath") + (split-string (cdr (doom-call-process "manpath")) + path-separator t)) + ((executable-find "man") + (split-string (cdr (doom-call-process "man" "--path")) + path-separator t))))) + (when manpath + (setq woman-manpath manpath)))) (use-package! drag-stuff From 8352562b2cff2258075f2349e0695b86fd4e6359 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 5 Dec 2023 17:09:36 -0500 Subject: [PATCH 13/23] fix(lib): appease byte-compiler-sama Silences some byte-compiler warnings about: - 'nreverse on constant list' on add-hook! calls. - inhibit-changing-match-data deprecation warning. - unescaped quotes in docstring in some doom-*-dir variables. - Variable non-essential should be quoted (though it isn't referring to a variable). - CONTEXT -> CONTEXTS to match argument name. --- lisp/doom-lib.el | 2 +- lisp/doom.el | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lisp/doom-lib.el b/lisp/doom-lib.el index 9821e64f2..561eb2070 100644 --- a/lisp/doom-lib.el +++ b/lisp/doom-lib.el @@ -801,7 +801,7 @@ This macro accepts, in order: func-forms))) `(progn ,@defn-forms - (dolist (hook (nreverse ',hook-forms)) + (dolist (hook ',(nreverse hook-forms)) (dolist (func (list ,@func-forms)) ,(if remove-p `(remove-hook hook func ,local-p) diff --git a/lisp/doom.el b/lisp/doom.el index 988a0d795..41f39c7c2 100644 --- a/lisp/doom.el +++ b/lisp/doom.el @@ -116,9 +116,9 @@ (push 'dynamic-modules features)) (if (fboundp #'json-parse-string) (push 'jansson features)) -(let ((inhibit-changing-match-data t)) - (if (string-match "HARFBUZZ" system-configuration-features) ; no alternative - (push 'harfbuzz features))) +(if (string-match-p "HARFBUZZ" system-configuration-features) ; no alternative + (push 'harfbuzz features)) + ;; The `native-compile' feature exists whether or not it is functional (e.g. ;; libgcc is available or not). This seems silly, so pretend it doesn't exist if ;; it isn't functional. @@ -237,7 +237,7 @@ These files should not be shared across systems. By default, it is used by Data files contain shared and long-lived data that Doom, Emacs, and their packages require to function correctly or at all. Deleting them by hand will -cause breakage, and require user intervention (e.g. a 'doom sync' or 'doom env') +cause breakage, and require user intervention (e.g. a `doom sync` or `doom env`) to restore. Use this for: server binaries, package source, pulled module libraries, @@ -254,10 +254,10 @@ For profile-local data files, use `doom-profile-data-dir' instead.") (file-name-concat doom-local-dir "cache/")) "Where Doom stores its global cache files. -Cache files represent non-essential data that shouldn't be problematic when +Cache files represent unessential data that shouldn't be problematic when deleted (besides, perhaps, a one-time performance hit), lack portability (and so shouldn't be copied to other systems/configs), and are regenerated when needed, -without user input (e.g. a 'doom sync'). +without user input (e.g. a `doom sync`). Some examples: images/data caches, elisp bytecode, natively compiled elisp, session files, ELPA archives, authinfo files, org-persist, etc. @@ -273,11 +273,11 @@ For profile-local cache files, use `doom-profile-cache-dir' instead.") (file-name-concat doom-local-dir "state/")) "Where Doom stores its global state files. -State files contain non-essential, unportable, but persistent data which, if -lost won't cause breakage, but may be inconvenient as they cannot be -automatically regenerated or restored. For example, a recently-opened file list -is not essential, but losing it means losing this record, and restoring it -requires revisiting all those files. +State files contain unessential, unportable, but persistent data which, if lost +won't cause breakage, but may be inconvenient as they cannot be automatically +regenerated or restored. For example, a recently-opened file list is not +essential, but losing it means losing this record, and restoring it requires +revisiting all those files. Use this for: history, logs, user-saved data, autosaves/backup files, known projects, recent files, bookmarks. @@ -529,7 +529,7 @@ wasn't active when this was called." (setq doom-context (delq context doom-context)))) (defmacro doom-context-with (contexts &rest body) - "Evaluate BODY with CONTEXT added to `doom-context'." + "Evaluate BODY with CONTEXTS added to `doom-context'." (declare (indent 1)) `(let ((doom-context doom-context)) (dolist (context (ensure-list ,contexts)) From be900213300254d384fd55a77a782a7cfe8f346c Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 5 Dec 2023 17:12:40 -0500 Subject: [PATCH 14/23] fix(cli): ensure local file/dir permissions May catch edge cases where profile directories are created with over-restrictive permissions (mentioned in #5832). Ref: #5832 --- lisp/doom-cli.el | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lisp/doom-cli.el b/lisp/doom-cli.el index 64072373e..674e07e94 100644 --- a/lisp/doom-cli.el +++ b/lisp/doom-cli.el @@ -1050,9 +1050,9 @@ considered as well." "\n"))) (print! (warn "Wrote extended straight log to %s") (path (let ((coding-system-for-write 'utf-8-auto)) - (with-temp-file error-file - (insert-buffer-substring (straight--process-buffer))) - (set-file-modes error-file #o600) + (with-file-modes #o600 + (with-temp-file error-file + (insert-buffer-substring (straight--process-buffer)))) error-file)))) ((eq type 'error) (let* ((generic? (eq (car data) 'error)) @@ -1123,11 +1123,12 @@ See `doom-cli-log-file-format' for details." (let* ((buffer (doom-cli-context-stderr context)) (file (doom-cli--output-file "log" context))) (when (> (buffer-size buffer) 0) - (make-directory (file-name-directory file) t) - (with-temp-file file - (insert-buffer-substring buffer) - (ansi-color-filter-region (point-min) (point-max))) - (set-file-modes file #o600))))) + (with-file-modes #o700 + (make-directory (file-name-directory file) t)) + (with-file-modes #o600 + (with-temp-file file + (insert-buffer-substring buffer) + (ansi-color-filter-region (point-min) (point-max)))))))) (defun doom-cli--output-benchmark-h (context) "Write this session's benchmark to stdout or stderr, depending. @@ -1351,10 +1352,11 @@ ARGS are options passed to less. If DOOMPAGER is set, ARGS are ignored." ((let ((tmpfile (doom-cli--output-file 'output context)) (coding-system-for-write 'utf-8-auto)) - (make-directory (file-name-directory tmpfile) t) - (with-temp-file tmpfile - (insert-buffer-substring (doom-cli-context-stdout context))) - (set-file-modes tmpfile #o600) + (with-file-modes #o700 + (make-directory (file-name-directory tmpfile) t)) + (with-file-modes #o600 + (with-temp-file tmpfile + (insert-buffer-substring (doom-cli-context-stdout context)))) (doom-cli--restart (format "%s <%s; rm -f%s %s" (or pager From f1e77e66924d0f32878941e3fdeed8494873d5a1 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 5 Dec 2023 17:14:27 -0500 Subject: [PATCH 15/23] feat(lib): doom-file-write: separate :mode for directories doom-file-write's :mode parameter now accepts a cons cell, whose CDR will determine the file mode for directories that get implicitly created by the function. --- lisp/lib/files.el | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/lisp/lib/files.el b/lisp/lib/files.el index d850596be..1feb20a26 100644 --- a/lisp/lib/files.el +++ b/lisp/lib/files.el @@ -302,8 +302,10 @@ If CONTENTS is list of forms. Any literal strings in the list are inserted verbatim, as text followed by a newline, with `insert'. Sexps are inserted with `prin1'. BY is the function to use to emit -MODE dictates the permissions of the file. If FILE already exists, its -permissions will be changed. +MODE dictates the permissions of created file and directories. MODE is either an +integer or a cons cell whose car is the mode for files and cdr the mode for +directories. If FILE already exists, its permissions will be changed. The +permissions of existing directories will never be changed. CODING dictates the encoding to read/write with (see `coding-system-for-write'). This defaults to `utf-8'. If set to nil, `binary' is used. @@ -311,9 +313,10 @@ This defaults to `utf-8'. If set to nil, `binary' is used. APPEND dictates where CONTENTS will be written. If neither is set, the file will be overwritten. If both are, the contents will be written to both ends. Set either APPEND or PREPEND to `noerror' to silently ignore read errors." - (doom--with-prepared-file-buffer file coding mode - (let ((contents (ensure-list contents)) - datum) + (let ((mode (ensure-list mode)) + (contents (ensure-list contents)) + datum) + (doom--with-prepared-file-buffer file coding (car mode) (while (setq datum (pop contents)) (cond ((stringp datum) (funcall @@ -332,14 +335,15 @@ ends. Set either APPEND or PREPEND to `noerror' to silently ignore read errors." (print-escape-control-characters t) (print-escape-nonascii t) (print-escape-multibyte t)) - (funcall printfn datum)))))) - (let (write-region-annotate-functions - write-region-post-annotation-function) - (when mkdir - (make-directory (file-name-directory buffer-file-name) - (eq mkdir 'parents))) - (write-region nil nil buffer-file-name append :silent)) - buffer-file-name)) + (funcall printfn datum))))) + (let (write-region-annotate-functions + write-region-post-annotation-function) + (when mkdir + (with-file-modes (or (cdr mode) (default-file-modes)) + (make-directory (file-name-directory buffer-file-name) + (eq mkdir 'parents)))) + (write-region nil nil buffer-file-name append :silent)) + buffer-file-name))) ;;;###autoload (defmacro with-file-contents! (file &rest body) From a5ffbd85502634a8b291216b589cb936e539bf85 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 5 Dec 2023 17:20:34 -0500 Subject: [PATCH 16/23] fix: ensure top-level file-name-handler-alist is affected Ensures that lexical contexts are never taken into account, in the case where Doom's core is loaded in an isolated environment (e.g. the sandbox). Also improves my startup time by 10%? I'll take it. --- lisp/doom.el | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/lisp/doom.el b/lisp/doom.el index 41f39c7c2..ab1096b26 100644 --- a/lisp/doom.el +++ b/lisp/doom.el @@ -331,19 +331,20 @@ users).") ;; `file-remote-p'). You get a noteable boost to startup time by unsetting ;; or simplifying its value. (let ((old-value (default-toplevel-value 'file-name-handler-alist))) - (setq file-name-handler-alist - ;; HACK: If the bundled elisp for this Emacs install isn't - ;; byte-compiled (but is compressed), then leave the gzip file - ;; handler there so Emacs won't forget how to read read them. - ;; - ;; calc-loaddefs.el is our heuristic for this because it is built-in - ;; to all supported versions of Emacs, and calc.el explicitly loads - ;; it uncompiled. This ensures that the only other, possible - ;; fallback would be calc-loaddefs.el.gz. - (if (eval-when-compile - (locate-file-internal "calc-loaddefs.el" load-path)) - nil - (list (rassq 'jka-compr-handler old-value)))) + (set-default-toplevel-value + 'file-name-handler-alist + ;; HACK: If the bundled elisp for this Emacs install isn't byte-compiled + ;; (but is compressed), then leave the gzip file handler there so Emacs + ;; won't forget how to read read them. + ;; + ;; calc-loaddefs.el is our heuristic for this because it is built-in to + ;; all supported versions of Emacs, and calc.el explicitly loads it + ;; uncompiled. This ensures that the only other, possible fallback would + ;; be calc-loaddefs.el.gz. + (if (eval-when-compile + (locate-file-internal "calc-loaddefs.el" load-path)) + nil + (list (rassq 'jka-compr-handler old-value)))) ;; Make sure the new value survives any current let-binding. (set-default-toplevel-value 'file-name-handler-alist file-name-handler-alist) ;; Remember it so it can be reset where needed. @@ -352,10 +353,11 @@ users).") ;; needed for handling encrypted or compressed files, among other things. (add-hook! 'emacs-startup-hook :depth 101 (defun doom--reset-file-handler-alist-h () - (setq file-name-handler-alist - ;; Merge instead of overwrite because there may have been changes to - ;; `file-name-handler-alist' since startup we want to preserve. - (delete-dups (append file-name-handler-alist old-value)))))) + (set-default-toplevel-value + 'file-name-handler-alist + ;; Merge instead of overwrite because there may have been changes to + ;; `file-name-handler-alist' since startup we want to preserve. + (delete-dups (append file-name-handler-alist old-value)))))) (unless noninteractive ;; PERF: Resizing the Emacs frame (to accommodate fonts that are smaller or From fcd95a09d02b5dc3655c011d76547de454f6c420 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 5 Dec 2023 17:39:33 -0500 Subject: [PATCH 17/23] nit: minor comment revision, reformatting, & internal refactor --- lisp/doom.el | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lisp/doom.el b/lisp/doom.el index ab1096b26..a0dabd4e4 100644 --- a/lisp/doom.el +++ b/lisp/doom.el @@ -411,23 +411,23 @@ users).") (define-advice startup--load-user-init-file (:before (&rest _) undo-silence) (advice-remove #'load-file #'load-file@silence)) - ;; PERF: `load-suffixes' and `load-file-rep-suffixes' are consulted on each - ;; `require' and `load'. Doom won't load any dmodules this early, so omit - ;; .so for a small startup boost. This is later restored in doom-start. + ;; PERF: `load-suffixes' and `load-file-rep-suffixes' are consulted on + ;; each `require' and `load'. Doom won't load any modules this early, so + ;; omit .so for a tiny startup boost. Is later restored in doom-start. (put 'load-suffixes 'initial-value (default-toplevel-value 'load-suffixes)) (put 'load-file-rep-suffixes 'initial-value (default-toplevel-value 'load-file-rep-suffixes)) (set-default-toplevel-value 'load-suffixes '(".elc" ".el")) (set-default-toplevel-value 'load-file-rep-suffixes '("")) - ;; COMPAT: Undo any problematic startup optimizations; from this point, I make - ;; no assumptions about what might be loaded in userland. + ;; COMPAT: Undo any problematic startup optimizations; from this point, I + ;; make no assumptions about what might be loaded in userland. (add-hook! 'doom-before-init-hook (defun doom--reset-load-suffixes-h () (setq load-suffixes (get 'load-suffixes 'initial-value) load-file-rep-suffixes (get 'load-file-rep-suffixes 'initial-value)))) - ;; PERF: Doom uses `defcustom' to indicate variables that users are expected - ;; to reconfigure. Trouble is it fires off initializers meant to - ;; accommodate any user attempts to configure them before they were + ;; PERF: Doom uses `defcustom' to indicate variables that users are + ;; expected to reconfigure. Trouble is it fires off initializers meant + ;; to accommodate any user attempts to configure them before they were ;; defined. This is unnecessary before $DOOMDIR/init.el is loaded, so I ;; disable them until it is. (setq custom-dont-initialize t) @@ -436,8 +436,8 @@ users).") (setq custom-dont-initialize nil))) ;; PERF: The mode-line procs a couple dozen times during startup. This is - ;; normally quite fast, but disabling the default mode-line and reducing the - ;; update delay timer seems to stave off ~30-50ms. + ;; normally quite fast, but disabling the default mode-line and reducing + ;; the update delay timer seems to stave off ~30-50ms. (put 'mode-line-format 'initial-value (default-toplevel-value 'mode-line-format)) (setq-default mode-line-format nil) (dolist (buf (buffer-list)) @@ -446,8 +446,8 @@ users).") ;; produce ugly flashes of unstyled Emacs. (setq-default inhibit-redisplay t inhibit-message t) - ;; COMPAT: Then reset it with advice, because `startup--load-user-init-file' - ;; will never be interrupted by errors. And if these settings are left + ;; COMPAT: Then reset with advice, because `startup--load-user-init-file' + ;; will never be interrupted by errors. And if these settings are left ;; set, Emacs could appear frozen or garbled. (defun doom--reset-inhibited-vars-h () (setq-default inhibit-redisplay nil @@ -461,8 +461,8 @@ users).") (unless (default-toplevel-value 'mode-line-format) (setq-default mode-line-format (get 'mode-line-format 'initial-value)))) - ;; PERF: Doom disables the UI elements by default, so that there's less for - ;; the frame to initialize. However, the toolbar is still populated + ;; PERF: Doom disables the UI elements by default, so that there's less + ;; for the frame to initialize. However, the toolbar is still populated ;; regardless, so I lazy load it until tool-bar-mode is actually used. (advice-add #'tool-bar-setup :override #'ignore) (define-advice startup--load-user-init-file (:before (&rest _) defer-tool-bar-setup) @@ -499,7 +499,7 @@ All valid contexts: (put 'doom-context 'valid-values '(cli compile eval init modules packages reload doctor sandbox)) (put 'doom-context 'risky-local-variable t) -(defun doom-context--check (context) +(defun doom-context--assert (context) (let ((valid (get 'doom-context 'valid-values))) (unless (memq context valid) (signal 'doom-context-error @@ -514,7 +514,7 @@ All valid contexts: Return non-nil if successful. Throws an error if CONTEXT is invalid." (unless (memq context doom-context) - (doom-context--check context) + (doom-context--assert context) (doom-log ":context: +%s %s" context doom-context) (push context doom-context))) From 6edb9dfc773028a9de4015aeae8c75418c264d20 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 5 Dec 2023 17:41:59 -0500 Subject: [PATCH 18/23] tweak(indent-guides): default to bitmap in GUI --- modules/ui/indent-guides/config.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/ui/indent-guides/config.el b/modules/ui/indent-guides/config.el index 662cb5140..f3524f9cd 100644 --- a/modules/ui/indent-guides/config.el +++ b/modules/ui/indent-guides/config.el @@ -2,7 +2,9 @@ (use-package! highlight-indent-guides :hook ((prog-mode text-mode conf-mode) . highlight-indent-guides-mode) - :init (setq highlight-indent-guides-method 'character) + :init + (setq highlight-indent-guides-method (if (display-graphic-p) 'bitmap 'character) + highlight-indent-guides-bitmap-function #'highlight-indent-guides--bitmap-line) :config ;; HACK: If this package is loaded too early (by the user, and in terminal ;; Emacs), then `highlight-indent-guides-auto-set-faces' will have been From ae451ff754b975d27de05a114095c815c644d295 Mon Sep 17 00:00:00 2001 From: 45mm <45mm@no.mail> Date: Thu, 18 Jan 2024 16:18:44 +0530 Subject: [PATCH 19/23] docs(vertico): mention `:args` option in docstring --- modules/completion/vertico/autoload/vertico.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/completion/vertico/autoload/vertico.el b/modules/completion/vertico/autoload/vertico.el index 0bfd9e00f..0199d431d 100644 --- a/modules/completion/vertico/autoload/vertico.el +++ b/modules/completion/vertico/autoload/vertico.el @@ -13,7 +13,9 @@ :in PATH Sets what directory to base the search out of. Defaults to the current project's root. :recursive BOOL - Whether or not to search files recursively from the base directory." + Whether or not to search files recursively from the base directory. +:args LIST + Arguments to be appended to `consult-ripgrep-args'." (declare (indent defun)) (unless (executable-find "rg") (user-error "Couldn't find ripgrep in your PATH")) From acb5af177b0a57ca4b05d00d5055d109198e2984 Mon Sep 17 00:00:00 2001 From: 45mm <45mm@no.mail> Date: Thu, 18 Jan 2024 16:20:15 +0530 Subject: [PATCH 20/23] fix(vertico): don't shell-quote consult-ripgrep-args We were using `shell-quote-argument`, which is meant for passing file names, strings and so on, not command-line arguments. For example, `(shell-quote-argument "--foo=bar")` yields "--foo\\=bar", which is obviiously invalid unless we're trying to pass an option named '--foo\'. At any rate, there is no quoting/escaping for shells in the default value of `consult-ripgrep-args`, so it doesn't look like this is something we need to do. --- modules/completion/vertico/autoload/vertico.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/completion/vertico/autoload/vertico.el b/modules/completion/vertico/autoload/vertico.el index 0199d431d..0b4219eaf 100644 --- a/modules/completion/vertico/autoload/vertico.el +++ b/modules/completion/vertico/autoload/vertico.el @@ -31,7 +31,7 @@ "--path-separator / --smart-case --no-heading " "--with-filename --line-number --search-zip " "--hidden -g !.git -g !.svn -g !.hg " - (mapconcat #'shell-quote-argument args " "))) + (mapconcat #'identity args " "))) (prompt (if (stringp prompt) (string-trim prompt) "Search")) (query (or query (when (doom-region-active-p) From 6275ed7e8f67d4633ee83c80336603ee48fff772 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Sat, 27 Jan 2024 09:14:35 +0100 Subject: [PATCH 21/23] bump: :ui modeline seagle0128/doom-modeline@93f240f7a0bf -> seagle0128/doom-modeline@bf880ae56f3f --- modules/ui/modeline/packages.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ui/modeline/packages.el b/modules/ui/modeline/packages.el index 274df912a..c95d740be 100644 --- a/modules/ui/modeline/packages.el +++ b/modules/ui/modeline/packages.el @@ -2,7 +2,7 @@ ;;; ui/modeline/packages.el (unless (modulep! +light) - (package! doom-modeline :pin "93f240f7a0bf35511cfc0a8dd75786744b4bcf77")) + (package! doom-modeline :pin "bf880ae56f3f6aab7bd334de9bd9b455c63a24c0")) (package! anzu :pin "5abb37455ea44fa401d5f4c1bdc58adb2448db67") (when (modulep! :editor evil) (package! evil-anzu :pin "d1e98ee6976437164627542909a25c6946497899")) From f9137b40e73ab9054d5500da2759d45e48dc4aa9 Mon Sep 17 00:00:00 2001 From: ncihnegn Date: Sat, 27 Jan 2024 00:16:06 -0800 Subject: [PATCH 22/23] docs(idris): add doctor.el --- modules/lang/idris/doctor.el | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 modules/lang/idris/doctor.el diff --git a/modules/lang/idris/doctor.el b/modules/lang/idris/doctor.el new file mode 100644 index 000000000..882cebbc1 --- /dev/null +++ b/modules/lang/idris/doctor.el @@ -0,0 +1,5 @@ +;;; lang/idris/doctor.el -*- lexical-binding: t; -*- + +(when (require 'idris-mode nil t) + (unless (executable-find idris-interpreter-path) + (warn! "Cannot find the idris interpreter. Most features will not work."))) From d87c181aea740a5a628d5689c4e5d034ec640656 Mon Sep 17 00:00:00 2001 From: Oscar Marshall Date: Sat, 27 Jan 2024 00:17:57 -0800 Subject: [PATCH 23/23] fix(upload): ssh-deploy-on-explicit-save = 1 #7513 changed the expected value of `ssh-deploy-on-explicit-save` to be #an integer, but the default value was still `t`. This commit changes it #to be `1`. Amend: #7513 --- modules/tools/upload/config.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/tools/upload/config.el b/modules/tools/upload/config.el index 25e2829be..6592e4331 100644 --- a/modules/tools/upload/config.el +++ b/modules/tools/upload/config.el @@ -7,7 +7,7 @@ ;; Example: ;; ((nil . ((ssh-deploy-root-local . "/local/path/to/project") ;; (ssh-deploy-root-remote . "/ssh:user@server:/remote/project/") -;; (ssh-deploy-on-explicit-save . t)))) +;; (ssh-deploy-on-explicit-save . 1)))) ;; ;; Note: `ssh-deploy-root-local' is optional, and will resort to ;; `doom-project-root' if unspecified. @@ -20,7 +20,7 @@ ssh-deploy-remote-changes-handler) :init (setq ssh-deploy-revision-folder (concat doom-cache-dir "ssh-revisions/") - ssh-deploy-on-explicit-save t + ssh-deploy-on-explicit-save 1 ssh-deploy-automatically-detect-remote-changes nil) ;; Make these safe as file-local variables