emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug: org-capture-get-template can't use a lambda for template function.


From: No Wayman
Subject: 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/)]
Date: Thu, 12 Dec 2019 11:25:28 -0500
User-agent: mu4e 1.3.5; emacs 27.0.50


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/)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]