Rewrite switch-{buffer,window} hooks
+ Add doom-switch-frame-hook + Replace doom-{enter,exit}-{buffer,window}-hook with doom-switch-{buffer,window}-hook + New switch-buffer hooks run on buffer-list-update-hook rather than in select-window advice. + Blank our buffer-list-update-hook in some places to reduce how many times it gets triggered.
This commit is contained in:
parent
8f2fb07948
commit
a05b1877be
9 changed files with 93 additions and 104 deletions
|
@ -18,8 +18,7 @@
|
|||
;; Handles whitespace (tabs/spaces) settings externally. This way projects can
|
||||
;; specify their own formatting rules.
|
||||
(def-package! editorconfig
|
||||
:defer 3
|
||||
:after-call (doom-enter-buffer-hook after-find-file)
|
||||
:after-call (doom-switch-buffer-hook after-find-file)
|
||||
:config
|
||||
;; Register missing indent variables
|
||||
(unless (assq 'mips-mode editorconfig-indentation-alist)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
(def-package! flycheck
|
||||
:commands (flycheck-list-errors flycheck-buffer)
|
||||
:after-call (doom-enter-buffer-hook after-find-file)
|
||||
:after-call (doom-switch-buffer-hook after-find-file)
|
||||
:config
|
||||
;; Emacs feels snappier without checks on newline
|
||||
(setq flycheck-check-syntax-automatically (delq 'new-line flycheck-check-syntax-automatically))
|
||||
|
|
|
@ -44,14 +44,14 @@ warning)."
|
|||
(make-directory +wakatime-home t)))
|
||||
(global-wakatime-mode +1))
|
||||
;;
|
||||
(remove-hook 'doom-exit-buffer-hook #'+wakatime|autostart)
|
||||
(remove-hook 'doom-switch-buffer-hook #'+wakatime|autostart)
|
||||
(advice-remove 'after-find-file #'+wakatime|autostart))
|
||||
|
||||
;;;###autoload
|
||||
(defun +wakatime|delayed-autostart (&rest _)
|
||||
"Lazily initialize `wakatime-mode' until the next time you switch buffers or
|
||||
open a file."
|
||||
(add-hook 'doom-exit-buffer-hook #'+wakatime|autostart)
|
||||
(add-hook 'doom-switch-buffer-hook #'+wakatime|autostart)
|
||||
;; this is necessary in case the user opens emacs with file arguments
|
||||
(advice-add 'after-find-file :before #'+wakatime|autostart))
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ PLIST can have the following properties:
|
|||
(add-hook 'window-configuration-change-hook #'+doom-dashboard|resize)
|
||||
(add-hook 'window-size-change-functions #'+doom-dashboard|resize)
|
||||
(add-hook 'kill-buffer-query-functions #'+doom-dashboard|reload-on-kill)
|
||||
(add-hook 'doom-enter-buffer-hook #'+doom-dashboard|reload-on-kill)
|
||||
(add-hook 'doom-switch-buffer-hook #'+doom-dashboard|reload-on-kill)
|
||||
;; `persp-mode' integration: update `default-directory' when switching
|
||||
(add-hook 'persp-created-functions #'+doom-dashboard|record-project)
|
||||
(add-hook 'persp-activated-functions #'+doom-dashboard|detect-project)
|
||||
|
@ -228,7 +228,8 @@ whose dimensions may not be fully initialized by the time this is run."
|
|||
|
||||
(defun +doom-dashboard|resize (&rest _)
|
||||
"Recenter the dashboard, and reset its margins and fringes."
|
||||
(let ((windows (get-buffer-window-list (doom-fallback-buffer) nil t)))
|
||||
(let ((windows (get-buffer-window-list (doom-fallback-buffer) nil t))
|
||||
buffer-list-update-hook)
|
||||
(dolist (win windows)
|
||||
(set-window-start win 0)
|
||||
(set-window-fringes win 0 0)
|
||||
|
@ -274,7 +275,8 @@ project (which may be different across perspective)."
|
|||
|
||||
(defun +doom-dashboard-initial-buffer ()
|
||||
"Returns buffer to display on startup. Designed for `initial-buffer-choice'."
|
||||
(get-buffer-create +doom-dashboard-name))
|
||||
(let (buffer-list-update-hook)
|
||||
(get-buffer-create +doom-dashboard-name)))
|
||||
|
||||
(defun +doom-dashboard-p (buffer)
|
||||
"Returns t if BUFFER is the dashboard buffer."
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
;; NOTE In :feature lookup `recenter' is hooked to a bunch of jumping
|
||||
;; commands, which will trigger nav-flash.
|
||||
(add-hook!
|
||||
'(doom-enter-window-hook
|
||||
'(doom-switch-window-hook
|
||||
imenu-after-jump-hook evil-jumps-post-jump-hook
|
||||
counsel-grep-post-action-hook dumb-jump-after-jump-hook)
|
||||
#'+nav-flash|blink-cursor-maybe)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue