unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Customize reftex according to auctex mode
Date: Sun, 30 Nov 2008 08:12:07 -0700	[thread overview]
Message-ID: <gguag7$bjk$1@ger.gmane.org> (raw)
In-Reply-To: <874p1peczb.fsf@bornier.net>

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





  reply	other threads:[~2008-11-30 15:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-30 10:15 Customize reftex according to auctex mode Jean Magnan de Bornier
2008-11-30 15:12 ` Kevin Rodgers [this message]
     [not found] ` <mailman.1549.1228057943.26697.help-gnu-emacs@gnu.org>
2008-11-30 15:48   ` Jean Magnan de Bornier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='gguag7$bjk$1@ger.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).