changeset 111636:e19cfb89c13c

* textmodes/reftex-ref.el (reftex-goto-label): If point is inside a \ref{} or \pageref{} macro, then use its value as initial input.
author Tassilo Horn <tassilo@member.fsf.org>
date Fri, 19 Nov 2010 12:18:15 +0100
parents b8f48ecba2e7
children 63bab16df70b
files lisp/ChangeLog lisp/textmodes/reftex-ref.el
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Nov 19 05:11:59 2010 +0000
+++ b/lisp/ChangeLog	Fri Nov 19 12:18:15 2010 +0100
@@ -1,3 +1,8 @@
+2010-11-19  Tassilo Horn  <tassilo@member.fsf.org>
+
+	* textmodes/reftex-ref.el (reftex-goto-label): If point is inside
+	a \ref{} or \pageref{} macro, then use its value as initial input.
+
 2010-11-19  Jay Belanger  <jay.p.belanger@gmail.com>
 
 	* calc/calc-units.el (math-build-units-table-buffer):
--- a/lisp/textmodes/reftex-ref.el	Fri Nov 19 05:11:59 2010 +0000
+++ b/lisp/textmodes/reftex-ref.el	Fri Nov 19 12:18:15 2010 +0100
@@ -831,7 +831,12 @@
   (let* ((wcfg (current-window-configuration))
          (docstruct (symbol-value reftex-docstruct-symbol))
          (label (completing-read "Label: " docstruct
-                                 (lambda (x) (stringp (car x))) t))
+                                 (lambda (x) (stringp (car x))) t
+				 ;; If point is inside a \ref{} or
+				 ;; \pageref{}, use that as initial
+				 ;; input.
+				 (when (looking-back "\\\\\\(?:page\\)?ref{[-a-zA-Z0-9_*.:]*")
+				   (reftex-this-word "-a-zA-Z0-9_*.:"))))
          (selection (assoc label docstruct))
          (where (progn
                   (reftex-show-label-location selection t nil 'stay)