aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-05-15 15:17:41 +0000
committerRichard M. Stallman1996-05-15 15:17:41 +0000
commita5e2ae0112c49ab972ecb214b6d11e83233e6148 (patch)
tree7cff4be65053a6b639b8f93862a660e594df4d82
parent2806002f190c75750a350cb161ed38c83fdeefe7 (diff)
downloademacs-a5e2ae0112c49ab972ecb214b6d11e83233e6148.tar.gz
emacs-a5e2ae0112c49ab972ecb214b6d11e83233e6148.zip
(latex-imenu-create-index):
Change the regexp to match the * versions of commands. (latex-mode): Make imenu-create-index-function buffer-local.
-rw-r--r--lisp/textmodes/tex-mode.el34
1 files changed, 19 insertions, 15 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index f0a99ba5c8f..565a8d13e76 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -179,19 +179,23 @@ Set by \\[tex-region], \\[tex-buffer], and \\[tex-file].")
179(defvar tex-mode-syntax-table nil 179(defvar tex-mode-syntax-table nil
180 "Syntax table used while in TeX mode.") 180 "Syntax table used while in TeX mode.")
181 181
182;; Written by Wolfgang Bangerth <zcg51122@rpool1.rus.uni-stuttgart.de> 182(defun latex-imenu-create-index ()
183(defvar latex-imenu-generic-expression 183 "Generates an alist for imenu from a LaTeX buffer."
184 '( 184 (let (result temp)
185 ("Part" "\\\\part{\\([^}]*\\)}" 1) 185 (goto-char (point-max))
186 ("Chapter" "\\\\chapter{\\([^}]*\\)}" 1) 186 (while (re-search-backward "\\\\\\(part\\|chapter\\|\
187 ("Section" "\\\\[a-zA-Z]*section{\\([^}]*\\)}" 1) 187\\(sub\\)?\\(\\(sub\\)?section\\|paragraph\\)\\)\\*?[ \t\n]*{\\([^}]*\\)}" nil t)
188 ;; i put numbers like 3.15 before my 188 (setq temp
189 ;; \begin{equation}'s which tell me 189 (assoc (buffer-substring-no-properties (match-beginning 1)
190 ;; the number the equation will get when 190 (match-end 1))
191 ;; being printed. 191 '(("part" . "") ("chapter" . " ")
192 ("Equations" "%[ \t]*\\([0-9]+\\.[0-9]+\\)[,;]?[ \t]?" 1)) 192 ("section" . " ") ("subsection" . " ")
193 193 ("subsubsection" . " ")
194 "Imenu generic expression for LaTex mode. See `imenu-generic-expression'.") 194 ("paragraph" . " ") ("subparagraph" . " "))))
195 (setq result (cons (cons (concat (cdr temp) (match-string 5))
196 (match-beginning 0))
197 result)))
198 result))
195 199
196(defun tex-define-common-keys (keymap) 200(defun tex-define-common-keys (keymap)
197 "Define the keys that we want defined both in TeX mode and in the TeX shell." 201 "Define the keys that we want defined both in TeX mode and in the TeX shell."
@@ -430,8 +434,8 @@ subshell is initiated, `tex-shell-hook' is run."
430\\\\[a-z]*space\\|\\\\[a-z]*skip\\|\ 434\\\\[a-z]*space\\|\\\\[a-z]*skip\\|\
431\\\\newpage\\|\\\\[a-z]*page[a-z]*\\|\\\\footnote\\|\ 435\\\\newpage\\|\\\\[a-z]*page[a-z]*\\|\\\\footnote\\|\
432\\\\marginpar\\|\\\\parbox\\|\\\\caption\\)[ \t]*\\($\\|%\\)") 436\\\\marginpar\\|\\\\parbox\\|\\\\caption\\)[ \t]*\\($\\|%\\)")
433 (make-local-variable 'imenu-generic-expression) 437 (make-local-variable 'imenu-create-index-function)
434 (setq imenu-generic-expression latex-imenu-generic-expression) 438 (setq imenu-create-index-function 'latex-imenu-create-index)
435 (make-local-variable 'tex-face-alist) 439 (make-local-variable 'tex-face-alist)
436 (setq tex-face-alist tex-latex-face-alist) 440 (setq tex-face-alist tex-latex-face-alist)
437 (run-hooks 'text-mode-hook 'tex-mode-hook 'latex-mode-hook)) 441 (run-hooks 'text-mode-hook 'tex-mode-hook 'latex-mode-hook))