Mercurial > emacs
comparison lisp/textmodes/texinfo.el @ 88155:d7ddb3e565de
sync with trunk
author | Henrik Enberg <henrik.enberg@telia.com> |
---|---|
date | Mon, 16 Jan 2006 00:03:54 +0000 |
parents | 5ade352e8d1c |
children |
comparison
equal
deleted
inserted
replaced
88154:8ce476d3ba36 | 88155:d7ddb3e565de |
---|---|
1 ;;; texinfo.el --- major mode for editing Texinfo files | 1 ;;; texinfo.el --- major mode for editing Texinfo files -*- coding: iso-2022-7bit -*- |
2 | 2 |
3 ;; Copyright (C) 1985, '88, '89, '90, '91, '01, | 3 ;; Copyright (C) 1985, 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, |
4 ;; '92, '93, '96, '97, 2000 Free Software Foundation, Inc. | 4 ;; 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Robert J. Chassell | 6 ;; Author: Robert J. Chassell |
7 ;; Date: [See date below for texinfo-version] | 7 ;; Date: [See date below for texinfo-version] |
8 ;; Maintainer: bug-texinfo@gnu.org | 8 ;; Maintainer: FSF |
9 ;; Keywords: maint, tex, docs | 9 ;; Keywords: maint, tex, docs |
10 | 10 |
11 ;; This file is part of GNU Emacs. | 11 ;; This file is part of GNU Emacs. |
12 | 12 |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | 13 ;; GNU Emacs is free software; you can redistribute it and/or modify |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 ;; GNU General Public License for more details. | 21 ;; GNU General Public License for more details. |
22 | 22 |
23 ;; You should have received a copy of the GNU General Public License | 23 ;; You should have received a copy of the GNU General Public License |
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02111-1307, USA. | 26 ;; Boston, MA 02110-1301, USA. |
27 | 27 |
28 ;;; Todo: | 28 ;;; Todo: |
29 | 29 |
30 ;; - facemenu support. | 30 ;; - facemenu support. |
31 ;; - command completion. | |
31 | 32 |
32 ;;; Commentary: | 33 ;;; Commentary: |
33 | 34 |
34 ;;; Code: | 35 ;;; Code: |
35 | 36 |
39 (or (fboundp 'defcustom) | 40 (or (fboundp 'defcustom) |
40 (defmacro defcustom (var value doc &rest ignore) | 41 (defmacro defcustom (var value doc &rest ignore) |
41 `(defvar ,var ,value ,doc))) | 42 `(defvar ,var ,value ,doc))) |
42 | 43 |
43 (eval-when-compile (require 'tex-mode) (require 'cl)) | 44 (eval-when-compile (require 'tex-mode) (require 'cl)) |
45 (defvar outline-heading-alist) | |
44 | 46 |
45 (defgroup texinfo nil | 47 (defgroup texinfo nil |
46 "Texinfo Mode" | 48 "Texinfo Mode." |
49 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) | |
47 :group 'docs) | 50 :group 'docs) |
48 | 51 |
49 ;;;###autoload | 52 ;;;###autoload |
50 (defcustom texinfo-open-quote "``" | 53 (defcustom texinfo-open-quote "``" |
51 "*String inserted by typing \\[texinfo-insert-quote] to open a quotation." | 54 "*String inserted by typing \\[texinfo-insert-quote] to open a quotation." |
54 | 57 |
55 ;;;###autoload | 58 ;;;###autoload |
56 (defcustom texinfo-close-quote "''" | 59 (defcustom texinfo-close-quote "''" |
57 "*String inserted by typing \\[texinfo-insert-quote] to close a quotation." | 60 "*String inserted by typing \\[texinfo-insert-quote] to close a quotation." |
58 :type 'string | 61 :type 'string |
62 :group 'texinfo) | |
63 | |
64 (defcustom texinfo-mode-hook nil | |
65 "Normal hook run when entering Texinfo mode." | |
66 :type 'hook | |
67 :options '(turn-on-auto-fill flyspell-mode) | |
59 :group 'texinfo) | 68 :group 'texinfo) |
60 | 69 |
61 | 70 |
62 ;;; Autoloads: | 71 ;;; Autoloads: |
63 | 72 |
263 | 272 |
264 ;;; Don't you dare insert any `require' calls at top level in this file--rms. | 273 ;;; Don't you dare insert any `require' calls at top level in this file--rms. |
265 | 274 |
266 (defvar texinfo-section-list | 275 (defvar texinfo-section-list |
267 '(("top" 1) | 276 '(("top" 1) |
277 ("chapter" 2) | |
278 ("section" 3) | |
279 ("subsection" 4) | |
280 ("subsubsection" 5) | |
281 ("unnumbered" 2) | |
282 ("unnumberedsec" 3) | |
283 ("unnumberedsubsec" 4) | |
284 ("unnumberedsubsubsec" 5) | |
285 ("appendix" 2) | |
286 ("appendixsec" 3) | |
287 ("appendixsection" 3) | |
288 ("appendixsubsec" 4) | |
289 ("appendixsubsubsec" 5) | |
268 ("majorheading" 2) | 290 ("majorheading" 2) |
269 ("chapter" 2) | |
270 ("unnumbered" 2) | |
271 ("appendix" 2) | |
272 ("chapheading" 2) | 291 ("chapheading" 2) |
273 ("section" 3) | |
274 ("unnumberedsec" 3) | |
275 ("appendixsec" 3) | |
276 ("heading" 3) | 292 ("heading" 3) |
277 ("subsection" 4) | |
278 ("unnumberedsubsec" 4) | |
279 ("appendixsubsec" 4) | |
280 ("subheading" 4) | 293 ("subheading" 4) |
281 ("subsubsection" 5) | |
282 ("unnumberedsubsubsec" 5) | |
283 ("appendixsubsubsec" 5) | |
284 ("subsubheading" 5)) | 294 ("subsubheading" 5)) |
285 "Alist of sectioning commands and their relative level.") | 295 "Alist of sectioning commands and their relative level.") |
286 | 296 |
287 ;;; Syntax table | 297 ;;; Syntax table |
288 | 298 |
306 ;; To override this example, set either `imenu-generic-expression' | 316 ;; To override this example, set either `imenu-generic-expression' |
307 ;; or `imenu-create-index-function'. | 317 ;; or `imenu-create-index-function'. |
308 (defvar texinfo-imenu-generic-expression | 318 (defvar texinfo-imenu-generic-expression |
309 '((nil "^@\\(node\\|anchor\\)[ \t]+\\([^,\n]*\\)" 2) | 319 '((nil "^@\\(node\\|anchor\\)[ \t]+\\([^,\n]*\\)" 2) |
310 ("Chapters" "^@chapter[ \t]+\\(.*\\)$" 1)) | 320 ("Chapters" "^@chapter[ \t]+\\(.*\\)$" 1)) |
311 "Imenu generic expression for TexInfo mode. See `imenu-generic-expression'.") | 321 "Imenu generic expression for Texinfo mode. See `imenu-generic-expression'.") |
312 | 322 |
313 (defvar texinfo-font-lock-syntactic-keywords | 323 (defvar texinfo-font-lock-syntactic-keywords |
314 '(("\\(@\\)c\\(omment\\)?\\>" (1 "<")) | 324 '(("\\(@\\)c\\(omment\\)?\\>" (1 "<")) |
315 ("^\\(@\\)ignore\\>" (1 "< b")) | 325 ("^\\(@\\)ignore\\>" (1 "< b")) |
316 ("^@end ignore\\(\n\\)" (1 "> b"))) | 326 ("^@end ignore\\(\n\\)" (1 "> b"))) |
326 "ifhtml" "ifinfo" "ifnothtml" "ifnotinfo" "ifnotplaintext" | 336 "ifhtml" "ifinfo" "ifnothtml" "ifnotinfo" "ifnotplaintext" |
327 "ifnottex" "ifplaintext" "iftex" "ignore" "itemize" "lisp" | 337 "ifnottex" "ifplaintext" "iftex" "ignore" "itemize" "lisp" |
328 "macro" "menu" "multitable" "quotation" "smalldisplay" | 338 "macro" "menu" "multitable" "quotation" "smalldisplay" |
329 "smallexample" "smallformat" "smalllisp" "table" "tex" | 339 "smallexample" "smallformat" "smalllisp" "table" "tex" |
330 "titlepage" "verbatim" "vtable") | 340 "titlepage" "verbatim" "vtable") |
331 "List of TeXinfo environments.") | 341 "List of Texinfo environments.") |
332 | 342 |
333 (defconst texinfo-environment-regexp | 343 (defconst texinfo-environment-regexp |
334 (concat "^@" (regexp-opt (cons "end" texinfo-environments) t) "\\>") | 344 (concat "^@" (regexp-opt (cons "end" texinfo-environments) t) "\\>") |
335 "Regexp for environment-like TexInfo list commands. | 345 "Regexp for environment-like Texinfo list commands. |
336 Subexpression 1 is what goes into the corresponding `@end' statement.") | 346 Subexpression 1 is what goes into the corresponding `@end' statement.") |
337 | 347 |
338 (defface texinfo-heading-face | 348 (defface texinfo-heading |
339 '((t (:inherit font-lock-function-name-face))) | 349 '((t (:inherit font-lock-function-name-face))) |
340 "Face used for section headings in `texinfo-mode'.") | 350 "Face used for section headings in `texinfo-mode'." |
341 (defvar texinfo-heading-face 'texinfo-heading-face) | 351 :group 'texinfo) |
352 ;; backward-compatibility alias | |
353 (put 'texinfo-heading-face 'face-alias 'texinfo-heading) | |
354 (defvar texinfo-heading-face 'texinfo-heading) | |
342 | 355 |
343 (defvar texinfo-font-lock-keywords | 356 (defvar texinfo-font-lock-keywords |
344 `(;; All but the first had an OVERRIDE of t. | 357 `(;; All but the first had an OVERRIDE of t. |
345 ;; It didn't seem to be any better, and it's slower--simon. | 358 ;; It didn't seem to be any better, and it's slower--simon. |
346 ;; Robert J. Chassell <bob@gnu.org> says remove this line. | 359 ;; Robert J. Chassell <bob@gnu.org> says remove this line. |
363 ("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-keyword-face keep) | 376 ("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-keyword-face keep) |
364 ;; (,texinfo-environment-regexp | 377 ;; (,texinfo-environment-regexp |
365 ;; 1 (texinfo-clone-environment (match-beginning 1) (match-end 1)) keep) | 378 ;; 1 (texinfo-clone-environment (match-beginning 1) (match-end 1)) keep) |
366 (,(concat "^@" (regexp-opt (mapcar 'car texinfo-section-list) t) | 379 (,(concat "^@" (regexp-opt (mapcar 'car texinfo-section-list) t) |
367 ".*\n") 0 texinfo-heading-face t)) | 380 ".*\n") 0 texinfo-heading-face t)) |
368 "Additional expressions to highlight in TeXinfo mode.") | 381 "Additional expressions to highlight in Texinfo mode.") |
369 | 382 |
370 (defun texinfo-clone-environment (start end) | 383 (defun texinfo-clone-environment (start end) |
371 (let ((endp nil)) | 384 (let ((endp nil)) |
372 (save-excursion | 385 (save-excursion |
373 (ignore-errors | 386 (ignore-errors |
381 (texinfo-next-unmatched-end)) | 394 (texinfo-next-unmatched-end)) |
382 (skip-syntax-forward "^w") | 395 (skip-syntax-forward "^w") |
383 (when (looking-at | 396 (when (looking-at |
384 (concat (regexp-quote (buffer-substring start end)) "\\>")) | 397 (concat (regexp-quote (buffer-substring start end)) "\\>")) |
385 (text-clone-create start end 'spread "\\w*"))))))) | 398 (text-clone-create start end 'spread "\\w*"))))))) |
386 | |
387 (defun texinfo-outline-level () | |
388 ;; Calculate level of current texinfo outline heading. | |
389 (save-excursion | |
390 (if (bobp) | |
391 0 | |
392 (forward-char 1) | |
393 (let* ((word (buffer-substring-no-properties | |
394 (point) (progn (forward-word 1) (point)))) | |
395 (entry (assoc word texinfo-section-list))) | |
396 (if entry | |
397 (nth 1 entry) | |
398 5))))) | |
399 | 399 |
400 | 400 |
401 ;;; Keybindings | 401 ;;; Keybindings |
402 (defvar texinfo-mode-map nil) | 402 (defvar texinfo-mode-map nil) |
403 | 403 |
584 (concat | 584 (concat |
585 "^@node [ \t]*[Tt]op\\|^@\\(" | 585 "^@node [ \t]*[Tt]op\\|^@\\(" |
586 texinfo-chapter-level-regexp | 586 texinfo-chapter-level-regexp |
587 "\\)\\>")) | 587 "\\)\\>")) |
588 (make-local-variable 'require-final-newline) | 588 (make-local-variable 'require-final-newline) |
589 (setq require-final-newline t) | 589 (setq require-final-newline mode-require-final-newline) |
590 (make-local-variable 'indent-tabs-mode) | 590 (make-local-variable 'indent-tabs-mode) |
591 (setq indent-tabs-mode nil) | 591 (setq indent-tabs-mode nil) |
592 (make-local-variable 'paragraph-separate) | 592 (make-local-variable 'paragraph-separate) |
593 (setq paragraph-separate | 593 (setq paragraph-separate |
594 (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate)) | 594 (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate)) |
595 (make-local-variable 'paragraph-start) | 595 (make-local-variable 'paragraph-start) |
596 (setq paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start)) | 596 (setq paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start)) |
597 (make-local-variable 'sentence-end-base) | |
598 (setq sentence-end-base | |
599 "\\(@\\(end\\)?dots{}\\|[.?!]\\)[]\"'$B!I$,1r}(B)}]*") | |
597 (make-local-variable 'adaptive-fill-mode) | 600 (make-local-variable 'adaptive-fill-mode) |
598 (setq adaptive-fill-mode nil) | 601 (setq adaptive-fill-mode nil) |
599 (make-local-variable 'fill-column) | 602 (make-local-variable 'fill-column) |
600 (setq fill-column 70) | 603 (setq fill-column 70) |
601 (make-local-variable 'comment-start) | 604 (make-local-variable 'comment-start) |
611 (setq font-lock-defaults | 614 (setq font-lock-defaults |
612 '(texinfo-font-lock-keywords nil nil nil backward-paragraph | 615 '(texinfo-font-lock-keywords nil nil nil backward-paragraph |
613 (font-lock-syntactic-keywords | 616 (font-lock-syntactic-keywords |
614 . texinfo-font-lock-syntactic-keywords))) | 617 . texinfo-font-lock-syntactic-keywords))) |
615 (set (make-local-variable 'parse-sexp-lookup-properties) t) | 618 (set (make-local-variable 'parse-sexp-lookup-properties) t) |
616 (make-local-variable 'outline-regexp) | 619 |
617 (setq outline-regexp | 620 ;; Outline settings. |
618 (concat "@" (regexp-opt (mapcar 'car texinfo-section-list) t) "\\>")) | 621 (set (make-local-variable 'outline-heading-alist) |
619 (make-local-variable 'outline-level) | 622 ;; We should merge outline-heading-alist and texinfo-section-list |
620 (setq outline-level 'texinfo-outline-level) | 623 ;; but in the mean time, let's just generate one from the other. |
624 (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x))) | |
625 texinfo-section-list)) | |
626 (set (make-local-variable 'outline-regexp) | |
627 (concat (regexp-opt (mapcar 'car outline-heading-alist) t) | |
628 "\\>")) | |
629 | |
621 (make-local-variable 'tex-start-of-header) | 630 (make-local-variable 'tex-start-of-header) |
622 (setq tex-start-of-header "%\\*\\*start") | 631 (setq tex-start-of-header "%\\*\\*start") |
623 (make-local-variable 'tex-end-of-header) | 632 (make-local-variable 'tex-end-of-header) |
624 (setq tex-end-of-header "%\\*\\*end") | 633 (setq tex-end-of-header "%\\*\\*end") |
625 (make-local-variable 'tex-first-line-header-regexp) | 634 (make-local-variable 'tex-first-line-header-regexp) |
644 (define-skeleton texinfo-insert-block | 653 (define-skeleton texinfo-insert-block |
645 "Create a matching pair @<cmd> .. @end <cmd> at point. | 654 "Create a matching pair @<cmd> .. @end <cmd> at point. |
646 Puts point on a blank line between them." | 655 Puts point on a blank line between them." |
647 (setq texinfo-block-default | 656 (setq texinfo-block-default |
648 (completing-read (format "Block name [%s]: " texinfo-block-default) | 657 (completing-read (format "Block name [%s]: " texinfo-block-default) |
649 (mapcar 'list texinfo-environments) | 658 texinfo-environments |
650 nil nil nil nil texinfo-block-default)) | 659 nil nil nil nil texinfo-block-default)) |
651 \n "@" str \n _ \n "@end " str \n) | 660 \n "@" str \n _ \n "@end " str \n) |
652 | 661 |
653 (defun texinfo-inside-macro-p (macro &optional bound) | 662 (defun texinfo-inside-macro-p (macro &optional bound) |
654 "Non-nil if inside a macro matching the regexp MACRO." | 663 "Non-nil if inside a macro matching the regexp MACRO." |
670 "Non-nil if inside an environment matching the regexp @ENV." | 679 "Non-nil if inside an environment matching the regexp @ENV." |
671 (save-excursion | 680 (save-excursion |
672 (and (re-search-backward (concat "@\\(end\\s +\\)?" env) bound t) | 681 (and (re-search-backward (concat "@\\(end\\s +\\)?" env) bound t) |
673 (not (match-end 1))))) | 682 (not (match-end 1))))) |
674 | 683 |
684 (defvar texinfo-enable-quote-macros "@\\(code\\|samp\\|kbd\\)\\>") | |
685 (defvar texinfo-enable-quote-envs '("example\\>" "lisp\\>")) | |
675 (defun texinfo-insert-quote (&optional arg) | 686 (defun texinfo-insert-quote (&optional arg) |
676 "Insert the appropriate quote mark for TeXinfo. | 687 "Insert the appropriate quote mark for Texinfo. |
677 Usually inserts the value of `texinfo-open-quote' (normally ``) or | 688 Usually inserts the value of `texinfo-open-quote' (normally ``) or |
678 `texinfo-close-quote' (normally ''), depending on the context. | 689 `texinfo-close-quote' (normally ''), depending on the context. |
679 With prefix argument or inside @code or @example, inserts a plain \"." | 690 With prefix argument or inside @code or @example, inserts a plain \"." |
680 (interactive "*P") | 691 (interactive "*P") |
681 (let ((top (or (save-excursion (re-search-backward "@node\\>" nil t)) | 692 (let ((top (or (save-excursion (re-search-backward "@node\\>" nil t)) |
686 (backward-char (length texinfo-open-quote)) | 697 (backward-char (length texinfo-open-quote)) |
687 (when (or (looking-at texinfo-open-quote) | 698 (when (or (looking-at texinfo-open-quote) |
688 (looking-at texinfo-close-quote)) | 699 (looking-at texinfo-close-quote)) |
689 (delete-char (length texinfo-open-quote)) | 700 (delete-char (length texinfo-open-quote)) |
690 t)) | 701 t)) |
691 (texinfo-inside-macro-p "@\\(code\\|samp\\|kbd\\)\\>" top) | 702 (texinfo-inside-macro-p texinfo-enable-quote-macros top) |
692 (texinfo-inside-env-p "example\\>" top) | 703 (let ((in-env nil)) |
693 (texinfo-inside-env-p "lisp\\>" top)) | 704 (dolist (env texinfo-enable-quote-envs in-env) |
705 (if (texinfo-inside-env-p env top) | |
706 (setq in-env t))))) | |
694 (self-insert-command (prefix-numeric-value arg)) | 707 (self-insert-command (prefix-numeric-value arg)) |
695 (insert | 708 (insert |
696 (if (memq (char-syntax (preceding-char)) '(?\( ?> ?\ )) | 709 (if (memq (char-syntax (preceding-char)) '(?\( ?> ?\s)) |
697 texinfo-open-quote | 710 texinfo-open-quote |
698 texinfo-close-quote))))) | 711 texinfo-close-quote))))) |
699 | 712 |
700 ;; The following texinfo-insert-@end command not only inserts a SPC | 713 ;; The following texinfo-insert-@end command not only inserts a SPC |
701 ;; after the @end, but tries to find out what belongs there. It is | 714 ;; after the @end, but tries to find out what belongs there. It is |
796 The default is not to surround any existing words with the braces." | 809 The default is not to surround any existing words with the braces." |
797 (interactive "P") | 810 (interactive "P") |
798 (texinfo-insert-@-with-arg "file" arg)) | 811 (texinfo-insert-@-with-arg "file" arg)) |
799 | 812 |
800 (defun texinfo-insert-@item () | 813 (defun texinfo-insert-@item () |
801 "Insert the string `@item' in a Texinfo buffer." | 814 "Insert the string `@item' in a Texinfo buffer. |
802 (interactive) | 815 If in a table defined by @table, follow said string with a space. |
803 (insert "@item") | 816 Otherwise, follow with a newline." |
804 (newline)) | 817 (interactive) |
818 (insert "@item" | |
819 (if (equal (ignore-errors | |
820 (save-excursion | |
821 (texinfo-last-unended-begin) | |
822 (match-string 1))) | |
823 "table") | |
824 ?\s | |
825 ?\n))) | |
805 | 826 |
806 (defun texinfo-insert-@kbd (&optional arg) | 827 (defun texinfo-insert-@kbd (&optional arg) |
807 "Insert a `@kbd{...}' command in a Texinfo buffer. | 828 "Insert a `@kbd{...}' command in a Texinfo buffer. |
808 A numeric argument says how many words the braces should surround. | 829 A numeric argument says how many words the braces should surround. |
809 The default is not to surround any existing words with the braces." | 830 The default is not to surround any existing words with the braces." |
842 A numeric argument says how many words the braces should surround. | 863 A numeric argument says how many words the braces should surround. |
843 The default is not to surround any existing words with the braces." | 864 The default is not to surround any existing words with the braces." |
844 (interactive "P") | 865 (interactive "P") |
845 (texinfo-insert-@-with-arg "strong" arg)) | 866 (texinfo-insert-@-with-arg "strong" arg)) |
846 | 867 |
847 (defun texinfo-insert-@table (&optional arg) | 868 (defun texinfo-insert-@table () |
848 "Insert the string `@table' in a Texinfo buffer." | 869 "Insert the string `@table' in a Texinfo buffer." |
849 (interactive "P") | 870 (interactive) |
850 (insert "@table ")) | 871 (insert "@table ")) |
851 | 872 |
852 (defun texinfo-insert-@var (&optional arg) | 873 (defun texinfo-insert-@var (&optional arg) |
853 "Insert a `@var{}' command in a Texinfo buffer. | 874 "Insert a `@var{}' command in a Texinfo buffer. |
854 A numeric argument says how many words the braces should surround. | 875 A numeric argument says how many words the braces should surround. |
881 \\<occur-mode-map>\\[occur-mode-goto-occurrence], | 902 \\<occur-mode-map>\\[occur-mode-goto-occurrence], |
882 to jump to the corresponding spot in the Texinfo source file." | 903 to jump to the corresponding spot in the Texinfo source file." |
883 | 904 |
884 (interactive "P") | 905 (interactive "P") |
885 ;; First, remember current location | 906 ;; First, remember current location |
886 (let ((source-buffer (current-buffer)) | 907 (let (current-location) |
887 current-location) | |
888 (save-excursion | 908 (save-excursion |
889 (end-of-line) ; so as to find section on current line | 909 (end-of-line) ; so as to find section on current line |
890 (if (re-search-backward | 910 (if (re-search-backward |
891 ;; do not require `texinfo-section-types-regexp' in texnfo-upd.el | 911 ;; do not require `texinfo-section-types-regexp' in texnfo-upd.el |
892 "^@\\(chapter \\|sect\\|subs\\|subh\\|unnum\\|major\\|chapheading \\|heading \\|appendix\\)" | 912 "^@\\(chapter \\|sect\\|subs\\|subh\\|unnum\\|major\\|chapheading \\|heading \\|appendix\\)" |
893 nil t) | 913 nil t) |
894 (setq current-location | 914 (setq current-location |
895 (progn | 915 (progn |
896 (beginning-of-line) | 916 (beginning-of-line) |
897 (buffer-substring (point) (progn (end-of-line) (point))))) | 917 (buffer-substring (point) (progn (end-of-line) (point))))) |
898 ;; else point is located before before any section command | 918 ;; else point is located before any section command. |
899 (setq current-location "tex"))) | 919 (setq current-location "tex"))) |
900 ;; Second, create and format an *Occur* buffer | 920 ;; Second, create and format an *Occur* buffer |
901 (save-excursion | 921 (save-excursion |
902 (goto-char (point-min)) | 922 (goto-char (point-min)) |
903 (if nodes-too | 923 (occur (concat "^\\(?:" (if nodes-too "@node\\>\\|") |
904 (occur (concat "^@node\\>\\|" outline-regexp)) | 924 outline-regexp "\\)"))) |
905 (occur outline-regexp))) | |
906 (pop-to-buffer "*Occur*") | 925 (pop-to-buffer "*Occur*") |
907 (goto-char (point-min)) | 926 (goto-char (point-min)) |
908 (let ((inhibit-read-only t)) | 927 (let ((inhibit-read-only t)) |
909 (flush-lines "-----") | 928 (flush-lines "-----") |
910 ;; Now format the "*Occur*" buffer to show the structure. | 929 ;; Now format the "*Occur*" buffer to show the structure. |
1039 ;; job-number"\n")) | 1058 ;; job-number"\n")) |
1040 (tex-recenter-output-buffer nil)) | 1059 (tex-recenter-output-buffer nil)) |
1041 | 1060 |
1042 (provide 'texinfo) | 1061 (provide 'texinfo) |
1043 | 1062 |
1063 ;; arch-tag: 005d7c38-43b9-4b7d-aa1d-aea69bae73e1 | |
1044 ;;; texinfo.el ends here | 1064 ;;; texinfo.el ends here |