From 9061f667df3e306edf9e40686e5dc5551fc8d607 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Fri, 19 Nov 2010 12:18:15 +0100 Subject: [PATCH] * textmodes/reftex-ref.el (reftex-goto-label): If point is inside a \ref{} or \pageref{} macro, then use its value as initial input. --- lisp/ChangeLog | 5 +++++ lisp/textmodes/reftex-ref.el | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 166f30c0574..be4a885a666 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-11-19 Tassilo Horn + + * 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 * calc/calc-units.el (math-build-units-table-buffer): diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el index 655d69b531d..ff3ffbc20ba 100644 --- a/lisp/textmodes/reftex-ref.el +++ b/lisp/textmodes/reftex-ref.el @@ -831,7 +831,12 @@ Optional prefix argument OTHER-WINDOW goes to the label in another window." (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) -- 2.39.5