]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/reftex-ref.el
Add new maintainer (deego).
[gnu-emacs] / lisp / textmodes / reftex-ref.el
index 392428ac21b8d6c0e2afdfc272f600324b3e6157..b5088a34ff42f821b4c7eafa622cb06ed0ff195e 100644 (file)
@@ -1,9 +1,8 @@
-;;; reftex-ref.el - Code to create labels and references with RefTeX
-;; Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
+;;; reftex-ref.el --- code to create labels and references with RefTeX
+;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
-;; Author:     Carsten Dominik <dominik@strw.LeidenUniv.nl>
-;; Version:    4.9
-;; Keywords:   tex
+;; Author: Carsten Dominik <dominik@science.uva.nl>
+;; Version: 4.18
 
 ;; This file is part of GNU Emacs.
 
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
+;;; Code:
+
 (eval-when-compile (require 'cl))
 (provide 'reftex-ref)
 (require 'reftex)
@@ -364,6 +367,7 @@ also applies `reftex-translate-to-ascii-function' to the string."
   " n / p      Go to next/previous label (Cursor motion works as well)
  C-c C-n/p  Go to next/previous section heading.
  b / l      Jump back to previous selection / Reuse last referenced label.
+ z          Jump to a specific section, e.g. '3 z' jumps to section 3.
  g / s      Update menu      / Switch label type.
  r / C-u r  Reparse document / Reparse entire document.
  x          Switch to label menu of external document (with LaTeX package `xr').
@@ -417,7 +421,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
                   (reftex-offer-label-menu type)))
     (reftex-ensure-compiled-variables)
     (set-marker reftex-select-return-marker nil)
-    ;; If the first entry is the symbol 'concat, concat all all labels.
+    ;; If the first entry is the symbol 'concat, concat all labels.
     ;; We keep the cdr of the first label for typekey etc information.
     (if (eq (car labels) 'concat)
        (setq labels (list (list (mapconcat 'car (cdr labels) ",")
@@ -642,7 +646,7 @@ When called with 2 C-u prefix args, disable magic word recognition."
              selection-buffers)
       (reftex-kill-temporary-buffers))
     ;; Add the prefixes, put together the relevant information in the form
-    ;; (LABEL TYPEKEY SEPERATOR) and return a list of those.
+    ;; (LABEL TYPEKEY SEPARATOR) and return a list of those.
     (mapcar (lambda (x)
              (if (listp x)
                  (list (concat prefix (car (car x)))
@@ -770,19 +774,19 @@ When called with 2 C-u prefix args, disable magic word recognition."
        (setq buffer-read-only t))))))
 
 (defun reftex-varioref-vref ()
-  "Insert a reference using the `\vref' macro from the varioref package."
+  "Insert a reference using the `\\vref' macro from the varioref package."
   (interactive)
   (let ((reftex-format-ref-function 'reftex-format-vref))
     (reftex-reference)))
 (defun reftex-fancyref-fref ()
-  "Insert a reference using the `\fref' macro from the fancyref package."
+  "Insert a reference using the `\\fref' macro from the fancyref package."
   (interactive)
   (let ((reftex-format-ref-function 'reftex-format-fref)
        ;;(reftex-guess-label-type nil) ;FIXME do we want this????
        )
     (reftex-reference)))
 (defun reftex-fancyref-Fref ()
-  "Insert a reference using the `\Fref' macro from the fancyref package."
+  "Insert a reference using the `\\Fref' macro from the fancyref package."
   (interactive)
   (let ((reftex-format-ref-function 'reftex-format-Fref)
        ;;(reftex-guess-label-type nil) ;FIXME do we want this????
@@ -798,4 +802,36 @@ When called with 2 C-u prefix args, disable magic word recognition."
 (defun reftex-format-fref (label def-fmt)
   (format "\\fref{%s}" label))
 
+
+;(defun reftex-goto-label ()
+;  (interactive)
+;  (reftex-access-scan-info)
+;  (let* ((docstruct (symbol-value reftex-docstruct-symbol))
+;       (label (completing-read "Label: " docstruct
+;                               (lambda (x) (stringp (car x))) t))
+;       (selection (assoc label docstruct)))
+;    (reftex-show-label-location selection t nil 'stay)
+;    (reftex-unhighlight 0)))
+
+(defun reftex-goto-label (&optional other-window)
+  "Prompt for a label (with completion) and jump to the location of this label.
+Optional prefix argument OTHER-WINDOW goes to the label in another window."
+  (interactive "P")
+  (reftex-access-scan-info)
+  (let* ((wcfg (current-window-configuration))
+        (docstruct (symbol-value reftex-docstruct-symbol))
+        (label (completing-read "Label: " docstruct
+                                (lambda (x) (stringp (car x))) t))
+        (selection (assoc label docstruct))
+        (where (progn
+                 (reftex-show-label-location selection t nil 'stay)
+                 (point-marker))))
+    (unless other-window
+      (set-window-configuration wcfg)
+      (switch-to-buffer (marker-buffer where))
+      (goto-char where))      
+    (reftex-unhighlight 0)))
+
+
+
 ;;; reftex-ref.el ends here