Function: org-macro--find-keyword-value
org-macro--find-keyword-value is a byte-compiled function defined in
org-macro.el.gz.
Signature
(org-macro--find-keyword-value NAME &optional COLLECT)
Documentation
Find value for keyword NAME in current buffer.
Return value associated to the keywords named after NAME, as a string, or nil. When optional argument COLLECT is non-nil, concatenate values, separated with a space, from various keywords in the buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-macro.el.gz
(defun org-macro--find-keyword-value (name &optional collect)
"Find value for keyword NAME in current buffer.
Return value associated to the keywords named after NAME, as
a string, or nil. When optional argument COLLECT is non-nil,
concatenate values, separated with a space, from various keywords
in the buffer."
(org-with-point-at 1
(let ((regexp (format "^[ \t]*#\\+%s:" (regexp-quote name)))
(case-fold-search t)
(result nil))
(catch :exit
(while (re-search-forward regexp nil t)
(let ((element (org-with-point-at (match-beginning 0) (org-element-keyword-parser (line-end-position) (list (match-beginning 0))))))
(when (eq 'keyword (org-element-type element))
(let ((value (org-element-property :value element)))
(if (not collect) (throw :exit value)
(setq result (concat result " " value)))))))
(and result (org-trim result))))))