diff --git a/doc/org.texi b/doc/org.texi index e8d8a6ef2..ef653b5bc 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -7159,8 +7159,8 @@ files, targets usually define a node. Entries will become children of this node. Other types will be added to the table or list in the body of this node. Most target specifications contain a file name. If that file name is the empty string, it defaults to @code{org-default-notes-file}. A file can -also be given as a variable, function, or Emacs Lisp form. When an absolute -path is not specified for a target, it is taken as relative to +also be given as a variable or as a function called with no argument. When +an absolute path is not specified for a target, it is taken as relative to @code{org-directory}. Valid values are: diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index dd332a4f4..8b2d1f697 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -8,6 +8,21 @@ See the end of the file for license conditions. Please send Org bug reports to mailto:emacs-orgmode@gnu.org. +* Version 9.1 + +** Incompatible changes + +*** ~org-capture-templates~ no longer accepts S-expressions as file names + +Since functions are allowed there, a straightforward way to migrate +is to turn, e.g., + +: (file (sexp)) + +into + +: (file (lambda () (sexp))) + * Version 9.0 ** Incompatible changes diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 690d342c8..5b07b295d 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -124,8 +124,8 @@ target Specification of where the captured item should be placed. 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. When an absolute path is not specified for a + A file can also be given as a variable or as a function called + with no argument. When an absolute path is not specified for a target, it is taken as relative to `org-directory'. Valid values are: @@ -1008,16 +1008,13 @@ Store them in the capture property list." (defun org-capture-expand-file (file) "Expand functions and symbols for FILE. -When FILE is a function, call it. When it is a form, evaluate -it. When it is a variable, retrieve the value. When it is -a string, return it. However, if it is the empty string, return -`org-default-notes-file' instead." +When FILE is a function, call it. When it is a variable, +retrieve its value. When it is the empty string, return +`org-default-notes-file'. In any other case, return FILE as-is." (cond ((equal file "") org-default-notes-file) - ((org-string-nw-p file) file) ((functionp file) (funcall file)) ((and (symbolp file) (boundp file)) (symbol-value file)) - ((consp file) (eval file)) (t file))) (defun org-capture-target-buffer (file)