Function: org-capture-expand-olp

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

Signature

(org-capture-expand-olp FILE &rest OLP)

Documentation

Expand functions, symbols and outline paths in FILE for OLP.

When OLP is a function, call it with no arguments while the current buffer is the FILE-visiting buffer. When it is a variable, return its value. When it is a list of string, return it. In any other case, signal an error.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-capture.el.gz
(defun org-capture-expand-olp (file &rest olp)
  "Expand functions, symbols and outline paths in FILE for OLP.
When OLP is a function, call it with no arguments while the current
buffer is the FILE-visiting buffer.  When it is a variable, return its
value.  When it is a list of string, return it.  In any other case,
signal an error."
  (let* ((first (car olp))
         (final-olp (cond ((not (memq nil (mapcar #'stringp olp))) olp)
                          ((and (not (cdr olp)) (functionp first))
                           (with-current-buffer (find-file-noselect file)
                             (funcall first)))
                          ((and (not (cdr olp)) (symbolp first) (boundp first))
                           (symbol-value first))
                          (t nil))))
    (or final-olp
        (error "org-capture: Invalid outline path target: %S" olp))))