From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Visher Subject: [PATCH]: org-attach.el: Use `force' arg everywhere in `org-attach-delete-all' Date: Tue, 3 Mar 2020 09:24:33 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000c18b72059ff4125a" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:34863) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j98U6-0007P3-PB for emacs-orgmode@gnu.org; Tue, 03 Mar 2020 09:25:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j98U5-0007jd-HS for emacs-orgmode@gnu.org; Tue, 03 Mar 2020 09:25:22 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:38247) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j98U5-0007jO-82 for emacs-orgmode@gnu.org; Tue, 03 Mar 2020 09:25:21 -0500 Received: by mail-wr1-x435.google.com with SMTP id t11so4574630wrw.5 for ; Tue, 03 Mar 2020 06:25:20 -0800 (PST) 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: Emacs Org Mode mailing list --000000000000c18b72059ff4125a Content-Type: multipart/alternative; boundary="000000000000c18b6b059ff41258" --000000000000c18b6b059ff41258 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable >From 9a8abeee9109f24d8643990a561c16c8b402b1b1 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/org-attach.el b/lisp/org-attach.el index 429d69021..26099aab3 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -574,13 +574,17 @@ 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. + +If FORCE is truthy, 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)))) --=20 2.19.1 --000000000000c18b6b059ff41258 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
From 9a8abeee9109f24d8643990a561c16c8b402b1b1 Mon Sep 17 0= 0:00:00 2001
From: Tim Visher <tim.visher@gmail.com>
Date: Tue, 3 Mar 2020 09:14:44 -0500
S= ubject: [PATCH] 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-atta= ch.el (org-attach-delete-all): Use `force' arg
throughout function.<= br>
`org-attach-delete-all` advertised a `force` option but passing itonly forced its way past the initial "Really remove all=E2=80=A6&quo= t; query.=C2=A0 This
was unexpected and not properly documented.

= This extends the use of the `force` argument to the `delete-directory`
c= all and documents its meaning in the docstring.

TINYCHANGE
---=C2=A0lisp/org-attach.el | 8 ++++++--
=C2=A01 file changed, 6 insertion= s(+), 2 deletions(-)

diff --git a/lisp/org-attach.el b/lisp/org-atta= ch.el
index 429d69021..26099aab3 100644
--- a/lisp/org-attach.el
+= ++ b/lisp/org-attach.el
@@ -574,13 +574,17 @@ The attachment is created = as an Emacs buffer."
=C2=A0(defun org-attach-delete-all (&optio= nal force)
=C2=A0 =C2=A0"Delete all attachments from the current ou= tline node.
=C2=A0This actually deletes the entire attachment directory.=
-A safer way is to open the directory in dired and delete from there.&q= uot;
+A safer way is to open the directory in dired and delete from ther= e.
+
+If FORCE is truthy, directory will be recursively deleted with = 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 (or force
=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 "Rec= ursive?") t)
+ =C2=A0 =C2=A0 =C2=A0(delete-directory attach-dir (or= force
+ =C2=A0 =C2=A0 =C2=A0 (yes-or-no-p "Recursive?")) = t)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(message "Attachment directory remove= d")
=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-unt= ag))))
--
2.19.1

--000000000000c18b6b059ff41258-- --000000000000c18b72059ff4125a 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_k7bzh3er0 RnJvbSA5YThhYmVlZTkxMDlmMjRkODY0Mzk5MGE1NjFjMTZjOGI0MDJiMWIxIE1vbiBTZXAgMTcg MDA6MDA6MDAg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