Function: org-bibtex-fleshout
org-bibtex-fleshout is a byte-compiled function defined in
ol-bibtex.el.gz.
Signature
(org-bibtex-fleshout TYPE &optional OPTIONAL)
Documentation
Fleshout current heading, ensuring all required fields are present.
With optional argument OPTIONAL, also prompt for optional fields.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ol-bibtex.el.gz
(defun org-bibtex-fleshout (type &optional optional)
"Fleshout current heading, ensuring all required fields are present.
With optional argument OPTIONAL, also prompt for optional fields."
(let ((val (lambda (key lst) (cdr (assoc key lst))))
(keyword (lambda (name) (intern (concat ":" (downcase name)))))
(name (lambda (keyword) (substring (symbol-name keyword) 1))))
(dolist (field (append
(if org-bibtex-treat-headline-as-title
(remove :title (funcall val :required (funcall val type org-bibtex-types)))
(funcall val :required (funcall val type org-bibtex-types)))
(when optional (funcall val :optional (funcall val type org-bibtex-types)))))
(when (consp field) ; or'd pair of fields e.g., (:editor :author)
(let ((present (nth 0 (remove
nil
(mapcar
(lambda (f)
(when (org-bibtex-get (funcall name f)) f))
field)))))
(setf field (or present (funcall keyword
(completing-read
"Field: " (mapcar name field)))))))
(let ((name (funcall name field)))
(unless (org-bibtex-get name)
(let ((prop (org-bibtex-ask field)))
(when prop (org-bibtex-put name prop)))))))
(when (and type (assoc type org-bibtex-types)
(not (org-bibtex-get org-bibtex-key-property)))
(org-bibtex-autokey)))