From 1ff37f9fa42b751342552ef42ef403dc41f50896 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 7 Sep 2024 13:56:23 -0400 Subject: [PATCH] fix(dired): preserve buffers on dirvish-find-entry-a Fix: #8038 --- modules/emacs/dired/config.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/emacs/dired/config.el b/modules/emacs/dired/config.el index f88f0c555..11e87aa24 100644 --- a/modules/emacs/dired/config.el +++ b/modules/emacs/dired/config.el @@ -124,6 +124,16 @@ Fixes #3939: unsortable dired entries on Windows." (setq dirvish-subtree-always-show-state t) (appendq! dirvish-attributes '(nerd-icons subtree-state))) + ;; HACK: Fixes #8038. Because `dirvish-reuse-session' is unset above, when + ;; walking a directory tree, previous dired buffers are killed along the + ;; way, which is jarring for folks who expect to be able to switch back to + ;; those buffers before their dired session ends. As long as we retain + ;; those, Dirvish will still clean them up on `dirvish-quit'. + (defadvice! +dired--retain-buffers-on-dirvish-find-entry-a (fn &rest args) + :around #'dirvish-find-entry-a + (let ((dirvish-reuse-session t)) + (apply fn args))) + ;; HACK: Makes `dirvish-hide-details' and `dirvish-hide-cursor' accept a list ;; of symbols to instruct Dirvish in what contexts they should be enabled. ;; The accepted values are: