You added org-save-all-org-buffers
as :after
advice of org-deadline
. The documentation of org-save-all-org-buffers
says that it is an interactive function without arguments. But org-deadline
has one obligatory argument which is deduced from the prefix-arg in interactive calls.
So you advise an interactive function with an interactive function.
The documentation of add-function
, which is also valid for advice-add
, says:
If one of FUNCTION or OLDFUN is interactive, then the resulting function is also interactive. There are 3 cases:
- FUNCTION is not interactive: the interactive spec of OLDFUN is used.
- The interactive spec of FUNCTION is itself a function: it should take one argument (the interactive spec of OLDFUN, which it can pass to ‘advice-eval-interactive-spec’) and return the list of arguments to use.
- Else, use the interactive spec of FUNCTION and ignore the one of OLDFUN.
The third case is relevant for you. The interactive spec of the advising function org-save-all-org-buffers
is used for org-deadline
which is wrong since it does not supply the required argument.
If you want an :after
-advice working for all interactive functions you can use the &rest
keyword in the definition of the advising function to ignore all arguments:
(defun my-org-save-all-org-buffers (&rest _ignore)
"Apply `org-save-all-org-buffers' ignoring all arguments."
(org-save-all-org-buffers))
(advice-add 'org-deadline :after #'my-org-save-all-org-buffers)
User quantum285 found the error himself after some help from me.
The following comment from me was a full hit:
call-interactively uses interactive-form to determine how the user should be queried for the arguments of the command. That fails in the above backtrace. funcall-interactively is called with the command name as its only argument. Please, call M-: (interactive-form 'org-deadline) and report the result. It should be (interactive "P") but I assume that it is just (interactive) in your case which is wrong.
When quantum285 acknowledged that, I asked him to add the full help string of org-deadline
to his question since I knew that the advice system adds advice information to that doc string.
After reading the doc string of org-deadline
user quantum285 identified the advice with org-save-all-org-buffers
as the culprit.
He asked me add an answer with the root cause of the problem. There we are...