From: Kyle Meyer <kyle@kyleam.com>
To: Luciano Passuello <lucianop@litemind.com>,
emacs-orgmode@gnu.org, eric@ericabrahamsen.net
Subject: Re: Bug: Archiving items with org-attach-archive-delete set to 'query' always asks for confirmation
Date: Fri, 10 Aug 2018 21:43:56 -0400 [thread overview]
Message-ID: <87zhxtr82r.fsf@kyleam.com> (raw)
In-Reply-To: <CACqKfLeq8PE+F1yLB0YzEf4CCVv+qib5f3G0Px06WtVxqgSpcg@mail.gmail.com>
Luciano Passuello <lucianop@litemind.com> writes:
> When I set org-attach-archive-delete to query, Org is supposed to ask
> me for confirmation when archiving entries with attachments. However,
> I am always asked for confirmation, regardless if the item has
> attachments in the first place. This is to me clearly undesirable
> behavior.
I agree, that doesn't sound desirable (though I've never used this
feature, so perhaps I'm missing something).
> Looking at the source code for org-attach, at line 573, that's indeed
> what code tells us.
> https://code.orgmode.org/bzg/org-mode/src/master/lisp/org-attach.el
>
> My uninformed suggestion is to call org-attach-delete-all without the
> force parameter, using the confirmation code already in
> org-attach-delete-all.
That would cover the org-attach-archive-delete=query case, but it'd also
ask for confirmation in the org-attach-archive-delete=t case.
How about this?
-- >8 --
Subject: [PATCH] org-attach: Don't query unnecessarily about archiving
* lisp/org-attach.el (org-attach-archive-delete-maybe): Don't query
about deleting attachments if the entry doesn't have any attachments.
---
lisp/org-attach.el | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index 192815f4f..53389f782 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -574,10 +574,8 @@ (defun org-attach-archive-delete-maybe ()
"Maybe delete subtree attachments when archiving.
This function is called by `org-archive-hook'. The option
`org-attach-archive-delete' controls its behavior."
- (when (if (eq org-attach-archive-delete 'query)
- (yes-or-no-p "Delete all attachments? ")
- org-attach-archive-delete)
- (org-attach-delete-all t)))
+ (when org-attach-archive-delete
+ (org-attach-delete-all (not (eq org-attach-archive-delete 'query)))))
\f
;; Attach from dired.
--
2.18.0
next prev parent reply other threads:[~2018-08-11 1:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-10 17:26 Bug: Archiving items with org-attach-archive-delete set to 'query' always asks for confirmation Luciano Passuello
2018-08-11 1:43 ` Kyle Meyer [this message]
2018-08-11 19:53 ` Luciano Passuello
2018-08-15 22:52 ` Kyle Meyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zhxtr82r.fsf@kyleam.com \
--to=kyle@kyleam.com \
--cc=emacs-orgmode@gnu.org \
--cc=eric@ericabrahamsen.net \
--cc=lucianop@litemind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).