* Bug: Archiving items with org-attach-archive-delete set to 'query' always asks for confirmation
@ 2018-08-10 17:26 Luciano Passuello
2018-08-11 1:43 ` Kyle Meyer
0 siblings, 1 reply; 4+ messages in thread
From: Luciano Passuello @ 2018-08-10 17:26 UTC (permalink / raw)
To: emacs-orgmode
Hello,
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.
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.
Unfortunately, I'm not skilled enough in Elisp or knowledgeable in Org
source code to provide a reasonable patch.
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug: Archiving items with org-attach-archive-delete set to 'query' always asks for confirmation
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
2018-08-11 19:53 ` Luciano Passuello
0 siblings, 1 reply; 4+ messages in thread
From: Kyle Meyer @ 2018-08-11 1:43 UTC (permalink / raw)
To: Luciano Passuello, emacs-orgmode, eric
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Bug: Archiving items with org-attach-archive-delete set to 'query' always asks for confirmation
2018-08-11 1:43 ` Kyle Meyer
@ 2018-08-11 19:53 ` Luciano Passuello
2018-08-15 22:52 ` Kyle Meyer
0 siblings, 1 reply; 4+ messages in thread
From: Luciano Passuello @ 2018-08-11 19:53 UTC (permalink / raw)
To: kyle; +Cc: eric, Luciano Passuello, emacs-orgmode
Hello Kyle,
That worked perfectly for all my basic test cases.
Thanks!
On Fri, Aug 10, 2018 at 10:44 PM Kyle Meyer <kyle@kyleam.com> wrote:
>
> 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)))))
>
>
> ;; Attach from dired.
> --
> 2.18.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug: Archiving items with org-attach-archive-delete set to 'query' always asks for confirmation
2018-08-11 19:53 ` Luciano Passuello
@ 2018-08-15 22:52 ` Kyle Meyer
0 siblings, 0 replies; 4+ messages in thread
From: Kyle Meyer @ 2018-08-15 22:52 UTC (permalink / raw)
To: Luciano Passuello; +Cc: eric, emacs-orgmode
Luciano Passuello <lucianop@litemind.com> writes:
> Hello Kyle,
>
> That worked perfectly for all my basic test cases.
Great, pushed to master as ab1f7712d.
--
Kyle
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-15 22:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2018-08-11 19:53 ` Luciano Passuello
2018-08-15 22:52 ` Kyle Meyer
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.