]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/reftex-toc.el
*** empty log message ***
[gnu-emacs] / lisp / textmodes / reftex-toc.el
index 9f5cb0ce9ac437658d5f0338f0c446deb4be711d..2ec1040d190bddc9ac539a98ce1a27948f3fab32 100644 (file)
@@ -1,9 +1,8 @@
-;;; reftex-toc.el - RefTeX's table of contents mode
+;;; reftex-toc.el --- RefTeX's table of contents mode
 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 
-;; Author:     Carsten Dominik <dominik@strw.LeidenUniv.nl>
-;; Version: 4.11
-;;
+;; Author: Carsten Dominik <dominik@strw.LeidenUniv.nl>
+;; Version: 4.16
 
 ;; 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-toc)
 (require 'reftex)
@@ -59,8 +62,6 @@ Here are all local bindings.
              "  T<" 'reftex-toc-max-level-indicator ">"
              " -%-"))
   (setq truncate-lines t)
-  (make-local-hook 'post-command-hook)
-  (make-local-hook 'pre-command-hook)
   (make-local-variable 'reftex-last-follow-point)
   (add-hook 'post-command-hook 'reftex-toc-post-command-hook nil t)
   (add-hook 'pre-command-hook  'reftex-toc-pre-command-hook nil t)
@@ -92,7 +93,8 @@ t          Change maximum toc depth (e.g. `3 t' hides levels greater than 3).
 f / g      Toggle follow mode on and off  / Refresh *toc* buffer.
 r / C-u r  Reparse the LaTeX document     / Reparse entire LaTeX document.
 .          In other window, show position from where `reftex-toc' was called.
-x          Switch to TOC of external document (with LaTeX package `xr').")
+x          Switch to TOC of external document (with LaTeX package `xr').
+z          Jump to a specific section (e.g. '3 z' goes to section 3")
 
 (defun reftex-toc (&optional rebuild)
   "Show the table of contents for the current document.
@@ -426,6 +428,16 @@ With prefix arg 1, restrict index to the section at point."
        (message "")
       (message "Switched document"))))
 
+(defun reftex-toc-jump (arg)
+  "Jump to a specific section.  E.g. '3 z' jumps to section 3.
+Useful for large TOC's."
+  (interactive "P")
+  (goto-char (point-min))
+  (re-search-forward
+   (concat "^ *" (number-to-string (if (numberp arg) arg 1)) " ")
+   nil t)
+  (beginning-of-line))
+
 (defun reftex-toc-visit-location (&optional final no-revisit)
   ;; Visit the tex file corresponding to the toc entry on the current line.
   ;; If FINAL is t, stay there
@@ -576,6 +588,7 @@ With prefix arg 1, restrict index to the section at point."
        ("c"    . reftex-toc-toggle-context)
        ("%"    . reftex-toc-toggle-commented)
        ("x"    . reftex-toc-external)
+       ("z"    . reftex-toc-jump)
        ("."    . reftex-toc-show-calling-point)
        ("\C-c\C-n" . reftex-toc-next-heading)
        ("\C-c\C-p" . reftex-toc-previous-heading))