1 ;;; reftex-toc.el --- RefTeX's table of contents mode
2 ;; Copyright (c) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
4 ;; Author: Carsten Dominik <dominik@science.uva.nl>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
28 (eval-when-compile (require 'cl
))
33 (defvar reftex-toc-map
(make-sparse-keymap)
34 "Keymap used for *toc* buffer.")
36 (defvar reftex-toc-menu
)
38 (defun reftex-toc-mode ()
39 "Major mode for managing Table of Contents for LaTeX files.
40 This buffer was created with RefTeX.
41 Press `?' for a summary of important key bindings.
43 Here are all local bindings.
47 (kill-all-local-variables)
48 (setq major-mode
'reftex-toc-mode
50 (use-local-map reftex-toc-map
)
51 (set (make-local-variable 'revert-buffer-function
) 'reftex-toc-revert
)
52 (set (make-local-variable 'reftex-toc-include-labels-indicator
) "")
53 (set (make-local-variable 'reftex-toc-max-level-indicator
)
54 (if (= reftex-toc-max-level
100)
56 (int-to-string reftex-toc-max-level
)))
57 (setq mode-line-format
58 (list "---- " 'mode-line-buffer-identification
59 " " 'global-mode-string
" (" mode-name
")"
60 " L<" 'reftex-toc-include-labels-indicator
">"
61 " I<" 'reftex-toc-include-index-indicator
">"
62 " T<" 'reftex-toc-max-level-indicator
">"
64 (setq truncate-lines t
)
65 (when (featurep 'xemacs
)
66 ;; XEmacs needs the call to make-local-hook
67 (make-local-hook 'post-command-hook
)
68 (make-local-hook 'pre-command-hook
))
69 (make-local-variable 'reftex-last-follow-point
)
70 (add-hook 'post-command-hook
'reftex-toc-post-command-hook nil t
)
71 (add-hook 'pre-command-hook
'reftex-toc-pre-command-hook nil t
)
72 (easy-menu-add reftex-toc-menu reftex-toc-map
)
73 (run-hooks 'reftex-toc-mode-hook
))
75 (defvar reftex-last-toc-file nil
76 "Stores the file name from which `reftex-toc' was called. For redo command.")
78 (defvar reftex-last-window-height nil
)
79 (defvar reftex-last-window-width nil
)
80 (defvar reftex-toc-include-labels-indicator nil
)
81 (defvar reftex-toc-include-index-indicator nil
)
82 (defvar reftex-toc-max-level-indicator nil
)
84 (defvar reftex-toc-return-marker
(make-marker)
85 "Marker which makes it possible to return from toc to old position.")
87 (defconst reftex-toc-help
88 " AVAILABLE KEYS IN TOC BUFFER
89 ============================
90 n / p next-line / previous-line
91 SPC Show the corresponding location of the LaTeX document.
92 TAB Goto the location and keep the *toc* window.
93 RET Goto the location and hide the *toc* window (also on mouse-2).
94 C-c > Display Index. With prefix arg, restrict index to current section.
95 q / k Hide/Kill *toc* buffer, return to position of reftex-toc command.
96 l i c F Toggle display of [l]abels, [i]ndex, [c]ontext, [F]ile borders.
97 t Change maximum toc depth (e.g. `3 t' hides levels greater than 3).
98 f / a / g Toggle follow mode / toggle auto recenter / Refresh *toc* buffer.
99 r / C-u r Reparse the LaTeX document / Reparse entire LaTeX document.
100 . In other window, show position from where `reftex-toc' was called.
101 x Switch to TOC of external document (with LaTeX package `xr').
102 z Jump to a specific section (e.g. '3 z' goes to section 3")
104 (defun reftex-toc (&optional rebuild
)
105 "Show the table of contents for the current document.
106 When called with a raw C-u prefix, rescan the document first."
110 (if (or (not (string= reftex-last-toc-master
(reftex-TeX-master-file)))
112 (reftex-erase-buffer "*toc*"))
114 (setq reftex-last-toc-file
(buffer-file-name))
115 (setq reftex-last-toc-master
(reftex-TeX-master-file))
117 (set-marker reftex-toc-return-marker
(point))
119 ;; If follow mode is active, arrange to delay it one command
120 (if reftex-toc-follow-mode
121 (setq reftex-toc-follow-mode
1))
123 (and reftex-toc-include-index-entries
124 (reftex-ensure-index-support))
125 (or reftex-support-index
126 (setq reftex-toc-include-index-entries nil
))
128 ;; Ensure access to scanning info and rescan buffer if prefix are is '(4)
129 (reftex-access-scan-info current-prefix-arg
)
131 (let* ((this-buf (current-buffer))
132 (docstruct-symbol reftex-docstruct-symbol
)
133 (xr-data (assq 'xr
(symbol-value reftex-docstruct-symbol
)))
134 (xr-alist (cons (cons "" (buffer-file-name)) (nth 1 xr-data
)))
135 (here-I-am (if (boundp 'reftex-rebuilding-toc
)
136 (get 'reftex-toc
:reftex-data
)
137 (car (reftex-where-am-I))))
140 (if (get-buffer-window "*toc*")
141 (select-window (get-buffer-window "*toc*"))
142 (when (or (not reftex-toc-keep-other-windows
)
143 (< (window-height) (* 2 window-min-height
)))
144 (delete-other-windows))
146 (setq reftex-last-window-width
(window-width)
147 reftex-last-window-height
(window-height)) ; remember
148 (if reftex-toc-split-windows-horizontally
149 (split-window-horizontally
150 (floor (* (frame-width) reftex-toc-split-windows-horizontally-fraction
)))
153 (let ((default-major-mode 'reftex-toc-mode
))
154 (switch-to-buffer "*toc*")))
156 (or (eq major-mode
'reftex-toc-mode
) (reftex-toc-mode))
157 (set (make-local-variable 'reftex-docstruct-symbol
) docstruct-symbol
)
158 (setq reftex-toc-include-labels-indicator
159 (if (eq reftex-toc-include-labels t
)
161 reftex-toc-include-labels
))
162 (setq reftex-toc-include-index-indicator
163 (if (eq reftex-toc-include-index-entries t
)
165 reftex-toc-include-index-entries
))
169 ;; buffer is empty - fill it with the table of contents
170 (message "Building *toc* buffer...")
172 (setq buffer-read-only nil
)
174 "TABLE-OF-CONTENTS on %s
175 SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
176 ------------------------------------------------------------------------------
177 " (abbreviate-file-name reftex-last-toc-master
)))
179 (if (reftex-use-fonts)
180 (put-text-property 1 (point) 'face reftex-toc-header-face
))
181 (put-text-property 1 (point) 'intangible t
)
182 (put-text-property 1 2 'xr-alist xr-alist
)
185 (reftex-insert-docstruct
188 reftex-toc-include-labels
189 reftex-toc-include-index-entries
190 reftex-toc-include-file-boundaries
191 reftex-toc-include-context
199 (run-hooks 'reftex-display-copied-context-hook
)
200 (message "Building *toc* buffer...done.")
201 (setq buffer-read-only t
))
203 ;; Only compute the offset
205 (or (reftex-get-offset this-buf here-I-am
206 (if reftex-toc-include-labels
" " nil
)
208 reftex-toc-include-index-entries
209 reftex-toc-include-file-boundaries
)
210 (reftex-last-assoc-before-elt
212 (symbol-value reftex-docstruct-symbol
))))
213 (put 'reftex-toc
:reftex-line
3)
215 (beginning-of-line)))
217 ;; Find the correct starting point
218 (reftex-find-start-point (point) offset
(get 'reftex-toc
:reftex-line
))
219 (setq reftex-last-follow-point
(point))))
221 (defun reftex-toc-recenter (&optional arg
)
222 "Display the TOC window and highlight line corresponding to current position."
224 (let ((buf (current-buffer)))
226 (if (= (count-lines 1 (point)) 2)
227 (let ((current-prefix-arg nil
))
228 (select-window (get-buffer-window buf
))
231 (not (get-text-property (point) 'intangible
))
232 (memq reftex-highlight-selection
'(cursor both
))
234 (or (previous-single-property-change
235 (min (point-max) (1+ (point))) :data
)
237 (or (next-single-property-change (point) :data
)
239 (select-window (get-buffer-window buf
))))
241 (defun reftex-toc-pre-command-hook ()
242 ;; used as pre command hook in *toc* buffer
243 (reftex-unhighlight 0)
244 ;; (reftex-unhighlight 1) ;; remove highlight on leaving buffer.
247 (defun reftex-toc-post-command-hook ()
248 ;; used in the post-command-hook for the *toc* buffer
249 (when (get-text-property (point) :data
)
250 (put 'reftex-toc
:reftex-data
(get-text-property (point) :data
))
252 (not (get-text-property (point) 'intangible
))
253 (memq reftex-highlight-selection
'(cursor both
))
255 (or (previous-single-property-change (1+ (point)) :data
)
257 (or (next-single-property-change (point) :data
)
259 (if (integerp reftex-toc-follow-mode
)
260 ;; remove delayed action
261 (setq reftex-toc-follow-mode t
)
262 (and reftex-toc-follow-mode
263 (not (equal reftex-last-follow-point
(point)))
264 ;; show context in other window
265 (setq reftex-last-follow-point
(point))
267 (reftex-toc-visit-location nil
(not reftex-revisit-to-follow
))
270 (defun reftex-re-enlarge ()
271 ;; Enlarge windiw to a remembered size
272 (if reftex-toc-split-windows-horizontally
273 (enlarge-window-horizontally
274 (max 0 (- (or reftex-last-window-width
(window-width))
277 (max 0 (- (or reftex-last-window-height
(window-height))
280 (defun reftex-toc-show-help ()
281 "Show a summary of special key bindings."
283 (with-output-to-temp-buffer "*RefTeX Help*"
284 (princ reftex-toc-help
))
285 (reftex-enlarge-to-fit "*RefTeX Help*" t
)
286 ;; If follow mode is active, arrange to delay it one command
287 (if reftex-toc-follow-mode
288 (setq reftex-toc-follow-mode
1)))
290 (defun reftex-toc-next (&optional arg
)
291 "Move to next selectable item."
293 (setq reftex-callback-fwd t
)
294 (or (eobp) (forward-char 1))
295 (goto-char (or (next-single-property-change (point) :data
)
297 (defun reftex-toc-previous (&optional arg
)
298 "Move to previous selectable item."
300 (setq reftex-callback-fwd nil
)
301 (goto-char (or (previous-single-property-change (point) :data
)
303 (defun reftex-toc-next-heading (&optional arg
)
304 "Move to next table of contentes line."
307 (re-search-forward "^ " nil t arg
)
309 (defun reftex-toc-previous-heading (&optional arg
)
310 "Move to previous table of contentes line."
312 (re-search-backward "^ " nil t arg
))
313 (defun reftex-toc-toggle-follow ()
314 "Toggle follow (other window follows with context)."
316 (setq reftex-last-follow-point -
1)
317 (setq reftex-toc-follow-mode
(not reftex-toc-follow-mode
)))
318 (defun reftex-toc-toggle-file-boundary ()
319 "Toggle inclusion of file boundaries in *toc* buffer."
321 (setq reftex-toc-include-file-boundaries
322 (not reftex-toc-include-file-boundaries
))
324 (defun reftex-toc-toggle-labels (arg)
325 "Toggle inclusion of labels in *toc* buffer.
326 With prefix ARG, prompt for a label type and include only labels of
329 (setq reftex-toc-include-labels
330 (if arg
(reftex-query-label-type)
331 (not reftex-toc-include-labels
)))
333 (defun reftex-toc-toggle-index (arg)
334 "Toggle inclusion of index in *toc* buffer.
335 With prefix arg, prompt for an index tag and include only entries of that
338 (setq reftex-toc-include-index-entries
339 (if arg
(reftex-index-select-tag)
340 (not reftex-toc-include-index-entries
)))
342 (defun reftex-toc-toggle-context ()
343 "Toggle inclusion of label context in *toc* buffer.
344 Label context is only displayed when the labels are there as well."
346 (setq reftex-toc-include-context
(not reftex-toc-include-context
))
348 (defun reftex-toc-max-level (arg)
349 "Set the maximum level of toc lines in this buffer to value of prefix ARG.
350 When no prefix is given, set the max level to a large number, so that all
351 levels are shown. For eaxample, to set the level to 3, type `3 m'."
353 (setq reftex-toc-max-level
(if arg
354 (prefix-numeric-value arg
)
356 (setq reftex-toc-max-level-indicator
357 (if arg
(int-to-string reftex-toc-max-level
) "ALL"))
359 (defun reftex-toc-view-line ()
360 "View document location in other window."
362 (reftex-toc-visit-location))
363 (defun reftex-toc-goto-line-and-hide ()
364 "Go to document location in other window. Hide the *toc* window."
366 (reftex-toc-visit-location 'hide
))
367 (defun reftex-toc-goto-line ()
368 "Go to document location in other window. *toc* window stays."
370 (reftex-toc-visit-location t
))
371 (defun reftex-toc-mouse-goto-line-and-hide (ev)
372 "Go to document location in other window. Hide the *toc* window."
375 (reftex-toc-visit-location 'hide
))
376 (defun reftex-toc-show-calling-point ()
377 "Show point where reftex-toc was called from."
379 (let ((this-window (selected-window)))
382 (switch-to-buffer-other-window
383 (marker-buffer reftex-toc-return-marker
))
384 (goto-char (marker-position reftex-toc-return-marker
))
386 (select-window this-window
))))
387 (defun reftex-toc-quit ()
388 "Hide the *toc* window and do not move point."
390 (or (one-window-p) (delete-window))
391 (switch-to-buffer (marker-buffer reftex-toc-return-marker
))
393 (goto-char (or (marker-position reftex-toc-return-marker
) (point))))
394 (defun reftex-toc-quit-and-kill ()
395 "Kill the *toc* buffer."
397 (kill-buffer "*toc*")
398 (or (one-window-p) (delete-window))
399 (switch-to-buffer (marker-buffer reftex-toc-return-marker
))
401 (goto-char (marker-position reftex-toc-return-marker
)))
402 (defun reftex-toc-display-index (&optional arg
)
403 "Display the index buffer for the current document.
404 This works just like `reftex-display-index' from a LaTeX buffer.
405 With prefix arg 1, restrict index to the section at point."
407 (let ((data (get-text-property (point) :data
))
408 (docstruct (symbol-value reftex-docstruct-symbol
))
411 (setq bor
(reftex-last-assoc-before-elt 'toc data docstruct
)
412 eor
(assoc 'toc
(cdr (memq bor docstruct
)))
413 restr
(list (nth 6 bor
) bor eor
)))
414 (reftex-toc-goto-line)
415 (reftex-display-index (if restr nil arg
) restr
)))
416 (defun reftex-toc-rescan (&rest ignore
)
417 "Regenerate the *toc* buffer by reparsing file of section at point."
419 (if (and reftex-enable-partial-scans
420 (null current-prefix-arg
))
421 (let* ((data (get-text-property (point) :data
))
423 (file (cond ((eq what
'toc
) (nth 3 data
))
424 ((memq what
'(eof bof file-error
)) (nth 1 data
))
425 ((stringp what
) (nth 3 data
))
426 ((eq what
'index
) (nth 3 data
))))
427 (line (+ (count-lines (point-min) (point)) (if (bolp) 1 0))))
429 (error "Don't know which file to rescan. Try `C-u r'")
430 (put 'reftex-toc
:reftex-line line
)
431 (switch-to-buffer-other-window
432 (reftex-get-file-buffer-force file
))
433 (setq current-prefix-arg
'(4))
434 (let ((reftex-rebuilding-toc t
))
437 (reftex-kill-temporary-buffers))
438 (defun reftex-toc-Rescan (&rest ignore
)
439 "Regenerate the *toc* buffer by reparsing the entire document."
441 (let* ((line (+ (count-lines (point-min) (point)) (if (bolp) 1 0))))
442 (put 'reftex-toc
:reftex-line line
))
443 (switch-to-buffer-other-window
444 (reftex-get-file-buffer-force reftex-last-toc-file
))
445 (setq current-prefix-arg
'(16))
446 (let ((reftex-rebuilding-toc t
))
448 (defun reftex-toc-revert (&rest ignore
)
449 "Regenerate the *toc* from the internal lists."
451 (switch-to-buffer-other-window
452 (reftex-get-file-buffer-force reftex-last-toc-file
))
453 (reftex-erase-buffer "*toc*")
454 (setq current-prefix-arg nil
)
455 (let ((reftex-rebuilding-toc t
))
457 (defun reftex-toc-external (&rest ignore
)
458 "Switch to table of contents of an external document."
460 (let* ((old-buf (current-buffer))
461 (xr-alist (get-text-property 1 'xr-alist
))
462 (xr-index (reftex-select-external-document
464 (switch-to-buffer-other-window (or (reftex-get-file-buffer-force
465 (cdr (nth xr-index xr-alist
)))
466 (error "Cannot switch document")))
468 (if (equal old-buf
(current-buffer))
470 (message "Switched document"))))
472 (defun reftex-toc-jump (arg)
473 "Jump to a specific section. E.g. '3 z' jumps to section 3.
474 Useful for large TOC's."
476 (goto-char (point-min))
478 (concat "^ *" (number-to-string (if (numberp arg
) arg
1)) " ")
482 (defun reftex-toc-visit-location (&optional final no-revisit
)
483 ;; Visit the tex file corresponding to the toc entry on the current line.
484 ;; If FINAL is t, stay there
485 ;; If FINAL is 'hide, hide the *toc* window.
486 ;; Otherwise, move cursor back into *toc* window.
487 ;; NO-REVISIT means don't visit files, just use live biffers.
488 ;; This function is pretty clever about finding back a section heading,
489 ;; even if the buffer is not live, or things like outline, x-symbol etc.
492 (let* ((toc (get-text-property (point) :data
))
493 (toc-window (selected-window))
494 show-window show-buffer match
)
496 (unless toc
(error "Don't know which toc line to visit"))
502 (setq match
(reftex-toc-find-section toc no-revisit
)))
504 ((eq (car toc
) 'index
)
506 (setq match
(reftex-index-show-entry toc no-revisit
)))
508 ((memq (car toc
) '(bof eof
))
511 (let ((where (car toc
))
513 (if (or (not no-revisit
) (reftex-get-buffer-visiting file
))
515 (switch-to-buffer-other-window
516 (reftex-get-file-buffer-force file nil
))
517 (goto-char (if (eq where
'bof
) (point-min) (point-max))))
518 (message reftex-no-follow-message
) nil
))))
522 (setq match
(reftex-show-label-location toc reftex-callback-fwd
525 (setq show-window
(selected-window)
526 show-buffer
(current-buffer))
529 (select-window toc-window
)
530 (error "Cannot find location"))
532 (select-window toc-window
)
534 ;; use the `final' parameter to decide what to do next
537 (reftex-unhighlight 0)
538 (select-window show-window
))
540 (reftex-unhighlight 0)
541 (or (one-window-p) (delete-window))
542 (switch-to-buffer show-buffer
)
546 (defun reftex-toc-find-section (toc &optional no-revisit
)
547 (let* ((file (nth 3 toc
))
550 (literal (nth 7 toc
))
551 (emergency-point (nth 8 toc
))
554 ((and (markerp marker
) (marker-buffer marker
))
555 ;; Buffer is still live and we have the marker. Should be easy.
556 (switch-to-buffer-other-window (marker-buffer marker
))
557 (goto-char (marker-position marker
))
558 (or (looking-at (regexp-quote literal
))
559 (looking-at (reftex-make-regexp-allow-for-ctrl-m literal
))
560 (looking-at (reftex-make-desperate-section-regexp literal
))
561 (looking-at (concat "\\\\"
565 reftex-section-levels-all
)))
567 ((or (not no-revisit
)
568 (reftex-get-buffer-visiting file
))
569 ;; Marker is lost. Use the backup method.
570 (switch-to-buffer-other-window
571 (reftex-get-file-buffer-force file nil
))
572 (goto-char (or emergency-point
(point-min)))
573 (or (looking-at (regexp-quote literal
))
574 (let ((len (length literal
)))
575 (or (reftex-nearest-match (regexp-quote literal
) len
)
576 (reftex-nearest-match
577 (reftex-make-regexp-allow-for-ctrl-m literal
) len
)
578 (reftex-nearest-match
579 (reftex-make-desperate-section-regexp literal
) len
)))))
580 (t (message reftex-no-follow-message
) nil
))))
582 (goto-char (match-beginning 0))
583 (if (not (= (point) (point-max))) (recenter 1))
584 (reftex-highlight 0 (match-beginning 0) (match-end 0) (current-buffer)))
587 (defun reftex-make-desperate-section-regexp (old)
588 ;; Return a regexp which will still match a section statement even if
589 ;; x-symbol or isotex or the like have been at work in the mean time.
590 (let* ((n (1+ (string-match "[[{]" old
)))
591 (new (regexp-quote (substring old
0 (1+ (string-match "[[{]" old
)))))
592 (old (substring old n
)))
594 "\\([\r\n]\\)\\|\\(\\`\\|[ \t\n\r]\\)\\([a-zA-Z0-9]+\\)\\([ \t\n\r]\\|}\\'\\)"
596 (if (match-beginning 1)
597 (setq new
(concat new
"[^\n\r]*[\n\r]"))
598 (setq new
(concat new
"[^\n\r]*" (match-string 3 old
))))
599 (setq old
(substring old
(match-end 0))))
603 (defun reftex-recenter-toc-when-idle ()
604 (and (> (buffer-size) 5)
606 (not (active-minibuffer-window))
607 (fboundp 'reftex-toc-mode
)
608 (get-buffer-window "*toc*")
609 (string= reftex-last-toc-master
(reftex-TeX-master-file))
610 (reftex-toc-recenter)))
612 (defun reftex-toggle-auto-toc-recenter ()
613 "Toggle the automatic recentering of the toc window.
614 When active, leaving point idle will make the toc window jump to the correct
617 (if reftex-toc-auto-recenter-timer
619 (if (featurep 'xemacs
)
620 (delete-itimer reftex-toc-auto-recenter-timer
)
621 (cancel-timer reftex-toc-auto-recenter-timer
))
622 (setq reftex-toc-auto-recenter-timer nil
)
623 (message "Automatic recentering of toc buffer was turned off"))
624 (setq reftex-toc-auto-recenter-timer
625 (if (featurep 'xemacs
)
626 (start-itimer "RefTeX Idle Timer for recenter"
627 'reftex-recenter-toc-when-idle
628 reftex-idle-time reftex-idle-time t
)
630 reftex-idle-time t
'reftex-recenter-toc-when-idle
)))
631 (message "Automatic recentering of toc window was turned on")))
634 ;; Table of Contents map
635 (define-key reftex-toc-map
(if (featurep 'xemacs
) [(button2)] [(mouse-2)])
636 'reftex-toc-mouse-goto-line-and-hide
)
638 (substitute-key-definition
639 'next-line
'reftex-toc-next reftex-toc-map global-map
)
640 (substitute-key-definition
641 'previous-line
'reftex-toc-previous reftex-toc-map global-map
)
644 '(("n" . reftex-toc-next
)
645 ("p" . reftex-toc-previous
)
646 ("?" . reftex-toc-show-help
)
647 (" " . reftex-toc-view-line
)
648 ("\C-m" . reftex-toc-goto-line-and-hide
)
649 ("\C-i" . reftex-toc-goto-line
)
650 ("\C-c>". reftex-toc-display-index
)
651 ("r" . reftex-toc-rescan
)
652 ("R" . reftex-toc-Rescan
)
653 ("g" . revert-buffer
)
654 ("q" . reftex-toc-quit
)
655 ("k" . reftex-toc-quit-and-kill
)
656 ("f" . reftex-toc-toggle-follow
)
657 ("a" . reftex-toggle-auto-toc-recenter
)
658 ("F" . reftex-toc-toggle-file-boundary
)
659 ("i" . reftex-toc-toggle-index
)
660 ("l" . reftex-toc-toggle-labels
)
661 ("t" . reftex-toc-max-level
)
662 ("c" . reftex-toc-toggle-context
)
663 ("%" . reftex-toc-toggle-commented
)
664 ("x" . reftex-toc-external
)
665 ("z" . reftex-toc-jump
)
666 ("." . reftex-toc-show-calling-point
)
667 ("\C-c\C-n" . reftex-toc-next-heading
)
668 ("\C-c\C-p" . reftex-toc-previous-heading
))
669 do
(define-key reftex-toc-map
(car x
) (cdr x
)))
671 (loop for key across
"0123456789" do
672 (define-key reftex-toc-map
(vector (list key
)) 'digit-argument
))
673 (define-key reftex-toc-map
"-" 'negative-argument
)
676 reftex-toc-menu reftex-toc-map
677 "Menu for Table of Contents buffer"
679 ["Show Location" reftex-toc-view-line t
]
680 ["Go To Location" reftex-toc-goto-line t
]
681 ["Exit & Go To Location" reftex-toc-goto-line-and-hide t
]
682 ["Index" reftex-toc-display-index t
]
683 ["Quit" reftex-toc-quit t
]
685 ["External Document TOC " reftex-toc-external t
]
688 ["Rebuilt *toc* Buffer" revert-buffer t
]
689 ["Rescan One File" reftex-toc-rescan reftex-enable-partial-scans
]
690 ["Rescan Entire Document" reftex-toc-Rescan t
])
693 ["File Boundaries" reftex-toc-toggle-file-boundary
:style toggle
694 :selected reftex-toc-include-file-boundaries
]
695 ["Labels" reftex-toc-toggle-labels
:style toggle
696 :selected reftex-toc-include-labels
]
697 ["Index Entries" reftex-toc-toggle-index
:style toggle
698 :selected reftex-toc-include-index-entries
]
699 ["Context" reftex-toc-toggle-context
:style toggle
700 :selected reftex-toc-include-context
]
702 ["Follow Mode" reftex-toc-toggle-follow
:style toggle
703 :selected reftex-toc-follow-mode
])
705 ["Help" reftex-toc-show-help t
]))
708 ;;; reftex-toc.el ends here