/[emacs]/emacs/lisp/textmodes/texinfo.el
ViewVC logotype

Diff of /emacs/lisp/textmodes/texinfo.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.85 by monnier, Thu Oct 25 05:22:30 2001 UTC revision 1.86 by bob, Tue Dec 25 16:16:22 2001 UTC
# Line 872  with @-sign commands for @chapter, @sect Line 872  with @-sign commands for @chapter, @sect
872    
873  Lines with structuring commands beginning in them are displayed in  Lines with structuring commands beginning in them are displayed in
874  another buffer named `*Occur*'.  In that buffer, you can move point to  another buffer named `*Occur*'.  In that buffer, you can move point to
875  one of those lines and then use \\<occur-mode-map>\\[occur-mode-goto-occurrence],  one of those lines and then use
876    \\<occur-mode-map>\\[occur-mode-goto-occurrence],
877  to jump to the corresponding spot in the Texinfo source file."  to jump to the corresponding spot in the Texinfo source file."
878    
879    (interactive "P")    (interactive "P")
880    (save-excursion    ;; 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*")
902      (goto-char (point-min))      (goto-char (point-min))
903      (if nodes-too      (let ((inhibit-read-only t))
904          (occur (concat "^@node\\>\\|" outline-regexp))        (flush-lines "-----")
905        (occur outline-regexp)))        ;; Now format the "*Occur*" buffer to show the structure.
906    (pop-to-buffer "*Occur*")        ;; Thanks to ceder@signum.se (Per Cederqvist)
907    (goto-char (point-min))        (goto-char (point-max))
908    (let ((inhibit-read-only t))        (let (level)
909      (flush-lines "-----")          (while (re-search-backward "^ *[0-9]*:@\\(\\sw+\\)" nil 0)
910      ;; Now format the "*Occur*" buffer to show the structure.            (goto-char (1- (match-beginning 1)))
911      ;; Thanks to ceder@signum.se (Per Cederqvist)            (setq level
912      (goto-char (point-max))                  (or (cadr (assoc (match-string 1) texinfo-section-list)) 2))
913      (let (level)            (indent-to-column (+ (current-column) (* 4 (- level 2))))
914        (while (re-search-backward "^ *[0-9]*:@\\(\\sw+\\)" nil 0)            (beginning-of-line))))
915          (goto-char (1- (match-beginning 1)))      ;; Third, go to line corresponding to location in source file
916          (setq level (or (cadr (assoc (match-string 1) texinfo-section-list)) 2))      ;; potential bug: two exactly similar `current-location' lines ...
917          (indent-to-column (+ (current-column) (* 4 (- level 2))))      (goto-char (point-min))
918          (beginning-of-line)))))      (re-search-forward current-location nil t)
919        (beginning-of-line)
920        ))
921    
922    
923  ;;; The  tex  and  print  function definitions:  ;;; The  tex  and  print  function definitions:
924    

Legend:
Removed from v.1.85  
changed lines
  Added in v.1.86

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26