emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix `org-capture-templates' type declaration
@ 2015-10-24 17:43 Grégoire Jadi
  2015-10-25  8:40 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Grégoire Jadi @ 2015-10-24 17:43 UTC (permalink / raw)
  To: Org Mode


[-- Attachment #1.1: Type: text/plain, Size: 440 bytes --]

Hi,

The attached patch fix the type declaration of org-capture-templates by
allowing the user to use file, variable, function and sexp as target's
file to match the documentation

(org) Template elements
> Most target specifications contain a file name. If that file name is the
> empty string, it defaults to ‘org-default-notes-file’. A file can also
> be given as a variable, function, or Emacs Lisp form.

OK to push?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-lisp-org-capture.el-Fix-org-capture-templates-type-d.patch --]
[-- Type: text/x-diff, Size: 2398 bytes --]

From 00aa68469d51420c71f77801514c17a8464c8e2b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= <gregoire.jadi@univ-nantes.fr>
Date: Sat, 24 Oct 2015 19:27:58 +0200
Subject: [PATCH] lisp/org-capture.el: Fix `org-capture-templates' type
 declaration

* lisp/org-capture.el(org-capture-templates): Fix `org-capture-templates' type
declaration to match its documentation.

Allow the use of file, variable, function or Emacs Lisp form as target file as
specified by the docstring.
---
 lisp/org-capture.el | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 58b578b..9d24a6f 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -298,32 +298,39 @@ calendar                |  %:type %:date"
 		  (choice :tag "Target location"
 			  (list :tag "File"
 				(const :format "" file)
-				(file :tag "  File"))
+				(choice :tag "  File"
+					file variable function sexp))
 			  (list :tag "ID"
 				(const :format "" id)
 				(string :tag "  ID"))
 			  (list :tag "File & Headline"
 				(const :format "" file+headline)
-				(file   :tag "  File    ")
+				(choice :tag "  File    "
+					file variable function sexp)
 				(string :tag "  Headline"))
 			  (list :tag "File & Outline path"
 				(const :format "" file+olp)
-				(file   :tag "  File    ")
+				(choice :tag "  File    "
+					file variable function sexp)
 				(repeat :tag "Outline path" :inline t
 					(string :tag "Headline")))
 			  (list :tag "File & Regexp"
 				(const :format "" file+regexp)
-				(file   :tag "  File  ")
+				(choice :tag "  File  "
+					file variable function sexp)
 				(regexp :tag "  Regexp"))
 			  (list :tag "File & Date tree"
 				(const :format "" file+datetree)
-				(file :tag "  File"))
+				(choice :tag "  File"
+					file variable function sexp))
 			  (list :tag "File & Date tree, prompt for date"
 				(const :format "" file+datetree+prompt)
-				(file :tag "  File"))
+				(choice :tag "  File"
+					file variable function sexp))
 			  (list :tag "File & function"
 				(const :format "" file+function)
-				(file :tag "  File    ")
+				(choice :tag "  File    "
+					file variable function sexp)
 				(sexp :tag "  Function"))
 			  (list :tag "Current clocking task"
 				(const :format "" clock))
-- 
1.9.1


[-- Attachment #1.3: Type: text/plain, Size: 23 bytes --]


-- 
Grégoire Jadi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix `org-capture-templates' type declaration
  2015-10-24 17:43 [PATCH] Fix `org-capture-templates' type declaration Grégoire Jadi
@ 2015-10-25  8:40 ` Nicolas Goaziou
  2015-10-25 13:34   ` Grégoire Jadi
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2015-10-25  8:40 UTC (permalink / raw)
  To: Grégoire Jadi; +Cc: Org Mode

Hello,

Grégoire Jadi <gregoire.jadi@univ-nantes.fr> writes:

> The attached patch fix the type declaration of org-capture-templates by
> allowing the user to use file, variable, function and sexp as target's
> file to match the documentation

Thank you.

> -				(file :tag "  File"))
> +				(choice :tag "  File"
> +					file variable function sexp))

Shouldn't there be an entry for each type instead of stuffing everything
within "File" descriptor ?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix `org-capture-templates' type declaration
  2015-10-25  8:40 ` Nicolas Goaziou
@ 2015-10-25 13:34   ` Grégoire Jadi
  2015-10-25 15:44     ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Grégoire Jadi @ 2015-10-25 13:34 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]


Nicolas Goaziou writes:

> Hello,

Hi,

Thanks for the reply.

> Grégoire Jadi <gregoire.jadi@univ-nantes.fr> writes:
>
>> The attached patch fix the type declaration of org-capture-templates by
>> allowing the user to use file, variable, function and sexp as target's
>> file to match the documentation
>
> Thank you.
>
>> -				(file :tag "  File"))
>> +				(choice :tag "  File"
>> +					file variable function sexp))
>
> Shouldn't there be an entry for each type instead of stuffing everything
> within "File" descriptor ?

With my patch, the customization interface looks like this
- for a file :
Target location: Value Menu File:
  File: Value Menu File: ~/org/notes.org

- for a variable :
Target location: Value Menu File:
  File: Value Menu Variable: nil

- for a function :
Target location: Value Menu File:
  File: Value Menu Function: ignore

- for an Emacs Lisp form :
Target location: Value Menu File:
  File: Value Menu Lisp expression: nil

What kind of rendering do you think would be better/clearer?

Best,
> Regards,

-- 
Grégoire Jadi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix `org-capture-templates' type declaration
  2015-10-25 13:34   ` Grégoire Jadi
@ 2015-10-25 15:44     ` Nicolas Goaziou
  2015-10-25 16:47       ` Grégoire Jadi
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2015-10-25 15:44 UTC (permalink / raw)
  To: Grégoire Jadi; +Cc: Org Mode

Grégoire Jadi <gregoire.jadi@univ-nantes.fr> writes:

> With my patch, the customization interface looks like this
> - for a file :
> Target location: Value Menu File:
>   File: Value Menu File: ~/org/notes.org
>
> - for a variable :
> Target location: Value Menu File:
>   File: Value Menu Variable: nil
>
> - for a function :
> Target location: Value Menu File:
>   File: Value Menu Function: ignore
>
> - for an Emacs Lisp form :
> Target location: Value Menu File:
>   File: Value Menu Lisp expression: nil
>
> What kind of rendering do you think would be better/clearer?

:tag " File" is misleading. Perhaps " File, variable, function or
S-expression" would be clearer, if a bit longish.

Not sure how to make this beast clearer anyway.


Regards,

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix `org-capture-templates' type declaration
  2015-10-25 15:44     ` Nicolas Goaziou
@ 2015-10-25 16:47       ` Grégoire Jadi
  0 siblings, 0 replies; 5+ messages in thread
From: Grégoire Jadi @ 2015-10-25 16:47 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]


Nicolas Goaziou writes:

> Grégoire Jadi <gregoire.jadi@univ-nantes.fr> writes:
>
>> With my patch, the customization interface looks like this
>> - for a file :
>> Target location: Value Menu File:
>>   File: Value Menu File: ~/org/notes.org
>>
>> - for a variable :
>> Target location: Value Menu File:
>>   File: Value Menu Variable: nil
>>
>> - for a function :
>> Target location: Value Menu File:
>>   File: Value Menu Function: ignore
>>
>> - for an Emacs Lisp form :
>> Target location: Value Menu File:
>>   File: Value Menu Lisp expression: nil
>>
>> What kind of rendering do you think would be better/clearer?
>
> :tag " File" is misleading. Perhaps " File, variable, function or
> S-expression" would be clearer, if a bit longish.

That's too long IMHO.

> Not sure how to make this beast clearer anyway.

Me neither.

If anyone has an opinion on this, s/he is welcome!

This patch can wait a little until we find a satisfactory solution.
AFAIK noone has reported this bug :)


Best,

-- 
Grégoire Jadi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-25 16:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-24 17:43 [PATCH] Fix `org-capture-templates' type declaration Grégoire Jadi
2015-10-25  8:40 ` Nicolas Goaziou
2015-10-25 13:34   ` Grégoire Jadi
2015-10-25 15:44     ` Nicolas Goaziou
2015-10-25 16:47       ` Grégoire Jadi

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