auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] Suggestion for TeX-arg-label/ref


From: Tassilo Horn
Subject: Re: [AUCTeX-devel] Suggestion for TeX-arg-label/ref
Date: Mon, 02 Sep 2013 11:59:53 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

David Kastrup <address@hidden> writes:

>>> If you mark something, and want to use that marked text as an
>>> argument in \ref, you're still met with the dialogue for
>>> RefTeX. Would it be possible to add (I don't mind having a shot at
>>> this) a test to insert the marked text, instead of doing the
>>> automatic reftex/auctex argument prompt?
>>
>> I have no clue how that could work.  When you put an active region
>> around some label text (that's what I think you mean with mark), then
>> point is at the beginning or end of that label text, and almost
>> certainly you don't want to insert the \ref inside the \label.
>>
>> So I guess you probably want to use the top entry of the kill-ring as
>> argument of the \ref.  But then how can auctex know when you want to
>> do that?
>
> It could just place \ref{...} around the active region.

Hm, ok.  Mads, then those advices should do what you want.

--8<---------------cut here---------------start------------->8---
;; if you don't use reftex.el
(defadvice TeX-arg-label (around only-wrap-active-region activate)
  (unless (use-region-p)
    ad-do-it))

;; if you use reftex.el
(defadvice reftex-arg-label (around only-wrap-active-region activate)
  (unless (use-region-p)
    ad-do-it))
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo



reply via email to

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