* Customize reftex according to auctex mode
@ 2008-11-30 10:15 Jean Magnan de Bornier
2008-11-30 15:12 ` Kevin Rodgers
[not found] ` <mailman.1549.1228057943.26697.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 3+ messages in thread
From: Jean Magnan de Bornier @ 2008-11-30 10:15 UTC (permalink / raw
To: help-gnu-emacs
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?
AUCTeX 11.85
TIA,
--
Jean
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Customize reftex according to auctex mode
2008-11-30 10:15 Customize reftex according to auctex mode Jean Magnan de Bornier
@ 2008-11-30 15:12 ` Kevin Rodgers
[not found] ` <mailman.1549.1228057943.26697.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2008-11-30 15:12 UTC (permalink / raw
To: help-gnu-emacs
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]"))))
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Customize reftex according to auctex mode
[not found] ` <mailman.1549.1228057943.26697.help-gnu-emacs@gnu.org>
@ 2008-11-30 15:48 ` Jean Magnan de Bornier
0 siblings, 0 replies; 3+ messages in thread
From: Jean Magnan de Bornier @ 2008-11-30 15:48 UTC (permalink / raw
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-30 15:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-30 10:15 Customize reftex according to auctex mode Jean Magnan de Bornier
2008-11-30 15:12 ` Kevin Rodgers
[not found] ` <mailman.1549.1228057943.26697.help-gnu-emacs@gnu.org>
2008-11-30 15:48 ` Jean Magnan de Bornier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).