95 |
q / k Hide/Kill *toc* buffer, return to position of reftex-toc command. |
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. |
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). |
t Change maximum toc depth (e.g. `3 t' hides levels greater than 3). |
98 |
f / g Toggle follow mode on and off / Refresh *toc* buffer. |
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. |
r / C-u r Reparse the LaTeX document / Reparse entire LaTeX document. |
100 |
. In other window, show position from where `reftex-toc' was called. |
. In other window, show position from where `reftex-toc' was called. |
101 |
x Switch to TOC of external document (with LaTeX package `xr'). |
x Switch to TOC of external document (with LaTeX package `xr'). |
132 |
(docstruct-symbol reftex-docstruct-symbol) |
(docstruct-symbol reftex-docstruct-symbol) |
133 |
(xr-data (assq 'xr (symbol-value reftex-docstruct-symbol))) |
(xr-data (assq 'xr (symbol-value reftex-docstruct-symbol))) |
134 |
(xr-alist (cons (cons "" (buffer-file-name)) (nth 1 xr-data))) |
(xr-alist (cons (cons "" (buffer-file-name)) (nth 1 xr-data))) |
135 |
(here-I-am (if rebuild |
(here-I-am (if (boundp 'reftex-rebuilding-toc) |
136 |
(get 'reftex-toc :reftex-data) |
(get 'reftex-toc :reftex-data) |
137 |
(car (reftex-where-am-I)))) |
(car (reftex-where-am-I)))) |
138 |
offset) |
offset) |
218 |
(reftex-find-start-point (point) offset (get 'reftex-toc :reftex-line)) |
(reftex-find-start-point (point) offset (get 'reftex-toc :reftex-line)) |
219 |
(setq reftex-last-follow-point (point)))) |
(setq reftex-last-follow-point (point)))) |
220 |
|
|
221 |
|
(defun reftex-toc-recenter (&optional arg) |
222 |
|
"Display the TOC window and highlight line corresponding to current position." |
223 |
|
(interactive "P") |
224 |
|
(let ((buf (current-buffer))) |
225 |
|
(reftex-toc arg) |
226 |
|
(if (= (count-lines 1 (point)) 2) |
227 |
|
(let ((current-prefix-arg nil)) |
228 |
|
(select-window (get-buffer-window buf)) |
229 |
|
(reftex-toc nil))) |
230 |
|
(and (> (point) 1) |
231 |
|
(not (get-text-property (point) 'intangible)) |
232 |
|
(memq reftex-highlight-selection '(cursor both)) |
233 |
|
(reftex-highlight 2 |
234 |
|
(or (previous-single-property-change |
235 |
|
(min (point-max) (1+ (point))) :data) |
236 |
|
(point-min)) |
237 |
|
(or (next-single-property-change (point) :data) |
238 |
|
(point-max)))) |
239 |
|
(select-window (get-buffer-window buf)))) |
240 |
|
|
241 |
(defun reftex-toc-pre-command-hook () |
(defun reftex-toc-pre-command-hook () |
242 |
;; used as pre command hook in *toc* buffer |
;; used as pre command hook in *toc* buffer |
243 |
(reftex-unhighlight 0) |
(reftex-unhighlight 0) |
244 |
(reftex-unhighlight 1)) |
;; (reftex-unhighlight 1) ;; remove highlight on leaving buffer. |
245 |
|
) |
246 |
|
|
247 |
(defun reftex-toc-post-command-hook () |
(defun reftex-toc-post-command-hook () |
248 |
;; used in the post-command-hook for the *toc* buffer |
;; used in the post-command-hook for the *toc* buffer |
251 |
(and (> (point) 1) |
(and (> (point) 1) |
252 |
(not (get-text-property (point) 'intangible)) |
(not (get-text-property (point) 'intangible)) |
253 |
(memq reftex-highlight-selection '(cursor both)) |
(memq reftex-highlight-selection '(cursor both)) |
254 |
(reftex-highlight 1 |
(reftex-highlight 2 |
255 |
(or (previous-single-property-change (1+ (point)) :data) |
(or (previous-single-property-change (1+ (point)) :data) |
256 |
(point-min)) |
(point-min)) |
257 |
(or (next-single-property-change (point) :data) |
(or (next-single-property-change (point) :data) |
431 |
(switch-to-buffer-other-window |
(switch-to-buffer-other-window |
432 |
(reftex-get-file-buffer-force file)) |
(reftex-get-file-buffer-force file)) |
433 |
(setq current-prefix-arg '(4)) |
(setq current-prefix-arg '(4)) |
434 |
(reftex-toc t))) |
(let ((reftex-rebuilding-toc t)) |
435 |
|
(reftex-toc)))) |
436 |
(reftex-toc-Rescan)) |
(reftex-toc-Rescan)) |
437 |
(reftex-kill-temporary-buffers)) |
(reftex-kill-temporary-buffers)) |
438 |
(defun reftex-toc-Rescan (&rest ignore) |
(defun reftex-toc-Rescan (&rest ignore) |
439 |
"Regenerate the *toc* buffer by reparsing the entire document." |
"Regenerate the *toc* buffer by reparsing the entire document." |
440 |
(interactive) |
(interactive) |
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 |
(switch-to-buffer-other-window |
444 |
(reftex-get-file-buffer-force reftex-last-toc-file)) |
(reftex-get-file-buffer-force reftex-last-toc-file)) |
445 |
(setq current-prefix-arg '(16)) |
(setq current-prefix-arg '(16)) |
446 |
(reftex-toc t)) |
(let ((reftex-rebuilding-toc t)) |
447 |
|
(reftex-toc))) |
448 |
(defun reftex-toc-revert (&rest ignore) |
(defun reftex-toc-revert (&rest ignore) |
449 |
"Regenerate the *toc* from the internal lists." |
"Regenerate the *toc* from the internal lists." |
450 |
(interactive) |
(interactive) |
452 |
(reftex-get-file-buffer-force reftex-last-toc-file)) |
(reftex-get-file-buffer-force reftex-last-toc-file)) |
453 |
(reftex-erase-buffer "*toc*") |
(reftex-erase-buffer "*toc*") |
454 |
(setq current-prefix-arg nil) |
(setq current-prefix-arg nil) |
455 |
(reftex-toc t)) |
(let ((reftex-rebuilding-toc t)) |
456 |
|
(reftex-toc t))) |
457 |
(defun reftex-toc-external (&rest ignore) |
(defun reftex-toc-external (&rest ignore) |
458 |
"Switch to table of contents of an external document." |
"Switch to table of contents of an external document." |
459 |
(interactive) |
(interactive) |
599 |
(setq old (substring old (match-end 0)))) |
(setq old (substring old (match-end 0)))) |
600 |
new)) |
new)) |
601 |
|
|
602 |
|
|
603 |
|
(defun reftex-recenter-toc-when-idle () |
604 |
|
(and (> (buffer-size) 5) |
605 |
|
reftex-mode |
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))) |
611 |
|
|
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 |
615 |
|
section." |
616 |
|
(interactive) |
617 |
|
(if reftex-toc-auto-recenter-timer |
618 |
|
(progn |
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) |
629 |
|
(run-with-idle-timer |
630 |
|
reftex-idle-time t 'reftex-recenter-toc-when-idle))) |
631 |
|
(message "Automatic recentering of toc window was turned on"))) |
632 |
|
|
633 |
|
|
634 |
;; Table of Contents map |
;; Table of Contents map |
635 |
(define-key reftex-toc-map (if (featurep 'xemacs) [(button2)] [(mouse-2)]) |
(define-key reftex-toc-map (if (featurep 'xemacs) [(button2)] [(mouse-2)]) |
636 |
'reftex-toc-mouse-goto-line-and-hide) |
'reftex-toc-mouse-goto-line-and-hide) |
654 |
("q" . reftex-toc-quit) |
("q" . reftex-toc-quit) |
655 |
("k" . reftex-toc-quit-and-kill) |
("k" . reftex-toc-quit-and-kill) |
656 |
("f" . reftex-toc-toggle-follow) |
("f" . reftex-toc-toggle-follow) |
657 |
|
("a" . reftex-toggle-auto-toc-recenter) |
658 |
("F" . reftex-toc-toggle-file-boundary) |
("F" . reftex-toc-toggle-file-boundary) |
659 |
("i" . reftex-toc-toggle-index) |
("i" . reftex-toc-toggle-index) |
660 |
("l" . reftex-toc-toggle-labels) |
("l" . reftex-toc-toggle-labels) |