[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] reftex-citation to complete from all citations instead of j

From: Michael Hoffman
Subject: Re: [AUCTeX] reftex-citation to complete from all citations instead of just ones used previously?
Date: Wed, 25 Jul 2012 17:19:58 -0700
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:11.0) Gecko/20120312 Thunderbird/11.0

On 07/09/2012 04:45 PM, Michael Hoffman wrote:
When I start AUCTeX there are no completions available for
reftex-citation. I have to give it a regular expression first and then
after selecting a citation it will be in the history for reftex-citation
and also I can tab-complete to it in the prompt for reftex-citation.

It seems like it would be easier to just tab out a citation key if I
know its beginning and have the citations completed from the
bibliography database instead of history. Is this possible?

I figured out how to do this, which I've described in response to a question as well. I will copy my response here:

The documentation of reftex-citation is a bit confusing. It promises completion on known citation keys but I believe "known" refers to keys that have been used previously in this session rather than all keys in the appropriate bibliography. You can use the LaTeX-add-all-bibitems-from-bibtex command defined below to load all keys in your bibliography:

(defun get-bibtex-keys (file)
  (with-current-buffer (find-file-noselect file)
    (mapcar 'car (bibtex-parse-keys))))

(defun LaTeX-add-all-bibitems-from-bibtex ()
  (mapc 'LaTeX-add-bibitems
        (apply 'append
               (mapcar 'get-bibtex-keys (reftex-get-bibfile-list)))))

Suggestions on appropriate hooks to make this happen automatically are welcome.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]