From 8f325d53eb536dcf5a4dcafaa5c32e8443dd7d7d Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Wed, 4 Feb 2026 16:42:10 -0500 Subject: [PATCH] fix(dirvish): allow proper buffer switching --- config.org | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/config.org b/config.org index 76d3734..4d25dbe 100644 --- a/config.org +++ b/config.org @@ -4207,6 +4207,29 @@ If a side session is open, we'll configure =winum= to give it the index ~(popup\ (push #'~/winum-dirvish-side winum-assign-functions)) #+end_src +*** Bug Fixes + +**** Buffer Switching + +When a full-frame =dirvish= display is switched out of using ~switch-to-buffer~, the fact that Dirvish's buffer is dedicated prevents the switch from working properly. We can fix this by advising that function to clear the =dirvish= session when necessary. + +#+begin_src emacs-lisp +(defadvice! ~/switch-to-buffer-dirvish-clear (&rest _) + :before #'switch-to-buffer + (when (featurep 'dirvish) + (when-let ((dv (dirvish-curr))) + (dirvish--clear-session dv)))) + +;;(defadvice! ~/kill-buffer-dirvish-clear (old-fn buffer-or-name) +;; :around #'kill-buffer +;; (when (featurep 'dirvish) +;; (if-let ((dv (dirvish-curr))) +;; (dirvish--clear-session dv) +;; (if )))) +#+end_src + +The optional ~from-quit~ argument on the session clear function is not set, indicating that this switch is not to be treated as a quit-out, and the session will possibly be reused accordingly. + ** Emacs Lisp #+call: confpkg("Mode: Emacs Lisp")