From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Visher Subject: Re: [PATCH]: org-attach.el: Use `force' arg everywhere in `org-attach-delete-all' Date: Wed, 4 Mar 2020 13:27:07 -0500 Message-ID: References: <87d09sn4j1.fsf@kyleam.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="00000000000016b6eb05a00b9420" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:58187) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9YkO-00029v-7n for emacs-orgmode@gnu.org; Wed, 04 Mar 2020 13:27:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9YkN-0002xt-0R for emacs-orgmode@gnu.org; Wed, 04 Mar 2020 13:27:56 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:40216) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j9YkM-0002x3-Jr for emacs-orgmode@gnu.org; Wed, 04 Mar 2020 13:27:54 -0500 Received: by mail-wr1-x429.google.com with SMTP id r17so3677683wrj.7 for ; Wed, 04 Mar 2020 10:27:54 -0800 (PST) In-Reply-To: <87d09sn4j1.fsf@kyleam.com> 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: Kyle Meyer Cc: Emacs Org Mode mailing list --00000000000016b6eb05a00b9420 Content-Type: multipart/alternative; boundary="00000000000016b6e805a00b941e" --00000000000016b6e805a00b941e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Kyle, Thanks for feedback! ------------------------------------------ >From 626bd68a324cd65ba697dc1ccafdeff5808fd4c0 Mon Sep 17 00:00:00 2001 From: Tim Visher Date: Tue, 3 Mar 2020 09:14:44 -0500 Subject: [PATCH] org-attach.el: Use `force' arg everywhere in `org-attach-delete-all' MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * 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. T= his 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. TINYCHANGE --- lisp/org-attach.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/org-attach.el b/lisp/org-attach.el index 429d69021..57d1360fc 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -574,13 +574,18 @@ The attachment is created as an Emacs buffer." (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. + +With prefix argument FORCE, directory will be recursively deleted +with no prompts." (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) (message "Attachment directory removed") (run-hook-with-args 'org-attach-after-change-hook attach-dir) (org-attach-untag)))) -- 2.19.1 --00000000000016b6e805a00b941e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Kyle,

Thank= s for feedback!

=
------------------------------------------

From 626bd68a324cd65ba697dc1ccafdeff5808fd4c0 Mon Sep 17 00:00:00 20= 01
From: Tim Visher <tim.vish= er@gmail.com>
Date: Tue, 3 Mar 2020 09:14:44 -0500
Subject: [P= ATCH] org-attach.el: Use `force' arg everywhere in
=C2=A0`org-attach= -delete-all'
MIME-Version: 1.0
Content-Type: text/plain; charset= =3DUTF-8
Content-Transfer-Encoding: 8bit

* lisp/org-attach.el (or= g-attach-delete-all): Use `force' arg
throughout function.

`o= rg-attach-delete-all` advertised a `force` option but passing it
only fo= rced its way past the initial "Really remove all=E2=80=A6" query.= =C2=A0 This
was unexpected and not properly documented.

This exte= nds the use of the `force` argument to the `delete-directory`
call and d= ocuments its meaning in the docstring.

TINYCHANGE
---
=C2=A0li= sp/org-attach.el | 9 +++++++--
=C2=A01 file changed, 7 insertions(+), 2 = deletions(-)

diff --git a/lisp/org-attach.el b/lisp/org-attach.elindex 429d69021..57d1360fc 100644
--- a/lisp/org-attach.el
+++ b/lis= p/org-attach.el
@@ -574,13 +574,18 @@ The attachment is created as an Em= acs buffer."
=C2=A0(defun org-attach-delete-all (&optional forc= e)
=C2=A0 =C2=A0"Delete all attachments from the current outline no= de.
=C2=A0This actually deletes the entire attachment directory.
-A s= afer 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.
+<= br>+With prefix argument FORCE, directory will be recursively deleted
+w= ith no prompts."
=C2=A0 =C2=A0(interactive "P")
=C2=A0= =C2=A0(let ((attach-dir (org-attach-dir)))
=C2=A0 =C2=A0 =C2=A0(when (a= nd attach-dir
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(or= force
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(yes-or-no-p "Really remove all attachments of this entry? "= ;)))
- =C2=A0 =C2=A0 =C2=A0(delete-directory attach-dir (yes-or-no-p &qu= ot;Recursive?") t)
+ =C2=A0 =C2=A0 =C2=A0(delete-directory attach-d= ir
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (or force (yes-or-no-p "Recursive?"))
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 t)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0(message "Attachment directory removed"= ;)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(run-hook-with-args 'org-attach-after-= change-hook attach-dir)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(org-attach-untag))))=
--
2.19.1

--00000000000016b6e805a00b941e-- --00000000000016b6eb05a00b9420 Content-Type: application/octet-stream; name="0001-org-attach.el-Use-force-arg-everywhere-in-org-attach.patch" Content-Disposition: attachment; filename="0001-org-attach.el-Use-force-arg-everywhere-in-org-attach.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k7dnkwqu0 RnJvbSA2MjZiZDY4YTMyNGNkNjViYTY5N2RjMWNjYWZkZWZmNTgwOGZkNGMwIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBUaW0gVmlzaGVyIDx0aW0udmlzaGVyQGdtYWlsLmNvbT4KRGF0 ZTogVHVlLCAzIE1hciAyMDIwIDA5OjE0OjQ0IC0wNTAwClN1YmplY3Q6IFtQQVRDSF0gb3JnLWF0 dGFjaC5lbDogVXNlIGBmb3JjZScgYXJnIGV2ZXJ5d2hlcmUgaW4KIGBvcmctYXR0YWNoLWRlbGV0 ZS1hbGwnCk1JTUUtVmVyc2lvbjogMS4wCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNl dD1VVEYtOApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiA4Yml0CgoqIGxpc3Avb3JnLWF0dGFj aC5lbCAob3JnLWF0dGFjaC1kZWxldGUtYWxsKTogVXNlIGBmb3JjZScgYXJnCnRocm91Z2hvdXQg ZnVuY3Rpb24uCgpgb3JnLWF0dGFjaC1kZWxldGUtYWxsYCBhZHZlcnRpc2VkIGEgYGZvcmNlYCBv cHRpb24gYnV0IHBhc3NpbmcgaXQKb25seSBmb3JjZWQgaXRzIHdheSBwYXN0IHRoZSBpbml0aWFs ICJSZWFsbHkgcmVtb3ZlIGFsbOKApiIgcXVlcnkuICBUaGlzCndhcyB1bmV4cGVjdGVkIGFuZCBu b3QgcHJ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