org-gtd.el
org-gtd.el copied to clipboard
Error if WIP buffer is automatically saved
After installing the package during the attempt to submit changes to entries processed by org-gtd-organize
I get this error:
apply: Wrong number of arguments: (0 . 0), 3)
I found that (advice-add 'org-refile :after 'org-save-all-org-buffers)
in my init.el
was causing the issue.
Emacs was trying to save the WIP buffer, causing it to not close and thus failing the operation.
As another user suggested:
that sounds like something org-gtd should address: this function should not try to save a WIP buffer:
(defun org-id-locations-save ()
Issue found in Emacs 28.2. Org version 9.6.6
Had the same error and was searching way too long for the cause. Thank you for creating this issue.
I did a very quick test and it looks like if I make a new major mode derived from org-mode it won't be hit org-save-all-buffers
, so that's probably the right direction.
(define-derived-mode org-gtd-wip-mode org-mode "GTD-WIP"
"Goddamnit.")
I think the advice is in fault here, because it's reusing the arguments from org-refile and feeding them to org-save-all-org-buffers.
It should be something like this instead:
(advice-add 'org-refile :after #'(lambda (&rest _) (org-save-all-org-buffers)))
I imagine the advice works generally, otherwise they would have this issue when doing other refiling, wouldn't they?
On Thu, Jul 6, 2023 at 2:25 PM yetanotherfossman @.***> wrote:
I think the advice is in fault here, because it's reusing the arguments from org-refile and feeding them to org-save-all-org-buffers.
It should be something like this instead:
(advice-add 'org-refile :after #'(lambda (&rest _) (org-save-all-org-buffers)))
— Reply to this email directly, view it on GitHub https://github.com/Trevoke/org-gtd.el/issues/178#issuecomment-1624131833, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQSSKHSA23JI6WDNWH2TTXO37JPANCNFSM6AAAAAAYYQ37LM . You are receiving this because you commented.Message ID: <Trevoke/org-gtd. @.***>
It works as long as they use plain C-c C-w. Once they use any other command that calls org-refile under the hood, it will error out. For instance, in the StackExchange post the issue is that org-copy breaks.
@yetanotherfossman ah, you're absolutely correct, that auto-save blurb seems to be broken code; still, it doesn't mean me making a new major mode is bad idea... :)