emacs/dired: replace 18f20a531 w/ 'quit-all' command #1937

There are a few workflows where having multiple buffers (e.g.
side-by-side) is preferrable, however, `dired-find-alternate-file` kills
the old buffer indiscriminately.
This commit is contained in:
Henrik Lissner 2019-10-26 13:39:52 -04:00
parent 311bdf100e
commit b0106e2ac7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 11 additions and 7 deletions

View file

@ -0,0 +1,8 @@
;;; emacs/dired/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +dired/quit-all ()
"Kill all `dired-mode' buffers."
(interactive)
(mapc #'kill-buffer (doom-buffers-in-mode 'dired-mode))
(message "Killed all dired buffers"))

View file

@ -49,14 +49,10 @@ only variant that supports --group-directories-first."
(put 'dired-find-alternate-file 'disabled nil) (put 'dired-find-alternate-file 'disabled nil)
(map! :map dired-mode-map (map! :map dired-mode-map
;; Kill buffer when quitting dired buffers ;; Kill all dired buffers on q
[remap quit-window] (λ! (quit-window t)) :ng "q" #'+dired/quit-all
;; To be consistent with ivy/helm+wgrep integration ;; To be consistent with ivy/helm+wgrep integration
"C-c C-e" #'wdired-change-to-wdired-mode "C-c C-e" #'wdired-change-to-wdired-mode))
;; Stop dired from creating new buffers when we enter a new directory or
;; travel up the tree
:n "RET" #'dired-find-alternate-file
:ng "^" (λ! (find-alternate-file ".."))))
(use-package! dired-rsync (use-package! dired-rsync