emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH]: org-attach.el: Use `force' arg everywhere in `org-attach-de


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

Hi Kyle,

Thanks for feedback!

------------------------------------------

From 626bd68a324cd65ba697dc1ccafdeff5808fd4c0 Mon Sep 17 00:00:00 2001
From: Tim Visher <address@hidden>
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=UTF-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…" 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.

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

Attachment: 0001-org-attach.el-Use-force-arg-everywhere-in-org-attach.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]