diff --git a/lisp/doom-projects.el b/lisp/doom-projects.el index aa1d22987..51736a196 100644 --- a/lisp/doom-projects.el +++ b/lisp/doom-projects.el @@ -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) :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 ;; premature. Let's try to defer it until it's needed. (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 the command instead." :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))) ;; diff --git a/lisp/doom-start.el b/lisp/doom-start.el index c38a7ebfb..35a4f2e9e 100644 --- a/lisp/doom-start.el +++ b/lisp/doom-start.el @@ -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-file-hook '(find-file-hook dired-initial-position-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 ;; between now and the end of startup. (add-hook! 'after-init-hook diff --git a/lisp/lib/config.el b/lisp/lib/config.el index 22f511b22..c92d4a791 100644 --- a/lisp/lib/config.el +++ b/lisp/lib/config.el @@ -1,8 +1,5 @@ ;;; 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 (defvar doom-after-reload-hook nil "A list of hooks to run after `doom/reload' has reloaded Doom.") diff --git a/lisp/packages.el b/lisp/packages.el index 571c86984..402df59df 100644 --- a/lisp/packages.el +++ b/lisp/packages.el @@ -6,7 +6,7 @@ :pin "17cfa1b54800fdef2975c0c0531dad34846a5065") (package! compat :recipe (:host github :repo "emacs-compat/compat") - :pin "09dce8a193c5a70277512263782b82fa1cba84c0") + :pin "e9203e164903a6bb7de3e58aa0d653bbcff9d3d1") (package! gcmh :pin "0089f9c3a6d4e9a310d0791cf6fa8f35642ecfd9") @@ -21,22 +21,22 @@ :pin "88e574ae75344e39b436f863ef0344135c7b6517") ;; doom-ui.el -(package! nerd-icons :pin "4322290303f2e12efd5685a0d22d76ed76ec7349") -(package! hide-mode-line :pin "bc5d293576c5e08c29e694078b96a5ed85631942") +(package! nerd-icons :pin "c3d641d8e14bd11b5f98372da34ee5313636e363") +(package! hide-mode-line :pin "ddd154f1e04d666cd004bf8212ead8684429350d") (package! highlight-numbers :pin "8b4744c7f46c72b1d3d599d4fb75ef8183dee307") (package! rainbow-delimiters :pin "f40ece58df8b2f0fb6c8576b527755a552a5e763") (package! restart-emacs :pin "1607da2bc657fe05ae01f7fdf26f716eafead02c") ;; doom-editor.el (package! better-jumper :pin "47622213783ece37d5337dc28d33b530540fc319") -(package! dtrt-indent :pin "339755e4fb5245862737babf7f2c1e3bae1c129c") +(package! dtrt-indent :pin "a8aa356684804c52f26602d4e315f1306c6f3e59") (package! helpful :pin "4ba24cac9fb14d5fdc32582cd947572040e82b2c") -(package! smartparens :pin "ab475c78916d7b1666a495e3fe9c54b250195637") +(package! smartparens :pin "c7519a1b69f196050a13e2230b7532893b077086") (package! ws-butler :pin "e3a38d93e01014cd47bf5af4924459bd145fd7c4") ;; doom-projects.el -(package! projectile :pin "0163b335a18af0f077a474d4dc6b36e22b5e3274") -(package! project :pin "093f42a1b612eaae0d2bdd475663c14973fe0325") +(package! projectile :pin "8cc2ee8937b89f1639304cbd2526e85b17135372") +(package! project :pin "5c77d78936364e2e6e9641af2091fde0bee729ce") ;; doom-keybinds.el (package! general :pin "826bf2b97a0fb4a34c5eb96ec2b172d682fd548f") diff --git a/modules/app/calendar/config.el b/modules/app/calendar/config.el index 75720240f..71e9e0232 100644 --- a/modules/app/calendar/config.el +++ b/modules/app/calendar/config.el @@ -27,7 +27,7 @@ (define-key cfw:calendar-mode-map "q" #'+calendar/quit) (when (modulep! :editor evil +everywhere) (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 :m "q" #'+calendar/quit :m "SPC" #'cfw:show-details-command diff --git a/modules/completion/corfu/autoload.el b/modules/completion/corfu/autoload.el index d3c63d5d2..e8a8aa73c 100644 --- a/modules/completion/corfu/autoload.el +++ b/modules/completion/corfu/autoload.el @@ -46,4 +46,48 @@ (let ((cape-dabbrev-check-other-buffers nil)) (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 diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 722ff88a6..85c6d1b49 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -192,6 +192,8 @@ (:after corfu (:map corfu-mode-map :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) (call-interactively #'completion-at-point)) :v "C-SPC" (cmd! (call-interactively #'evil-change) diff --git a/modules/emacs/dired/config.el b/modules/emacs/dired/config.el index f700e2e2f..ea2f76900 100644 --- a/modules/emacs/dired/config.el +++ b/modules/emacs/dired/config.el @@ -99,7 +99,19 @@ Fixes #3939: unsortable dired entries on Windows." dirvish-header-line-height height))))) (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) (setq dirvish-subtree-always-show-state t) diff --git a/modules/email/wanderlust/config.el b/modules/email/wanderlust/config.el index 22350066e..436a7126f 100644 --- a/modules/email/wanderlust/config.el +++ b/modules/email/wanderlust/config.el @@ -108,7 +108,7 @@ ;; 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' 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)) (add-hook 'mime-edit-mode-hook #'auto-fill-mode)) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index f8404075f..65eb023cc 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -869,9 +869,6 @@ between the two." [remap doom/backward-to-bol-or-indent] #'org-beginning-of-line [remap doom/forward-to-last-non-comment-or-eol] #'org-end-of-line - (:when (modulep! :completion vertico) - [remap imenu] #'consult-outline) - :localleader "#" #'org-update-statistics-cookies "'" #'org-edit-special diff --git a/modules/lang/rust/packages.el b/modules/lang/rust/packages.el index 5fdb9e14b..fdd53aa19 100644 --- a/modules/lang/rust/packages.el +++ b/modules/lang/rust/packages.el @@ -1,5 +1,5 @@ ;; -*- no-byte-compile: t; -*- ;;; lang/rust/packages.el -(package! rust-mode :pin "d00d83d3a207a5b7c2994392b2781f627e3159ce") -(package! rustic :pin "39423d1cf4fa054c36bf9577356451f4c06ee148") +(package! rust-mode :pin "a529a4518120bd1c662edc31b82062f41bbfb990") +(package! rustic :pin "d765680373234a6c231acf20c76b07422afcfdf9") diff --git a/modules/tools/lsp/+lsp.el b/modules/tools/lsp/+lsp.el index e3f3988a2..ae8ef434a 100644 --- a/modules/tools/lsp/+lsp.el +++ b/modules/tools/lsp/+lsp.el @@ -97,7 +97,7 @@ Can be a list of backends; accepts any value `company-backends' accepts.") (setq-local flycheck-checker old-checker)) (apply fn args))) - (add-hook! 'lsp-mode-hook #'+lsp-optimization-mode) + (add-hook 'lsp-mode-hook #'+lsp-optimization-mode) (when (modulep! :completion company) (add-hook! 'lsp-completion-mode-hook diff --git a/modules/tools/lsp/doctor.el b/modules/tools/lsp/doctor.el index a438973e5..60b3aa793 100644 --- a/modules/tools/lsp/doctor.el +++ b/modules/tools/lsp/doctor.el @@ -4,7 +4,6 @@ (modulep! +peek))) "+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") - (warn! "Couldn't find npm, most server installers won't work and will have to be installed manually. -For more information, see https://emacs-lsp.github.io/lsp-mode/page/languages/."))) + (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/."))) diff --git a/modules/ui/popup/+hacks.el b/modules/ui/popup/+hacks.el index f2c35ab9b..05dd44983 100644 --- a/modules/ui/popup/+hacks.el +++ b/modules/ui/popup/+hacks.el @@ -38,18 +38,17 @@ grows larger." ;; Don't try to resize popup windows (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 buffer that shouldn't be in a popup. We prevent that by remapping `quit-window' to this commmand." - (interactive) + (interactive "P") (let ((orig-buffer (current-buffer))) - (quit-window) + (quit-window arg) (when (and (eq orig-buffer (current-buffer)) (+popup-buffer-p)) (+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) ;; diff --git a/modules/ui/popup/autoload/popup.el b/modules/ui/popup/autoload/popup.el index 3a8a9e61e..5bd44a299 100644 --- a/modules/ui/popup/autoload/popup.el +++ b/modules/ui/popup/autoload/popup.el @@ -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 () "Restore the modeline when `+popup-buffer-mode' is deactivated." (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))) ;;;###autoload diff --git a/modules/ui/vc-gutter/config.el b/modules/ui/vc-gutter/config.el index dc1e053c9..e3c061a55 100644 --- a/modules/ui/vc-gutter/config.el +++ b/modules/ui/vc-gutter/config.el @@ -69,11 +69,29 @@ (defun +vc-gutter-enable-maybe-h () "Conditionally enable `diff-hl-dired-mode' in dired buffers. Respects `diff-hl-disable-on-remote'." - (unless (and (bound-and-true-p dirvish-override-dired-mode) - (bound-and-true-p diff-hl-disable-on-remote) + ;; Neither `diff-hl-dired-mode' or `diff-hl-dired-mode-unless-remote' + ;; respect `diff-hl-disable-on-remote', so... + (unless (and (bound-and-true-p diff-hl-disable-on-remote) (file-remote-p default-directory)) (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 (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 (when-let ((buf (ignore-errors (window-normalize-buffer buf)))) (with-current-buffer buf - (+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?))))))) + (+vc-gutter--kill-thread t)))))