* Bug: org-capture-get-template can't use a lambda for template function. [9.2.6 (9.2.6-7-g634880-elpaplus @ /home/n/.emacs.d/elpa/org-plus-contrib-20191118/)]
@ 2019-12-12 16:25 No Wayman
2019-12-12 21:36 ` Nicolas Goaziou
0 siblings, 1 reply; 2+ messages in thread
From: No Wayman @ 2019-12-12 16:25 UTC (permalink / raw)
To: emacs-orgmode
Remember to cover the basics, that is, what you expected to happen
and
what in fact did happen. You don't know how to make a good
report? See
https://orgmode.org/manual/Feedback.html#Feedback
Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------
Noticed that one cannot use a lambda function as a template
generating function.
Doing so results in the error:
Wrong type argument: symbolp, (lambda...)
The cause is the fboundp check in org-capture-get-template.
Changing this to functionp allows a lambda to be specified and is
consistent with what org-capture-set-target-location allows.
I'm not sure if there are any corner cases I'm unaware of, but it
seems like a simple patch:
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index ef3561563..a8a4e1e89 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -706,7 +706,7 @@ of the day at point (if any) or the current
HH:MM time."
(setq txt (org-file-contents file))
(setq txt (format "* Template file %s not found" (nth 1 txt)))))
((and (listp txt) (eq (car txt) 'function))
- (if (fboundp (nth 1 txt))
+ (if (functionp (nth 1 txt))
(setq txt (funcall (nth 1 txt)))
(setq txt (format "* Template function %s not found" (nth 1
txt)))))
((not txt) (setq txt ""))
Thanks,
nv
Emacs : GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, X
toolkit, cairo version 1.17.3, Xaw3d scroll bars)
of 2019-12-10
Package: Org mode version 9.2.6 (9.2.6-7-g634880-elpaplus @
/home/n/.emacs.d/elpa/org-plus-contrib-20191118/)
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-12 21:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-12 16:25 Bug: org-capture-get-template can't use a lambda for template function. [9.2.6 (9.2.6-7-g634880-elpaplus @ /home/n/.emacs.d/elpa/org-plus-contrib-20191118/)] No Wayman
2019-12-12 21:36 ` Nicolas Goaziou
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).