fix: set jump points on more kill-buffer functions

Close: #7643
Co-authored-by: LemonBreezes <LemonBreezes@users.noreply.github.com>
This commit is contained in:
Henrik Lissner 2024-08-25 17:13:09 -04:00
parent fac979c6d8
commit ea97adf9c7
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -486,7 +486,8 @@ files, so this replace calls to `pp' with the much faster `prin1'."
(defun doom-set-jump-h () (defun doom-set-jump-h ()
"Run `better-jumper-set-jump' but return nil, for short-circuiting hooks." "Run `better-jumper-set-jump' but return nil, for short-circuiting hooks."
(better-jumper-set-jump) (when (get-buffer-window)
(better-jumper-set-jump))
nil) nil)
;; Creates a jump point before killing a buffer. This allows you to undo ;; Creates a jump point before killing a buffer. This allows you to undo
@ -495,7 +496,7 @@ files, so this replace calls to `pp' with the much faster `prin1'."
;; ;;
;; I'm not advising `kill-buffer' because I only want this to affect ;; I'm not advising `kill-buffer' because I only want this to affect
;; interactively killed buffers. ;; interactively killed buffers.
(advice-add #'kill-current-buffer :around #'doom-set-jump-a) (add-hook 'kill-buffer-hook #'doom-set-jump-h)
;; Create a jump point before jumping with imenu. ;; Create a jump point before jumping with imenu.
(advice-add #'imenu :around #'doom-set-jump-a)) (advice-add #'imenu :around #'doom-set-jump-a))