From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#28373: [PATCH] New variable controls whether dired confirms to kill buffers visiting deleted files Date: Wed, 06 Sep 2017 19:36:48 +0300 Message-ID: <83ingv238f.fsf@gnu.org> References: <87r2vjkf4i.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1504715911 30957 195.159.176.226 (6 Sep 2017 16:38:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 6 Sep 2017 16:38:31 +0000 (UTC) Cc: 28373@debbugs.gnu.org To: Alex Branham Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 06 18:38:27 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpdL7-0007AP-U9 for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Sep 2017 18:38:10 +0200 Original-Received: from localhost ([::1]:37103 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpdLF-0001Fj-1L for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Sep 2017 12:38:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpdL6-0001DF-7F for bug-gnu-emacs@gnu.org; Wed, 06 Sep 2017 12:38:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpdL0-0004Qu-F1 for bug-gnu-emacs@gnu.org; Wed, 06 Sep 2017 12:38:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44579) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dpdL0-0004QY-AF for bug-gnu-emacs@gnu.org; Wed, 06 Sep 2017 12:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dpdL0-0006Br-1w for bug-gnu-emacs@gnu.org; Wed, 06 Sep 2017 12:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Sep 2017 16:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28373 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 28373-submit@debbugs.gnu.org id=B28373.150471582323716 (code B ref 28373); Wed, 06 Sep 2017 16:38:02 +0000 Original-Received: (at 28373) by debbugs.gnu.org; 6 Sep 2017 16:37:03 +0000 Original-Received: from localhost ([127.0.0.1]:53260 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpdK3-0006AS-6I for submit@debbugs.gnu.org; Wed, 06 Sep 2017 12:37:03 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33377) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpdK1-00069x-F2 for 28373@debbugs.gnu.org; Wed, 06 Sep 2017 12:37:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpdJp-0001pd-7l for 28373@debbugs.gnu.org; Wed, 06 Sep 2017 12:36:56 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpdJp-0001pD-4H; Wed, 06 Sep 2017 12:36:49 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4875 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dpdJo-0006h8-DC; Wed, 06 Sep 2017 12:36:49 -0400 In-reply-to: <87r2vjkf4i.fsf@gmail.com> (message from Alex Branham on Wed, 06 Sep 2017 10:42:37 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:136640 Archived-At: > From: Alex Branham > Date: Wed, 06 Sep 2017 10:42:37 -0500 > > This is a patch to include a new variable that, when set to nil, makes dired kill buffers visiting deleted files without confirmation. > > There are apparently some people interested in this: > > https://emacs.stackexchange.com/questions/30676/how-to-always-kill-dired-buffer-when-deleting-a-folder > > I read through the CONTRIBUTE file, but please let me know if something is wrong with the commit message and I can redo it. Thanks. A few comments: > * lisp/dired-x.el (dired-clean-confirm-killing-deleted-buffers): > * lisp/dired.el (dired-clean-up-after-deletion): Just kill buffers > visiting deleted files without confirming if > dired-clean-confirm-killing-deleted-buffers is nil This log entry makes it sound as if similar changes were made in both dired.el and dired-x.el, which is not what your changes do. The entry for dired-x.el should only say this: * lisp/dired-x.el (dired-clean-confirm-killing-deleted-buffers): New variable. > diff --git a/lisp/dired.el b/lisp/dired.el > index ff62183f09..bac3933502 100644 > --- a/lisp/dired.el > +++ b/lisp/dired.el > @@ -3164,28 +3164,34 @@ dired-delete-entry > (dired-clean-up-after-deletion file)) > > (defvar dired-clean-up-buffers-too) > +(defvar dired-clean-confirm-killing-deleted-buffers) Why did you need this defvar? > (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, > +also offers to kill buffers visiting deleted files and > +directories. Similarly, if `dired-x' is loaded and > +`dired-clean-confirm-killing-deleted-buffers is nil, kill the > +buffers without asking.'" We use the US English convention of leaving 2 spaces between sentences. Also, I'd simplify the last sentence to avoid repeating what the previous one says, and perhaps even make one sentence out of the two. > (save-excursion (and (cdr dired-subdir-alist) > - (dired-goto-subdir fn) > - (dired-kill-subdir))) > + (dired-goto-subdir fn) > + (dired-kill-subdir))) Please don't change whitespace where you aren't changing code. > + (or (not dired-clean-confirm-killing-deleted-buffers) > + (funcall #'y-or-n-p > + (format "Kill buffer of %s, too? " > + (file-name-nondirectory fn)))) Isn't it better to use this instead: (and dired-clean-confirm-killing-deleted-buffers (funcall ... ? What you wrote is akin to double negation, IMO. Thanks again for working on this.