]> git.eshelyaron.com Git - emacs.git/commitdiff
* textmodes/reftex-ref.el (reftex-goto-label): If point is inside
authorTassilo Horn <tassilo@member.fsf.org>
Fri, 19 Nov 2010 11:18:15 +0000 (12:18 +0100)
committerTassilo Horn <tassilo@member.fsf.org>
Fri, 19 Nov 2010 11:18:15 +0000 (12:18 +0100)
a \ref{} or \pageref{} macro, then use its value as initial input.

lisp/ChangeLog
lisp/textmodes/reftex-ref.el

index 166f30c05742ea8fc9dddf8f35432df2f18de1aa..be4a885a6662a407b9fcbf7b838a537f6f6921ef 100644 (file)
@@ -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):
index 655d69b531de525fc60971f3aca995f568a0bf2b..ff3ffbc20ba619326b9435d283f585de711a31ee 100644 (file)
@@ -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)