Function: org-get-title

org-get-title is a byte-compiled function defined in org.el.gz.

Signature

(org-get-title &optional BUFFER-OR-FILE)

Documentation

Collect title from the provided org-mode BUFFER-OR-FILE.

Returns nil if there are no #+TITLE property.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-get-title (&optional buffer-or-file)
  "Collect title from the provided `org-mode' BUFFER-OR-FILE.

Returns nil if there are no #+TITLE property."
  (let ((buffer (cond ((bufferp buffer-or-file) buffer-or-file)
                      ((stringp buffer-or-file) (find-file-noselect
                                                 buffer-or-file))
                      (t (current-buffer)))))
    (with-current-buffer buffer
      (org-macro-initialize-templates)
      (let ((title (assoc-default "title" org-macro-templates)))
        (unless (string= "" title)
          title)))))