aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert J. Chassell2001-12-25 16:16:22 +0000
committerRobert J. Chassell2001-12-25 16:16:22 +0000
commitaae61ef39093f430366a5e81f3afbbb88db32e68 (patch)
treece9a487efca70fbe7be434477920d1aee7e5bc0f
parentd4bb58885ad7aa49783e98d63ff57355e088d28b (diff)
downloademacs-aae61ef39093f430366a5e81f3afbbb88db32e68.tar.gz
emacs-aae61ef39093f430366a5e81f3afbbb88db32e68.zip
(texinfo-show-structure): Display the line showing the current location
in the middle of the window.
-rw-r--r--lisp/textmodes/texinfo.el61
1 files changed, 43 insertions, 18 deletions
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 5cdcd317775..ffabcefe366 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -872,28 +872,53 @@ with @-sign commands for @chapter, @section, and the like, and list
872 872
873Lines with structuring commands beginning in them are displayed in 873Lines with structuring commands beginning in them are displayed in
874another buffer named `*Occur*'. In that buffer, you can move point to 874another buffer named `*Occur*'. In that buffer, you can move point to
875one of those lines and then use \\<occur-mode-map>\\[occur-mode-goto-occurrence], 875one of those lines and then use
876\\<occur-mode-map>\\[occur-mode-goto-occurrence],
876to jump to the corresponding spot in the Texinfo source file." 877to jump to the corresponding spot in the Texinfo source file."
877 878
878 (interactive "P") 879 (interactive "P")
879 (save-excursion 880 ;; First, remember current location
881 (let ((source-buffer (current-buffer))
882 current-location)
883 (save-excursion
884 (end-of-line) ; so as to find section on current line
885 (if (re-search-backward
886 ;; do not require `texinfo-section-types-regexp' in texnfo-upd.el
887 "^@\\(chapter \\|sect\\|subs\\|subh\\|unnum\\|major\\|chapheading \\|heading \\|appendix\\)"
888 nil t)
889 (setq current-location
890 (progn
891 (beginning-of-line)
892 (buffer-substring (point) (progn (end-of-line) (point)))))
893 ;; else point is located before before any section command
894 (setq current-location "tex")))
895 ;; Second, create and format an *Occur* buffer
896 (save-excursion
897 (goto-char (point-min))
898 (if nodes-too
899 (occur (concat "^@node\\>\\|" outline-regexp))
900 (occur outline-regexp)))
901 (pop-to-buffer "*Occur*")
880 (goto-char (point-min)) 902 (goto-char (point-min))
881 (if nodes-too 903 (let ((inhibit-read-only t))
882 (occur (concat "^@node\\>\\|" outline-regexp)) 904 (flush-lines "-----")
883 (occur outline-regexp))) 905 ;; Now format the "*Occur*" buffer to show the structure.
884 (pop-to-buffer "*Occur*") 906 ;; Thanks to ceder@signum.se (Per Cederqvist)
885 (goto-char (point-min)) 907 (goto-char (point-max))
886 (let ((inhibit-read-only t)) 908 (let (level)
887 (flush-lines "-----") 909 (while (re-search-backward "^ *[0-9]*:@\\(\\sw+\\)" nil 0)
888 ;; Now format the "*Occur*" buffer to show the structure. 910 (goto-char (1- (match-beginning 1)))
889 ;; Thanks to ceder@signum.se (Per Cederqvist) 911 (setq level
890 (goto-char (point-max)) 912 (or (cadr (assoc (match-string 1) texinfo-section-list)) 2))
891 (let (level) 913 (indent-to-column (+ (current-column) (* 4 (- level 2))))
892 (while (re-search-backward "^ *[0-9]*:@\\(\\sw+\\)" nil 0) 914 (beginning-of-line))))
893 (goto-char (1- (match-beginning 1))) 915 ;; Third, go to line corresponding to location in source file
894 (setq level (or (cadr (assoc (match-string 1) texinfo-section-list)) 2)) 916 ;; potential bug: two exactly similar `current-location' lines ...
895 (indent-to-column (+ (current-column) (* 4 (- level 2)))) 917 (goto-char (point-min))
896 (beginning-of-line))))) 918 (re-search-forward current-location nil t)
919 (beginning-of-line)
920 ))
921
897 922
898;;; The tex and print function definitions: 923;;; The tex and print function definitions:
899 924