So, I managed to get my headline retrieval function fixed, so now the function searches and finds my header lines, but when I select the one I want to use.. it oddly throws back this apply: Wrong number of arguments: (0 . 0), 4
error. I am using Doom Emacs and org-mode v9.6 in Doom Emacs (showing in screenshot). Anyone know what's going on with the function?
Doom Version:
doom version
> Executing 'doom version' with Emacs 27.2 at 2022-03-25 10:31:00
GNU Emacs v27.2 nil
Doom core v3.0.0-dev HEAD -> master aed2972d 2022-03-22 02:49:09 +0100
Doom modules v22.03.0-dev HEAD -> master aed2972d 2022-03-22 02:49:09 +0100
I'm using
doom upgrade
to upgrade the packages and Doom Emacs, I'm unsure where Doom Emacs is getting the updates, I just know that running doom upgrade
updates itself and the packages.
The function + org template
("aa" "Assignments" entry
(file+function "~/sync/org/Assignments.org" org-get-target-headline)
"\n*TODO %? %<%I:%M %p> - n"
;; ,(dw/read-file-as-string "~/Notes/Templates/Daily.org")
:clock-in :clock-resume
:empty-lines 1)
....
(defun org-get-target-headline (&optional targets prompt)
"Prompt for a location in an org file and jump to it.
This is for prompting for refile targets when doing captures.
Targets are selected from `org-refile-targets'. If TARGETS is
given it temporarily overrides `org-refile-targets'. PROMPT will
replace the default prompt message.
If CAPTURE-LOC is is given, capture to that location instead of
prompting."
(let ((org-refile-targets (or targets org-refile-targets))
(prompt (or prompt "Capture Location")))
(org-refile t nil nil prompt)))
Error from Emacs Debugger:
Debugger entered--Lisp error: (wrong-number-of-arguments (0 . 0) 4)
org-save-all-org-buffers(t nil nil "Capture Location")
apply(org-save-all-org-buffers (t nil nil "Capture Location"))
org-refile(t nil nil "Capture Location")
(let ((org-refile-targets (or targets org-refile-targets)) (prompt (or prompt "Capture Location"))) (org-refile t nil nil prompt))
org-get-target-headline()
org-capture-set-target-location(nil)
#f(compiled-function (&optional goto keys) "Capture something.\n\\<org-capture-mode-map>\nThis will let you select a template from `org-capture-templates', and\nthen file the newly captured information. The text is immediately\ninserted at the target location, and an indirect buffer is shown where\nyou can edit it. Pressing `\\[org-capture-finalize]' brings you back to the previous\nstate of Emacs, so that you can continue your work.\n\nWhen called interactively with a `\\[universal-argument]' prefix argument GOTO, don't\ncapture anything, just go to the file/headline where the selected\ntemplate stores its notes.\n\nWith a `\\[universal-argument] \\[universal-argument]' prefix argument, go to the last note stored.\n\nWhen called with a `C-0' (zero) prefix, insert a template at point.\n\nWhen called with a `C-1' (one) prefix, force prompting for a date when\na datetree entry is made.\n\nELisp programs can set KEYS to a string associated with a template\nin `org-capture-templates'. In this case, interactive selection\nwill be bypassed.\n\nIf `org-capture-use-agenda-date' is non-nil, capturing from the\nagenda will use the date at point as the default date. Then, a\n`C-1' prefix will tell the capture process to use the HH:MM time\nof the day at point (if any) or the current HH:MM time." (interactive "P") #<bytecode 0x1567eda85bd5>)(nil)
apply(#f(compiled-function (&optional goto keys) "Capture something.\n\\<org-capture-mode-map>\nThis will let you select a template from `org-capture-templates', and\nthen file the newly captured information. The text is immediately\ninserted at the target location, and an indirect buffer is shown where\nyou can edit it. Pressing `\\[org-capture-finalize]' brings you back to the previous\nstate of Emacs, so that you can continue your work.\n\nWhen called interactively with a `\\[universal-argument]' prefix argument GOTO, don't\ncapture anything, just go to the file/headline where the selected\ntemplate stores its notes.\n\nWith a `\\[universal-argument] \\[universal-argument]' prefix argument, go to the last note stored.\n\nWhen called with a `C-0' (zero) prefix, insert a template at point.\n\nWhen called with a `C-1' (one) prefix, force prompting for a date when\na datetree entry is made.\n\nELisp programs can set KEYS to a string associated with a template\nin `org-capture-templates'. In this case, interactive selection\nwill be bypassed.\n\nIf `org-capture-use-agenda-date' is non-nil, capturing from the\nagenda will use the date at point as the default date. Then, a\n`C-1' prefix will tell the capture process to use the HH:MM time\nof the day at point (if any) or the current HH:MM time." (interactive "P") #<bytecode 0x1567eda85bd5>) nil)
(let ((+file-templates-inhibit t)) (apply fn args))
+file-templates-inhibit-in-org-capture-a(#f(compiled-function (&optional goto keys) "Capture something.\n\\<org-capture-mode-map>\nThis will let you select a template from `org-capture-templates', and\nthen file the newly captured information. The text is immediately\ninserted at the target location, and an indirect buffer is shown where\nyou can edit it. Pressing `\\[org-capture-finalize]' brings you back to the previous\nstate of Emacs, so that you can continue your work.\n\nWhen called interactively with a `\\[universal-argument]' prefix argument GOTO, don't\ncapture anything, just go to the file/headline where the selected\ntemplate stores its notes.\n\nWith a `\\[universal-argument] \\[universal-argument]' prefix argument, go to the last note stored.\n\nWhen called with a `C-0' (zero) prefix, insert a template at point.\n\nWhen called with a `C-1' (one) prefix, force prompting for a date when\na datetree entry is made.\n\nELisp programs can set KEYS to a string associated with a template\nin `org-capture-templates'. In this case, interactive selection\nwill be bypassed.\n\nIf `org-capture-use-agenda-date' is non-nil, capturing from the\nagenda will use the date at point as the default date. Then, a\n`C-1' prefix will tell the capture process to use the HH:MM time\nof the day at point (if any) or the current HH:MM time." (interactive "P") #<bytecode 0x1567eda85bd5>) nil)
apply(+file-templates-inhibit-in-org-capture-a #f(compiled-function (&optional goto keys) "Capture something.\n\\<org-capture-mode-map>\nThis will let you select a template from `org-capture-templates', and\nthen file the newly captured information. The text is immediately\ninserted at the target location, and an indirect buffer is shown where\nyou can edit it. Pressing `\\[org-capture-finalize]' brings you back to the previous\nstate of Emacs, so that you can continue your work.\n\nWhen called interactively with a `\\[universal-argument]' prefix argument GOTO, don't\ncapture anything, just go to the file/headline where the selected\ntemplate stores its notes.\n\nWith a `\\[universal-argument] \\[universal-argument]' prefix argument, go to the last note stored.\n\nWhen called with a `C-0' (zero) prefix, insert a template at point.\n\nWhen called with a `C-1' (one) prefix, force prompting for a date when\na datetree entry is made.\n\nELisp programs can set KEYS to a string associated with a template\nin `org-capture-templates'. In this case, interactive selection\nwill be bypassed.\n\nIf `org-capture-use-agenda-date' is non-nil, capturing from the\nagenda will use the date at point as the default date. Then, a\n`C-1' prefix will tell the capture process to use the HH:MM time\nof the day at point (if any) or the current HH:MM time." (interactive "P") #<bytecode 0x1567eda85bd5>) nil)
org-capture(nil)
#<subr funcall-interactively>(org-capture nil)
apply(#<subr funcall-interactively> (org-capture nil))
funcall-interactively(org-capture nil)
#<subr call-interactively>(org-capture record nil)
apply(#<subr call-interactively> (org-capture record nil))
explain-pause--wrap-call-interactively(#<subr call-interactively> org-capture record nil)
apply(explain-pause--wrap-call-interactively #<subr call-interactively> (org-capture record nil))
call-interactively(org-capture record nil)
command-execute(org-capture record)
execute-extended-command(nil "org-capture" nil)
#<subr funcall-interactively>(execute-extended-command nil "org-capture" nil)
apply(#<subr funcall-interactively> (execute-extended-command nil "org-capture" nil))
funcall-interactively(execute-extended-command nil "org-capture" nil)
#<subr call-interactively>(execute-extended-command nil nil)
apply(#<subr call-interactively> (execute-extended-command nil nil))
explain-pause--wrap-call-interactively(#<subr call-interactively> execute-extended-command nil nil)
apply(explain-pause--wrap-call-interactively #<subr call-interactively> (execute-extended-command nil nil))
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
Edit:
I took out the t variable and now the error is that prompt
is a void.
(defun org-get-target-headline (&optional targets prompt)
"Prompt for a location in an org file and jump to it.
This is for promping for refile targets when doing captures.
Targets are selected from `org-refile-targets'. If TARGETS is
given it temporarily overrides `org-refile-targets'. PROMPT will
replace the default prompt message.
If CAPTURE-LOC is is given, capture to that location instead of
prompting."
(let ((org-refile-targets (or targets org-refile-targets))
(prompt (or prompt "Capture Location")))
(org-refile nil nil prompt)))
org-save-all-org-buffers
gets called with the 4 arguments that were passed toorg-refile
. However, I can not find why because I can not find the(apply org-save-all-org-buffers ...)
in the code base of org 9.5.2 (which is the version I am using). Maybe update yourorg
first...org-refile
function (edebug is simple and powerful). Or maybe search/(rz)grep your code-base forapply org-save-all-org-buffers
.9.5.2 (release_9.5.2-409-gc5ea19)
. And as of 2022/03/24, I had not seen an announcement on the ML. Maybe the OP can tell us where/how they got the update.