From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kyle Meyer Subject: Re: [PATCH]: org-attach.el: Use `force' arg everywhere in `org-attach-delete-all' Date: Wed, 04 Mar 2020 04:10:58 +0000 Message-ID: <87d09sn4j1.fsf@kyleam.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:46876) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9LNC-0003Mw-Hw for emacs-orgmode@gnu.org; Tue, 03 Mar 2020 23:11:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9LNB-0003aU-2b for emacs-orgmode@gnu.org; Tue, 03 Mar 2020 23:11:06 -0500 Received: from pb-smtp21.pobox.com ([173.228.157.53]:56387) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9LNA-0003XG-P1 for emacs-orgmode@gnu.org; Tue, 03 Mar 2020 23:11:05 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: Tim Visher , Emacs Org Mode mailing list Tim Visher writes: > * lisp/org-attach.el (org-attach-delete-all): Use `force' arg > throughout function. > > `org-attach-delete-all` advertised a `force` option but passing it > only forced its way past the initial "Really remove all=E2=80=A6" query. = This > was unexpected and not properly documented. > > This extends the use of the `force` argument to the `delete-directory` > call and documents its meaning in the docstring. Sounds reasonable to me. > (defun org-attach-delete-all (&optional force) > "Delete all attachments from the current outline node. > This actually deletes the entire attachment directory. > -A safer way is to open the directory in dired and delete from there." > +A safer way is to open the directory in dired and delete from there. > + > +If FORCE is truthy, directory will be recursively deleted with no > +prompts." While I think any reader would know what you meant by "truthy", "non-nil" would be more standard/familiar in the context of elisp docstrings. Or, given this is an interactive command, "With prefix argument FORCE" or something along those lines. > (interactive "P") > (let ((attach-dir (org-attach-dir))) > (when (and attach-dir > (or force > (yes-or-no-p "Really remove all attachments of this entry? "))) > - (delete-directory attach-dir (yes-or-no-p "Recursive?") t) > + (delete-directory attach-dir (or force > + (yes-or-no-p "Recursive?")) t) With Emacs 25 or newer and the default font-lock levels, you should see "t)" highlighted with font-lock-warning-face because t is "hidden behind a deeper element". You could fix it by moving t to its own line, but to my eyes keeping the entire delete-directory on a single line would be readable enough. Thanks.