Function: org-bibtex-read

org-bibtex-read is an interactive and byte-compiled function defined in ol-bibtex.el.gz.

Signature

(org-bibtex-read)

Documentation

Read a bibtex entry and save to org-bibtex-entries.

This uses bibtex-parse-entry. Return the new value of org-bibtex-entries.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/ol-bibtex.el.gz
(defun org-bibtex-read ()
  "Read a bibtex entry and save to `org-bibtex-entries'.
This uses `bibtex-parse-entry'.
Return the new value of `org-bibtex-entries'."
  (interactive)
  (let ((keyword (lambda (str) (intern (concat ":" (downcase str)))))
	(clean-space (lambda (str) (replace-regexp-in-string
                                    "[[:space:]\n\r]+" " " str)))
	(strip-delim
	 (lambda (str)		     ; strip enclosing "..." and {...}
	   (dolist (pair '((34 . 34) (123 . 125)))
	     (when (and (> (length str) 1)
			(= (aref str 0) (car pair))
			(= (aref str (1- (length str))) (cdr pair)))
	       (setf str (substring str 1 (1- (length str))))))
	   str)))
    (push (mapcar
           (lambda (pair)
             (cons (let ((field (funcall keyword (car pair))))
                     (pcase field
                       (:=type= :type)
                       (:=key= :key)
                       (_ field)))
                   (funcall clean-space (funcall strip-delim (cdr pair)))))
           (save-excursion (bibtex-beginning-of-entry) (bibtex-parse-entry)))
          org-bibtex-entries)
    (unless (car org-bibtex-entries) (pop org-bibtex-entries))
    org-bibtex-entries))