Function: org-capture-expand-file

org-capture-expand-file is a byte-compiled function defined in org-capture.el.gz.

Signature

(org-capture-expand-file FILE)

Documentation

Expand functions, symbols and file names for FILE.

When FILE is a function, call it. When it is a form, evaluate it. When it is a variable, return its value. When it is a string, treat it as a file name, possibly expanding it according to org-directory, and return it. If it is the empty string, however, return org-default-notes-file. In any other case, raise an error.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-capture.el.gz
(defun org-capture-expand-file (file)
  "Expand functions, symbols and file names for FILE.
When FILE is a function, call it.  When it is a form, evaluate
it.  When it is a variable, return its value.  When it is
a string, treat it as a file name, possibly expanding it
according to `org-directory', and return it.  If it is the empty
string, however, return `org-default-notes-file'.  In any other
case, raise an error."
  (let ((location (cond ((equal file "") org-default-notes-file)
			((stringp file) (expand-file-name file org-directory))
			((functionp file) (funcall file))
			((and (symbolp file) (boundp file)) (symbol-value file))
			(t nil))))
    (or (org-string-nw-p location)
	(error "Invalid file location: %S" location))))