Subject: Re: bug#45212: org-capture user-error: Abort

From: [email-masked]
Date: Sun, 13 Dec 2020 06:16:15 +0100

> Sent: Sunday, December 13, 2020 at 5:37 AM
> From: "Ihor Radchenko" <[email-masked]>
> To: [email-masked]
> Cc: [email-masked]
> Subject: bug#45212: org-capture user-error: Abort
>
> [email-masked] writes:
>
> > Can't one throw a capture abort signal instead?
>
> Sure, that is possible. However, consider a possibility that some
> external package wants to detect when capture is aborted. If I was
> writing such package, I would need to do something like
>
> (condition-case err
>  <run capture>
> (t <work around the "Abort" error>))
>
> If org-capture is rewritten using catch-throw, the above code would be
> broken. Also, there will be no easy way for a user to know if the
> capture was completed successfully or if it was aborted.

The problem is not the "Abort" itself, but more precisely "user-error",
rather than Abort.  I suppose that depends on how many packages on ELPA check
on "capture user-error".

> Note that I do not oppose this change too firmly. I agree that throw (or
> even just normal exit) would be cleaner. However, changing user-error to
> throw may break external packages and should be considered carefully. On
> the other hand, user-error is internal detail of the implementation. So,
> changing it should not be a big deal. As a precaution, it can be
> announced and implemented as a part of major release.
>
> If you want this change to happen, I suggest to provide the patch. This
> will encourage the maintainers to provide feedback.

It is not so much about imposing it, but it would make the whole thing cleaner
as you described.

> > What case scenarios would rely
> > on user quitting capture rather than going ahead with an entry?
>
> For example, I have a custom capture function from email. The email is
> removed from inbox upon capture. However, I would not want to proceed
> with removal if capture is aborted for whatever reason.

I see.   Still, I am not against signaling an abort.

> Best,
> Ihor