Function: bibtex-parse-strings

bibtex-parse-strings is a byte-compiled function defined in bibtex.el.gz.

Signature

(bibtex-parse-strings &optional ADD ABORTABLE)

Documentation

Set bibtex-strings(var)/bibtex-strings(fun) to the string definitions in the whole buffer.

If ADD is non-nil add the new strings to bibtex-strings(var)/bibtex-strings(fun) instead of simply resetting it. If ADD is an alist of strings, also add ADD to bibtex-strings(var)/bibtex-strings(fun). If ABORTABLE is non-nil abort on user input. Return alist of strings if parsing was completed, aborted otherwise.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-parse-strings (&optional add abortable)
  "Set `bibtex-strings' to the string definitions in the whole buffer.
If ADD is non-nil add the new strings to `bibtex-strings' instead of
simply resetting it.  If ADD is an alist of strings, also add ADD to
`bibtex-strings'.  If ABORTABLE is non-nil abort on user input.
Return alist of strings if parsing was completed, `aborted' otherwise."
  (save-excursion
    (save-match-data
      (goto-char (point-min))
      (let ((strings (if (and add (not (functionp bibtex-strings)))
                         bibtex-strings))
            bounds key)
        (if (listp add)
            (dolist (string add)
              (unless (assoc-string (car string) strings t)
                (push string strings))))
        (catch 'userkey
          (while (setq bounds (bibtex-search-forward-string))
            (if (and abortable
                     (input-pending-p))
                ;; user has aborted by typing a key --> return `aborted'
                (throw 'userkey 'aborted))
            (setq key (bibtex-reference-key-in-string bounds))
            (unless (assoc-string key strings t)
              (push (cons key (bibtex-text-in-string bounds t))
                    strings))
            (goto-char (bibtex-end-of-text-in-string bounds)))
          ;; successful operation --> return `bibtex-strings'
          (setq bibtex-strings strings))))))