[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Customize reftex according to auctex mode
From: |
Jean Magnan de Bornier |
Subject: |
Re: Customize reftex according to auctex mode |
Date: |
Sun, 30 Nov 2008 16:48:11 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Kevin Rodgers <kevin.d.rodgers@gmail.com> wrote :
| Jean Magnan de Bornier wrote:
| > Hi all, I have been trying to customize reftex-cite-format to be
| > "\cite{%l}" when
| > using LaTeX, and "\cite[%l]" when using ConTeXt.
| >
| > My first attempt was simply the last line here:
| >
| > (add-hook 'ConTeXt-mode-hook
| > (function
| > (lambda () (reftex-mode t)
| > (auto-fill-mode 1)
| > (LaTeX-math-mode 1)
| > ))
| > (setq reftex-cite-format "\\cite[%l]"))
| >
| > But this command once given is also applied to latex files; I then tried
| > writing the corresponding instruction in (add-hook 'LaTeX-mode-hook...
| > but then auctex has reverted to the latex behavior even for context files.
| >
| > So apparently I cannot customize reftex within aa auctex mode? Or am I
| > just clumsy?
>
| A little clumsy, yes :-) First, you need to move the setq form inside
| the hook function. As it is, the setq form is being evaluated when
| add-hook runs, providing its APPEND argument.
>
| Second, you probably want to make reftex-cite-format's value local to
| the Context mode buffers. So:
>
| (add-hook 'ConTeXt-mode-hook
| (function
| (lambda ()
| (reftex-mode t)
| (auto-fill-mode 1)
| (LaTeX-math-mode 1)
| (set (make-local-variable 'reftex-cite-format) "\\cite[%l]"))))
Thank you so much Kevin, this works like a charm!
--
Jean