diff options
author | Richard M. Stallman <rms@gnu.org> | 1996-03-05 21:42:17 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1996-03-05 21:42:17 +0000 |
commit | 06f707653f26bcdd59950dc1b6138ad6680e2563 (patch) | |
tree | 3b1fc982c1b0dc541f0d15cfdeda2c2f7dac1ebf /lisp/textmodes | |
parent | 292edebf50bb809c0361ceb63f057147dae2c59c (diff) | |
download | emacs-06f707653f26bcdd59950dc1b6138ad6680e2563.tar.gz |
(texinfo-section-types-regexp)
(texinfo-section-level-regexp, texinfo-subsection-level-regexp)
(texinfo-subsubsection-level-regexp): Add defvars.
(texinfo-section-list): New variable.
(texinfo-outline-level): New function.
(texinfo-mode): Use them.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r-- | lisp/textmodes/texinfo.el | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el index 667d32de736..dbccaf130fd 100644 --- a/lisp/textmodes/texinfo.el +++ b/lisp/textmodes/texinfo.el @@ -223,6 +223,40 @@ chapter." ("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-function-name-face keep) ) "Additional expressions to highlight in TeXinfo mode.") + +(defvar texinfo-section-list + '(("top" 1) + ("majorheading" 1) + ("chapter" 2) + ("unnumbered" 2) + ("appendix" 2) + ("chapheading" 2) + ("section" 3) + ("unnumberedsec" 3) + ("appendixsec" 3) + ("heading" 3) + ("subsection" 4) + ("unnumberedsubsec" 4) + ("appendixsubsec" 4) + ("subheading" 4) + ("subsubsection" 5) + ("unnumberedsubsubsec" 5) + ("appendixsubsubsec" 5) + ("subsubheading" 5)) + "Alist of sectioning commands and their relative level.") + +(defun texinfo-outline-level () + ;; Calculate level of current texinfo outline heading. + (save-excursion + (if (bobp) + 0 + (forward-char 1) + (let* ((word (buffer-substring-no-properties + (point) (progn (forward-word 1) (point)))) + (entry (assoc word texinfo-section-list))) + (if entry + (nth 1 entry) + 5))))) ;;; Keybindings (defvar texinfo-mode-map nil) @@ -401,6 +435,13 @@ value of texinfo-mode-hook." (setq imenu-generic-expression texinfo-imenu-generic-expression) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(texinfo-font-lock-keywords t)) + (make-local-variable 'outline-regexp) + (setq outline-regexp + (concat "@\\(" + (mapconcat 'car texinfo-section-list "\\>\\|") + "\\>\\)")) + (make-local-variable 'outline-level) + (setq outline-level 'texinfo-outline-level) (make-local-variable 'tex-start-of-header) (setq tex-start-of-header "%**start") (make-local-variable 'tex-end-of-header) @@ -544,6 +585,12 @@ The default is not to surround any existing words with the braces." ;;; Texinfo file structure +;; These are defined in tenfo-upd.el. +(defvar texinfo-section-types-regexp) +(defvar texinfo-section-level-regexp) +(defvar texinfo-subsection-level-regexp) +(defvar texinfo-subsubsection-level-regexp) + (defun texinfo-show-structure (&optional nodes-too) "Show the structure of a Texinfo file. List the lines in the file that begin with the @-sign commands for |