mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-02 08:22:22 +00:00
New variable 'dired-confirm-killing-deleted-buffers'
* lisp/dired-x.el (dired-clean-confirm-killing-deleted-buffers): New variable. * lisp/dired.el (dired-clean-up-after-deletion): Kill buffers visiting deleted files without confirming if dired-clean-confirm-killing-deleted-buffers is nil. (Bug#28373) * etc/NEWS: Document the change. Copyright-paperwork-exempt: yes
This commit is contained in:
parent
9b9c93053a
commit
5f31879e16
6
etc/NEWS
6
etc/NEWS
@ -604,6 +604,12 @@ this is controlled by the 'wdired-create-parent-directories' variable.
|
||||
*** 'W' is now bound to 'browse-url-of-dired-file', and is useful for
|
||||
viewing HTML files and the like.
|
||||
|
||||
---
|
||||
*** New variable 'dired-clean-confirm-killing-deleted-buffers'
|
||||
controls whether Dired asks to kill buffers visiting deleted files and
|
||||
directories. The default is t, so Dired asks for confirmation, to
|
||||
keep previous behavior.
|
||||
|
||||
---
|
||||
** html2text is now marked obsolete.
|
||||
|
||||
|
@ -243,6 +243,12 @@ to nil: a pipe using `zcat' or `gunzip -c' will be used."
|
||||
:type 'boolean
|
||||
:group 'dired-x)
|
||||
|
||||
(defcustom dired-clean-confirm-killing-deleted-buffers t
|
||||
"If nil, don't ask whether to kill buffers visiting deleted files."
|
||||
:version "26.1"
|
||||
:type 'boolean
|
||||
:group 'dired-x)
|
||||
|
||||
;;; KEY BINDINGS.
|
||||
|
||||
(define-key dired-mode-map "\C-x\M-o" 'dired-omit-mode)
|
||||
|
@ -3180,12 +3180,15 @@ non-empty directories is allowed."
|
||||
(dired-clean-up-after-deletion file))
|
||||
|
||||
(defvar dired-clean-up-buffers-too)
|
||||
(defvar dired-clean-confirm-killing-deleted-buffers)
|
||||
|
||||
(defun dired-clean-up-after-deletion (fn)
|
||||
"Clean up after a deleted file or directory FN.
|
||||
Removes any expanded subdirectory of deleted directory.
|
||||
If `dired-x' is loaded and `dired-clean-up-buffers-too' is non-nil,
|
||||
also offers to kill buffers visiting deleted files and directories."
|
||||
Removes any expanded subdirectory of deleted directory. If
|
||||
`dired-x' is loaded and `dired-clean-up-buffers-too' is non-nil,
|
||||
kill any buffers visiting those files, prompting for
|
||||
confirmation. To disable the confirmation, see
|
||||
`dired-clean-confirm-killing-deleted-buffers'."
|
||||
(save-excursion (and (cdr dired-subdir-alist)
|
||||
(dired-goto-subdir fn)
|
||||
(dired-kill-subdir)))
|
||||
@ -3193,15 +3196,17 @@ also offers to kill buffers visiting deleted files and directories."
|
||||
(when (and (featurep 'dired-x) dired-clean-up-buffers-too)
|
||||
(let ((buf (get-file-buffer fn)))
|
||||
(and buf
|
||||
(funcall #'y-or-n-p
|
||||
(format "Kill buffer of %s, too? "
|
||||
(file-name-nondirectory fn)))
|
||||
(and dired-clean-confirm-killing-deleted-buffers
|
||||
(funcall #'y-or-n-p
|
||||
(format "Kill buffer of %s, too? "
|
||||
(file-name-nondirectory fn))))
|
||||
(kill-buffer buf)))
|
||||
(let ((buf-list (dired-buffers-for-dir (expand-file-name fn))))
|
||||
(and buf-list
|
||||
(y-or-n-p (format "Kill Dired buffer%s of %s, too? "
|
||||
(dired-plural-s (length buf-list))
|
||||
(file-name-nondirectory fn)))
|
||||
(and dired-clean-confirm-killing-deleted-buffers
|
||||
(y-or-n-p (format "Kill Dired buffer%s of %s, too? "
|
||||
(dired-plural-s (length buf-list))
|
||||
(file-name-nondirectory fn))))
|
||||
(dolist (buf buf-list)
|
||||
(kill-buffer buf))))))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user