* 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/)]
@ 2016-05-07 14:21 Phil Hudson
2016-05-10 21:21 ` Nicolas Goaziou
0 siblings, 1 reply; 3+ messages in thread
From: Phil Hudson @ 2016-05-07 14:21 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
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"))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: 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/)]
2016-05-07 14:21 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/)] Phil Hudson
@ 2016-05-10 21:21 ` Nicolas Goaziou
2016-05-10 22:12 ` Phil Hudson
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2016-05-10 21:21 UTC (permalink / raw)
To: Phil Hudson; +Cc: emacs-orgmode
Hello,
Phil Hudson <phil.hudson@iname.com> writes:
> 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.
Sounds good.
However, wouldn't it make sense to also add these types to other file
related target locations, e.g., "File & Headline", "File & Outline
path"... ?
Also, could you provide a patch using `git format-patch'?
Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: 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/)]
2016-05-10 21:21 ` Nicolas Goaziou
@ 2016-05-10 22:12 ` Phil Hudson
0 siblings, 0 replies; 3+ messages in thread
From: Phil Hudson @ 2016-05-10 22:12 UTC (permalink / raw)
To: emacs-orgmode
On Tue, 10 May 2016 at 10:21:12 pm BST, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Hello,
>
> Phil Hudson <phil.hudson@iname.com> writes:
>
>> 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.
>
> Sounds good.
>
> However, wouldn't it make sense to also add these types to other file
> related target locations, e.g., "File & Headline", "File & Outline
> path"... ?
Thanks for the perceptive feedback. I hadn't even thought about it. Your
suggestion definitely sounds like the right thing to do. I'll be back
with a fuller patch, properly gitted and committed.
--
Phil Hudson http://hudson-it.ddns.net
@UWascalWabbit PGP/GnuPG ID: 0x887DCA63
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-10 22:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-07 14:21 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/)] Phil Hudson
2016-05-10 21:21 ` Nicolas Goaziou
2016-05-10 22:12 ` Phil Hudson
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).