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

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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))

View file

@ -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

View file

@ -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")

View file

@ -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

View file

@ -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/.")))

View file

@ -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)
;;

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 ()
"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

View file

@ -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)))))