Function: bib-get-citekeys-obarray
bib-get-citekeys-obarray is a byte-compiled function defined in
bib-cite.el.
Signature
(bib-get-citekeys-obarray)
Documentation
Return obarray of citation key (within curly brackets) under cursor.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/bib-cite.el
(defun bib-get-citekeys-obarray ()
"Return obarray of citation key (within curly brackets) under cursor."
(save-excursion
;; First find *only* a key *within a cite command
(let ((the-point (point))
(keys-obarray (make-vector 201 0)))
;; First try to match a cite command
(if (and (skip-chars-backward "a-zA-Z") ;Stops on \ or {
(looking-at "[a-zA-Z]*cite[a-zA-Z]*"))
(progn
;;skip over any optional arguments to \cite[][]{key} command
(skip-chars-forward "a-zA-Z")
(while (looking-at "\\[")
(forward-list 1))
(re-search-forward "{[ \n]*\\([^,} \n]+\\)" nil t)
(intern (match-string 1) keys-obarray)
(while (and (skip-chars-forward " \n") ;no effect on while
(looking-at ","))
(forward-char 1)
;;The following re-search skips over leading spaces
(re-search-forward "\\([^,} \n]+\\)" nil t)
(intern (match-string 1) keys-obarray)))
;; Assume we are on the keyword
(goto-char the-point)
(let ((the-start (re-search-backward "[\n{, ]" nil t))
(the-end (progn (goto-char the-point)
(re-search-forward "[\n}, ]" nil t))))
(if (and the-start the-end)
(intern (buffer-substring (1+ the-start) (1- the-end))
keys-obarray)
;; Neither...
(error "Sorry, can't find a reference here"))))
keys-obarray)))