From mboxrd@z Thu Jan 1 00:00:00 1970 From: Phil Hudson Subject: Bug: Capture template file source variant support in Customize [8.3.4 (8.3.4-47-gaf853d-elpa @ /home/phil/.emacs.d/elpa/org-20160502/)] Date: Sat, 07 May 2016 15:21:03 +0100 Message-ID: <87r3dehru8.fsf@quiz.hudson-it.ddns.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1az35m-0007Ox-5L for emacs-orgmode@gnu.org; Sat, 07 May 2016 10:20:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1az35i-0002w0-1o for emacs-orgmode@gnu.org; Sat, 07 May 2016 10:20:26 -0400 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:35823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1az35h-0002vm-O6 for emacs-orgmode@gnu.org; Sat, 07 May 2016 10:20:21 -0400 Received: by mail-wm0-x22e.google.com with SMTP id e201so87606521wme.0 for ; Sat, 07 May 2016 07:20:21 -0700 (PDT) Received: from quiz.hudson-it.ddns.net.quiz.hudson-it.ddns.net (82-71-5-38.dsl.in-addr.zen.co.uk. [82.71.5.38]) by smtp.gmail.com with ESMTPSA id s10sm20623893wjp.3.2016.05.07.07.20.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 May 2016 07:20:20 -0700 (PDT) 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 http://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org-mode mailing list. ------------------------------------------------------------------------ Expected: When using the Customize interface to create/edit an Org capture template, we expect to be able to specify a file to write the captured item into using (according to the documentation) any one of: * a literal filename * a function * a variable * a form But the Customize UI supports only the first of these. The attached patch adds Customize support for the other three variants, in the proper order (increasing generality/decreasing specificity). Note that using Lisp to specify a capture template's target file using a function, variable or sexp *does* work fine and as documented, except that thereafter Customize fails to present the resulting variable correctly; it reverts to showing the alist as one Lisp form. This patch simply "catches up" the Customize UI with what Org can do and is documented as doing. As a workaround, I fell back on using the alternative 'function' target specification method. That is, it's an alternative to 'file'; not to be confused with the 'function' sub-method of 'file'. It took some rooting around in source code for me to understand exactly what this function has to do. It has to visit a file and optionally move point. Overkill for my initial requirement, which was simply to produce a date-including filename, but I made it work*, rather than lose the Customize UI. Anyway, the documentation was too vague, and this patch also fixes that. I have signed the FSF papers. * pending your acceptance of this patch, at which point I can revert to the simpler filename-producing function I wanted to use initially. -- Phil Hudson http://hudson-it.ddns.net @UWascalWabbit PGP/GnuPG ID: 0x887DCA63 --- org-20160502/org-capture.el 2016-05-07 10:18:26.000000000 +0100 +++ org.patched/org-capture.el 2016-05-04 11:54:23.000000000 +0100 @@ -157,8 +157,8 @@ File to the entry that is currently being clocked (function function-finding-location) - Most general way, write your own function to find both - file and location + Most general way: write your own function which both visits the + file and moves point to the right location. template The template for creating the capture item. If you leave this empty, an appropriate default template will be used. See below @@ -299,7 +299,11 @@ (choice :tag "Target location" (list :tag "File" (const :format "" file) - (file :tag " File")) + (choice :tag " Filename" + (file :tag " Literal") + (function :tag " Function") + (variable :tag " Variable") + (sexp :tag " Form"))) (list :tag "ID" (const :format "" id) (string :tag " ID"))