Function: org-export--get-inbuffer-options
org-export--get-inbuffer-options is a byte-compiled function defined
in ox.el.gz.
Signature
(org-export--get-inbuffer-options &optional BACKEND)
Documentation
Return current buffer export options, as a plist.
Optional argument BACKEND, when non-nil, is an export back-end,
as returned by, e.g., org-export-create-backend. It specifies
which back-end specific options should also be read in the
process.
Assume buffer is in Org mode. Narrowing, if any, is ignored.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox.el.gz
(defun org-export--get-inbuffer-options (&optional backend)
"Return current buffer export options, as a plist.
Optional argument BACKEND, when non-nil, is an export back-end,
as returned by, e.g., `org-export-create-backend'. It specifies
which back-end specific options should also be read in the
process.
Assume buffer is in Org mode. Narrowing, if any, is ignored."
(let* ((case-fold-search t)
(options (append
;; Priority is given to back-end specific options.
(org-export-get-all-options backend)
org-export-options-alist))
plist to-parse)
(let ((find-properties
(lambda (keyword)
;; Return all properties associated to KEYWORD.
(let (properties)
(dolist (option options properties)
(when (equal (nth 1 option) keyword)
(cl-pushnew (car option) properties)))))))
;; Read options in the current buffer and return value.
(dolist (entry (org-collect-keywords
(nconc (delq nil (mapcar #'cadr options))
'("FILETAGS" "OPTIONS"))))
(pcase entry
(`("OPTIONS" . ,values)
(setq plist
(apply #'org-combine-plists
plist
(mapcar (lambda (v)
(org-export--parse-option-keyword v backend))
values))))
(`("FILETAGS" . ,values)
(setq plist
(plist-put plist
:filetags
(org-uniquify
(cl-mapcan (lambda (v) (org-split-string v ":"))
values)))))
(`(,keyword . ,values)
(dolist (property (funcall find-properties keyword))
(setq plist
(plist-put
plist property
;; Handle value depending on specified BEHAVIOR.
(cl-case (nth 4 (assq property options))
(parse
(unless (memq property to-parse)
(push property to-parse))
;; Even if `parse' implies `space' behavior, we
;; separate line with "\n" so as to preserve
;; line-breaks.
(mapconcat #'identity values "\n"))
(space
(mapconcat #'identity values " "))
(newline
(mapconcat #'identity values "\n"))
(split
(cl-mapcan (lambda (v) (split-string v)) values))
((t)
(org-last values))
(otherwise
(car values)))))))))
;; Parse properties in TO-PARSE. Remove newline characters not
;; involved in line breaks to simulate `space' behavior.
;; Finally return options.
(dolist (p to-parse plist)
(let ((value (org-element-parse-secondary-string
(plist-get plist p)
(org-element-restriction 'keyword))))
(org-element-map value 'plain-text
(lambda (s)
(org-element-set-element
s (replace-regexp-in-string "\n" " " s))))
(setq plist (plist-put plist p value)))))))