dev: merge branch 'master' of github.com:doomemacs

This commit is contained in:
Matt Nish-Lapidus 2024-08-29 11:01:17 -04:00
commit 17957d1d98
16 changed files with 121 additions and 54 deletions

View file

@ -68,13 +68,6 @@ Is nil if no executable is found in your PATH during startup.")
(global-set-key [remap find-tag] #'projectile-find-tag) (global-set-key [remap find-tag] #'projectile-find-tag)
:config :config
;; HACK: Projectile cleans up the known projects list at startup. If this list
;; contains tramp paths, the `file-remote-p' calls will pull in tramp via
;; its `file-name-handler-alist' entry, which is expensive. Since Doom
;; already cleans up the project list on kill-emacs-hook, it's simplest to
;; inhibit this cleanup process at startup (see bbatsov/projectile#1649).
(letf! ((#'projectile--cleanup-known-projects #'ignore))
(projectile-mode +1))
;; HACK: Auto-discovery and cleanup on `projectile-mode' is slow and ;; HACK: Auto-discovery and cleanup on `projectile-mode' is slow and
;; premature. Let's try to defer it until it's needed. ;; premature. Let's try to defer it until it's needed.
(add-transient-hook! 'projectile-relevant-known-projects (add-transient-hook! 'projectile-relevant-known-projects
@ -246,7 +239,18 @@ when using many of projectile's command, e.g. `projectile-compile-command',
This suppresses the error so these commands will still run, but prompt you for This suppresses the error so these commands will still run, but prompt you for
the command instead." the command instead."
:around #'projectile-default-generic-command :around #'projectile-default-generic-command
(ignore-errors (apply fn args)))) (ignore-errors (apply fn args)))
;; HACK: Projectile cleans up the known projects list at startup. If this list
;; contains tramp paths, the `file-remote-p' calls will pull in tramp via
;; its `file-name-handler-alist' entry, which is expensive. Since Doom
;; already cleans up the project list on kill-emacs-hook, it's simplest to
;; inhibit this cleanup process at startup (see bbatsov/projectile#1649).
(letf! ((#'projectile--cleanup-known-projects #'ignore))
(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)))
;; ;;

View file

@ -322,6 +322,15 @@ If RETURN-P, return the message as a string instead of displaying it."
(doom-run-hook-on 'doom-first-buffer-hook '(find-file-hook doom-switch-buffer-hook)) (doom-run-hook-on 'doom-first-buffer-hook '(find-file-hook doom-switch-buffer-hook))
(doom-run-hook-on 'doom-first-file-hook '(find-file-hook dired-initial-position-hook)) (doom-run-hook-on 'doom-first-file-hook '(find-file-hook dired-initial-position-hook))
(doom-run-hook-on 'doom-first-input-hook '(pre-command-hook)) (doom-run-hook-on 'doom-first-input-hook '(pre-command-hook))
;; If the user's already opened something (e.g. with command-line arguments),
;; then we should assume nothing about the user's intentions and simply treat
;; this session as fully initialized.
(add-hook! 'doom-after-init-hook :depth 100
(defun doom-run-first-hooks-if-files-open-h ()
(when file-name-history
(doom-run-hooks 'doom-first-file-hook 'doom-first-buffer-hook))))
;; PERF: Activate these later, otherwise they'll fire for every buffer created ;; PERF: Activate these later, otherwise they'll fire for every buffer created
;; between now and the end of startup. ;; between now and the end of startup.
(add-hook! 'after-init-hook (add-hook! 'after-init-hook

View file

@ -1,8 +1,5 @@
;;; lisp/lib/config.el -*- lexical-binding: t; -*- ;;; lisp/lib/config.el -*- lexical-binding: t; -*-
(defvar doom-bin-dir (expand-file-name "bin/" doom-emacs-dir))
(defvar doom-bin (expand-file-name "doom" doom-bin-dir))
;;;###autoload ;;;###autoload
(defvar doom-after-reload-hook nil (defvar doom-after-reload-hook nil
"A list of hooks to run after `doom/reload' has reloaded Doom.") "A list of hooks to run after `doom/reload' has reloaded Doom.")

View file

@ -6,7 +6,7 @@
:pin "17cfa1b54800fdef2975c0c0531dad34846a5065") :pin "17cfa1b54800fdef2975c0c0531dad34846a5065")
(package! compat (package! compat
:recipe (:host github :repo "emacs-compat/compat") :recipe (:host github :repo "emacs-compat/compat")
:pin "09dce8a193c5a70277512263782b82fa1cba84c0") :pin "e9203e164903a6bb7de3e58aa0d653bbcff9d3d1")
(package! gcmh (package! gcmh
:pin "0089f9c3a6d4e9a310d0791cf6fa8f35642ecfd9") :pin "0089f9c3a6d4e9a310d0791cf6fa8f35642ecfd9")
@ -21,22 +21,22 @@
:pin "88e574ae75344e39b436f863ef0344135c7b6517") :pin "88e574ae75344e39b436f863ef0344135c7b6517")
;; doom-ui.el ;; doom-ui.el
(package! nerd-icons :pin "4322290303f2e12efd5685a0d22d76ed76ec7349") (package! nerd-icons :pin "c3d641d8e14bd11b5f98372da34ee5313636e363")
(package! hide-mode-line :pin "bc5d293576c5e08c29e694078b96a5ed85631942") (package! hide-mode-line :pin "ddd154f1e04d666cd004bf8212ead8684429350d")
(package! highlight-numbers :pin "8b4744c7f46c72b1d3d599d4fb75ef8183dee307") (package! highlight-numbers :pin "8b4744c7f46c72b1d3d599d4fb75ef8183dee307")
(package! rainbow-delimiters :pin "f40ece58df8b2f0fb6c8576b527755a552a5e763") (package! rainbow-delimiters :pin "f40ece58df8b2f0fb6c8576b527755a552a5e763")
(package! restart-emacs :pin "1607da2bc657fe05ae01f7fdf26f716eafead02c") (package! restart-emacs :pin "1607da2bc657fe05ae01f7fdf26f716eafead02c")
;; doom-editor.el ;; doom-editor.el
(package! better-jumper :pin "47622213783ece37d5337dc28d33b530540fc319") (package! better-jumper :pin "47622213783ece37d5337dc28d33b530540fc319")
(package! dtrt-indent :pin "339755e4fb5245862737babf7f2c1e3bae1c129c") (package! dtrt-indent :pin "a8aa356684804c52f26602d4e315f1306c6f3e59")
(package! helpful :pin "4ba24cac9fb14d5fdc32582cd947572040e82b2c") (package! helpful :pin "4ba24cac9fb14d5fdc32582cd947572040e82b2c")
(package! smartparens :pin "ab475c78916d7b1666a495e3fe9c54b250195637") (package! smartparens :pin "c7519a1b69f196050a13e2230b7532893b077086")
(package! ws-butler :pin "e3a38d93e01014cd47bf5af4924459bd145fd7c4") (package! ws-butler :pin "e3a38d93e01014cd47bf5af4924459bd145fd7c4")
;; doom-projects.el ;; doom-projects.el
(package! projectile :pin "0163b335a18af0f077a474d4dc6b36e22b5e3274") (package! projectile :pin "8cc2ee8937b89f1639304cbd2526e85b17135372")
(package! project :pin "093f42a1b612eaae0d2bdd475663c14973fe0325") (package! project :pin "5c77d78936364e2e6e9641af2091fde0bee729ce")
;; doom-keybinds.el ;; doom-keybinds.el
(package! general :pin "826bf2b97a0fb4a34c5eb96ec2b172d682fd548f") (package! general :pin "826bf2b97a0fb4a34c5eb96ec2b172d682fd548f")

View file

@ -27,7 +27,7 @@
(define-key cfw:calendar-mode-map "q" #'+calendar/quit) (define-key cfw:calendar-mode-map "q" #'+calendar/quit)
(when (modulep! :editor evil +everywhere) (when (modulep! :editor evil +everywhere)
(set-evil-initial-state! '(cfw:calendar-mode cfw:details-mode) 'motion) (set-evil-initial-state! '(cfw:calendar-mode cfw:details-mode) 'motion)
(add-hook! (cfw:calendar-mode cfw:details-mode) #'evil-normalize-keymaps) (add-hook! '(cfw:calendar-mode-hook cfw:details-mode-hook) #'evil-normalize-keymaps)
(map! (:map cfw:calendar-mode-map (map! (:map cfw:calendar-mode-map
:m "q" #'+calendar/quit :m "q" #'+calendar/quit
:m "SPC" #'cfw:show-details-command :m "SPC" #'cfw:show-details-command

View file

@ -46,4 +46,48 @@
(let ((cape-dabbrev-check-other-buffers nil)) (let ((cape-dabbrev-check-other-buffers nil))
(cape-dabbrev t))) (cape-dabbrev t)))
;;;###autoload
(defun +corfu/toggle-auto-complete (&optional interactive)
"Toggle as-you-type completion in Corfu."
(interactive (list 'interactive))
(dolist (buf (buffer-list))
(with-current-buffer buf
(when corfu-mode
(if corfu-auto
(remove-hook 'post-command-hook #'corfu--auto-post-command 'local)
(add-hook 'post-command-hook #'corfu--auto-post-command nil 'local)))))
(when interactive
(message "Corfu auto-complete %s" (if corfu-auto "disabled" "enabled")))
(setq corfu-auto (not corfu-auto)))
;;;###autoload
(defun +corfu/dabbrev-or-next (&optional arg)
"Trigger corfu popup and select the first candidate.
Intended to mimic `evil-complete-next', unless the popup is already open."
(interactive "p")
(if corfu--candidates
(corfu-next arg)
(require 'cape)
(let ((cape-dabbrev-check-other-buffers
(bound-and-true-p evil-complete-all-buffers)))
(cape-dabbrev t)
(when (> corfu--total 0)
(corfu--goto (or arg 0))))))
;;;###autoload
(defun +corfu/dabbrev-or-last (&optional arg)
"Trigger corfu popup and select the first candidate.
Intended to mimic `evil-complete-previous', unless the popup is already open."
(interactive "p")
(if corfu--candidates
(corfu-previous arg)
(require 'cape)
(let ((cape-dabbrev-check-other-buffers
(bound-and-true-p evil-complete-all-buffers)))
(cape-dabbrev t)
(when (> corfu--total 0)
(corfu--goto (- corfu--total (or arg 1)))))))
;;; end of autoload.el ;;; end of autoload.el

View file

@ -192,6 +192,8 @@
(:after corfu (:after corfu
(:map corfu-mode-map (:map corfu-mode-map
:i "C-SPC" #'completion-at-point :i "C-SPC" #'completion-at-point
:i "C-n" #'+corfu/dabbrev-or-next
:i "C-p" #'+corfu/dabbrev-or-last
:n "C-SPC" (cmd! (call-interactively #'evil-insert-state) :n "C-SPC" (cmd! (call-interactively #'evil-insert-state)
(call-interactively #'completion-at-point)) (call-interactively #'completion-at-point))
:v "C-SPC" (cmd! (call-interactively #'evil-change) :v "C-SPC" (cmd! (call-interactively #'evil-change)

View file

@ -99,7 +99,19 @@ Fixes #3939: unsortable dired entries on Windows."
dirvish-header-line-height height))))) dirvish-header-line-height height)))))
(when (modulep! :ui vc-gutter) (when (modulep! :ui vc-gutter)
(push 'vc-state dirvish-attributes)) ;; HACK: Dirvish sets up the fringes for vc-state late in the startup
;; process, causing this jarring pop-in effect. This advice sets them up
;; sooner to avoid this.
;; REVIEW: Upstream this later.
(defadvice! +dired--init-fringes-a (_dir _buffer setup)
:before #'dirvish-data-for-dir
(when (and setup (memq 'vc-state dirvish-attributes))
(set-window-fringes nil 5 1)))
;; The vc-gutter module uses `diff-hl-dired-mode' + `diff-hl-margin-mode'
;; for diffs in dirvish buffers. `vc-state' uses overlays, so they won't be
;; visible in the terminal.
(when (or (daemonp) (display-graphic-p))
(push 'vc-state dirvish-attributes)))
(when (modulep! +icons) (when (modulep! +icons)
(setq dirvish-subtree-always-show-state t) (setq dirvish-subtree-always-show-state t)

View file

@ -108,7 +108,7 @@
;; In addition, `wl-folder-mode' won't start in `evil-emacs-state' through ;; In addition, `wl-folder-mode' won't start in `evil-emacs-state' through
;; `evil-emacs-state-modes', and `wl-summary-mode' won't start in ;; `evil-emacs-state-modes', and `wl-summary-mode' won't start in
;; `evil-emacs-state' through `wl-summary-mode-hook'. ;; `evil-emacs-state' through `wl-summary-mode-hook'.
(add-hook! 'wl-folder-mode-hook #'evil-emacs-state) (add-hook 'wl-folder-mode-hook #'evil-emacs-state)
(pushnew! evil-emacs-state-modes 'wl-summary-mode)) (pushnew! evil-emacs-state-modes 'wl-summary-mode))
(add-hook 'mime-edit-mode-hook #'auto-fill-mode)) (add-hook 'mime-edit-mode-hook #'auto-fill-mode))

View file

@ -869,9 +869,6 @@ between the two."
[remap doom/backward-to-bol-or-indent] #'org-beginning-of-line [remap doom/backward-to-bol-or-indent] #'org-beginning-of-line
[remap doom/forward-to-last-non-comment-or-eol] #'org-end-of-line [remap doom/forward-to-last-non-comment-or-eol] #'org-end-of-line
(:when (modulep! :completion vertico)
[remap imenu] #'consult-outline)
:localleader :localleader
"#" #'org-update-statistics-cookies "#" #'org-update-statistics-cookies
"'" #'org-edit-special "'" #'org-edit-special

View file

@ -1,5 +1,5 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; lang/rust/packages.el ;;; lang/rust/packages.el
(package! rust-mode :pin "d00d83d3a207a5b7c2994392b2781f627e3159ce") (package! rust-mode :pin "a529a4518120bd1c662edc31b82062f41bbfb990")
(package! rustic :pin "39423d1cf4fa054c36bf9577356451f4c06ee148") (package! rustic :pin "d765680373234a6c231acf20c76b07422afcfdf9")

View file

@ -97,7 +97,7 @@ Can be a list of backends; accepts any value `company-backends' accepts.")
(setq-local flycheck-checker old-checker)) (setq-local flycheck-checker old-checker))
(apply fn args))) (apply fn args)))
(add-hook! 'lsp-mode-hook #'+lsp-optimization-mode) (add-hook 'lsp-mode-hook #'+lsp-optimization-mode)
(when (modulep! :completion company) (when (modulep! :completion company)
(add-hook! 'lsp-completion-mode-hook (add-hook! 'lsp-completion-mode-hook

View file

@ -4,7 +4,6 @@
(modulep! +peek))) (modulep! +peek)))
"+eglot and +peek flags are not compatible. Peek uses lsp-mode, while Eglot is another package altogether for LSP.") "+eglot and +peek flags are not compatible. Peek uses lsp-mode, while Eglot is another package altogether for LSP.")
(when (modulep! +eglot) (unless (modulep! +eglot)
(unless (executable-find "npm") (unless (executable-find "npm")
(warn! "Couldn't find npm, most server installers won't work and will have to be installed manually. (warn! "Couldn't find npm. `lsp-mode' needs npm to auto-install some LSP servers. For more information, see https://emacs-lsp.github.io/lsp-mode/page/languages/.")))
For more information, see https://emacs-lsp.github.io/lsp-mode/page/languages/.")))

View file

@ -38,18 +38,17 @@ grows larger."
;; Don't try to resize popup windows ;; Don't try to resize popup windows
(advice-add #'balance-windows :around #'+popup-save-a) (advice-add #'balance-windows :around #'+popup-save-a)
(defun +popup/quit-window () (defun +popup/quit-window (&optional arg)
"The regular `quit-window' sometimes kills the popup buffer and switches to a "The regular `quit-window' sometimes kills the popup buffer and switches to a
buffer that shouldn't be in a popup. We prevent that by remapping `quit-window' buffer that shouldn't be in a popup. We prevent that by remapping `quit-window'
to this commmand." to this commmand."
(interactive) (interactive "P")
(let ((orig-buffer (current-buffer))) (let ((orig-buffer (current-buffer)))
(quit-window) (quit-window arg)
(when (and (eq orig-buffer (current-buffer)) (when (and (eq orig-buffer (current-buffer))
(+popup-buffer-p)) (+popup-buffer-p))
(+popup/close nil 'force)))) (+popup/close nil 'force))))
(global-set-key [remap quit-window] #'+popup/quit-window) (define-key +popup-buffer-mode-map [remap quit-window] #'+popup/quit-window)
;; ;;

View file

@ -297,7 +297,8 @@ Any non-nil value besides the above will be used as the raw value for
(defun +popup-unset-modeline-on-disable-h () (defun +popup-unset-modeline-on-disable-h ()
"Restore the modeline when `+popup-buffer-mode' is deactivated." "Restore the modeline when `+popup-buffer-mode' is deactivated."
(when (and (not (bound-and-true-p +popup-buffer-mode)) (when (and (not (bound-and-true-p +popup-buffer-mode))
(bound-and-true-p hide-mode-line-mode)) (bound-and-true-p hide-mode-line-mode)
(not (bound-and-true-p global-hide-mode-line-mode)))
(hide-mode-line-mode -1))) (hide-mode-line-mode -1)))
;;;###autoload ;;;###autoload

View file

@ -69,11 +69,29 @@
(defun +vc-gutter-enable-maybe-h () (defun +vc-gutter-enable-maybe-h ()
"Conditionally enable `diff-hl-dired-mode' in dired buffers. "Conditionally enable `diff-hl-dired-mode' in dired buffers.
Respects `diff-hl-disable-on-remote'." Respects `diff-hl-disable-on-remote'."
(unless (and (bound-and-true-p dirvish-override-dired-mode) ;; Neither `diff-hl-dired-mode' or `diff-hl-dired-mode-unless-remote'
(bound-and-true-p diff-hl-disable-on-remote) ;; respect `diff-hl-disable-on-remote', so...
(unless (and (bound-and-true-p diff-hl-disable-on-remote)
(file-remote-p default-directory)) (file-remote-p default-directory))
(diff-hl-dired-mode +1)))) (diff-hl-dired-mode +1))))
;; HACK: diff-hl won't be visible in TTY frames, but there's no simple way to
;; use the fringe in GUI Emacs *and* use the margin in the terminal *AND*
;; support daemon users, so we need more than a static `display-graphic-p'
;; check at startup.
(if (not (daemonp))
(unless (display-graphic-p)
(add-hook 'global-diff-hl-mode-hook #'diff-hl-margin-mode))
(when (modulep! :os tty)
(put 'diff-hl-mode 'last t)
(add-hook! 'doom-switch-window-hook
(defun +vc-gutter-use-margins-in-tty-h ()
(when (bound-and-true-p global-diff-hl-mode)
(let ((graphic? (display-graphic-p)))
(unless (eq (get 'diff-hl-mode 'last) graphic?)
(diff-hl-margin-mode (if graphic? -1 +1))
(put 'diff-hl-mode 'last graphic?))))))))
:config :config
(set-popup-rule! "^\\*diff-hl" :select nil :size '+popup-shrink-to-fit) (set-popup-rule! "^\\*diff-hl" :select nil :size '+popup-shrink-to-fit)
@ -194,19 +212,4 @@ Respects `diff-hl-disable-on-remote'."
:before #'kill-buffer :before #'kill-buffer
(when-let ((buf (ignore-errors (window-normalize-buffer buf)))) (when-let ((buf (ignore-errors (window-normalize-buffer buf))))
(with-current-buffer buf (with-current-buffer buf
(+vc-gutter--kill-thread t)))) (+vc-gutter--kill-thread t)))))
;; HACK: diff-hl won't be visible in TTY frames, but there's no simple way to
;; use the fringe in GUI Emacs and use the margin in the terminal *AND*
;; support daemon users, so we need more than a static `display-graphic-p'
;; check at startup.
(when (modulep! :os tty)
(put 'diff-hl-mode 'last (display-graphic-p))
(add-hook! 'doom-switch-window-hook
(defun +vc-gutter-use-margins-in-tty-h ()
(let ((graphic? (display-graphic-p)))
(unless (and global-diff-hl-mode (eq (get 'diff-hl-mode 'last) graphic?))
(global-diff-hl-mode -1)
(diff-hl-margin-mode (if graphic? -1 +1))
(global-diff-hl-mode +1)
(put 'diff-hl-mode 'last graphic?)))))))