From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-ID: <87r219zf2f.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:48936) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifRHd-0008Ga-0u for emacs-orgmode@gnu.org; Thu, 12 Dec 2019 11:25:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifRHb-00048Q-Kr for emacs-orgmode@gnu.org; Thu, 12 Dec 2019 11:25:44 -0500 Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]:36284) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifRHb-000471-Gn for emacs-orgmode@gnu.org; Thu, 12 Dec 2019 11:25:43 -0500 Received: by mail-qk1-x729.google.com with SMTP id a203so2095479qkc.3 for ; Thu, 12 Dec 2019 08:25:43 -0800 (PST) Received: from arch (c-69-141-147-3.hsd1.nj.comcast.net. [69.141.147.3]) by smtp.gmail.com with ESMTPSA id p14sm2313743qtq.97.2019.12.12.08.25.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2019 08:25:40 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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/)