Mercurial > emacs
comparison lisp/textmodes/tex-mode.el @ 50943:654c1513e74a
(tex-mode-syntax-table): ~ is not whitespace.
(tex-guess-mode): Add `renewcommand'.
(tex-mode): Move the autoload so we get the correct docstring and usage.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sat, 10 May 2003 18:54:13 +0000 |
parents | 73473fb92184 |
children | aeb075459c1d |
comparison
equal
deleted
inserted
replaced
50942:46d187316243 | 50943:654c1513e74a |
---|---|
1 ;;; tex-mode.el --- TeX, LaTeX, and SliTeX mode commands -*- coding: utf-8 -*- | 1 ;;; tex-mode.el --- TeX, LaTeX, and SliTeX mode commands -*- coding: utf-8 -*- |
2 | 2 |
3 ;; Copyright (C) 1985, 86, 89, 92, 94, 95, 96, 97, 98, 1999, 2002 | 3 ;; Copyright (C) 1985,86,89,92,94,95,96,97,98,1999,2002,2003 |
4 ;; Free Software Foundation, Inc. | 4 ;; Free Software Foundation, Inc. |
5 | 5 |
6 ;; Maintainer: FSF | 6 ;; Maintainer: FSF |
7 ;; Keywords: tex | 7 ;; Keywords: tex |
8 | 8 |
283 (?\C-@ . "w") | 283 (?\C-@ . "w") |
284 (?' . "w") | 284 (?' . "w") |
285 (?@ . "_") | 285 (?@ . "_") |
286 (?* . "_") | 286 (?* . "_") |
287 (?\t . " ") | 287 (?\t . " ") |
288 (?~ . " ") | 288 ;; ~ is printed by TeX as a space, but it's semantics in the syntax |
289 ;; of TeX is not `whitespace' (i.e. it's just like \hspace{foo}). | |
290 (?~ . ".") | |
289 (?$ . "$$") | 291 (?$ . "$$") |
290 (?\\ . "/") | 292 (?\\ . "/") |
291 (?\" . ".") | 293 (?\" . ".") |
292 (?& . ".") | 294 (?& . ".") |
293 (?_ . ".") | 295 (?_ . ".") |
761 (if (looking-at | 763 (if (looking-at |
762 (eval-when-compile | 764 (eval-when-compile |
763 (concat | 765 (concat |
764 (regexp-opt '("documentstyle" "documentclass" | 766 (regexp-opt '("documentstyle" "documentclass" |
765 "begin" "subsection" "section" | 767 "begin" "subsection" "section" |
766 "part" "chapter" "newcommand") 'words) | 768 "part" "chapter" "newcommand" |
769 "renewcommand") 'words) | |
767 "\\|NeedsTeXFormat{LaTeX"))) | 770 "\\|NeedsTeXFormat{LaTeX"))) |
768 (if (looking-at | 771 (if (looking-at |
769 "document\\(style\\|class\\)\\(\\[.*\\]\\)?{slides}") | 772 "document\\(style\\|class\\)\\(\\[.*\\]\\)?{slides}") |
770 'slitex-mode | 773 'slitex-mode |
771 'latex-mode) | 774 'latex-mode) |
774 | 777 |
775 ;; `tex-mode' plays two roles: it's the parent of several sub-modes | 778 ;; `tex-mode' plays two roles: it's the parent of several sub-modes |
776 ;; but it's also the function that chooses between those submodes. | 779 ;; but it's also the function that chooses between those submodes. |
777 ;; To tell the difference between those two cases where the function | 780 ;; To tell the difference between those two cases where the function |
778 ;; might be called, we check `delay-mode-hooks'. | 781 ;; might be called, we check `delay-mode-hooks'. |
779 ;;;###autoload | |
780 (define-derived-mode tex-mode text-mode "generic-TeX" | 782 (define-derived-mode tex-mode text-mode "generic-TeX" |
781 (tex-common-initialization)) | 783 (tex-common-initialization)) |
782 (fset 'tex-mode | 784 ;; We now move the function and define it again. This gives a warning |
783 `(lambda () | 785 ;; in the byte-compiler :-( but it's difficult to avoid because |
784 "Major mode for editing files of input for TeX, LaTeX, or SliTeX. | 786 ;; `define-derived-mode' will necessarily define the function once |
787 ;; and we need to define it a second time for `autoload' to get the | |
788 ;; proper docstring. | |
789 (defalias 'tex-mode-internal (symbol-function 'tex-mode)) | |
790 ;;;###autoload | |
791 (defun tex-mode () | |
792 "Major mode for editing files of input for TeX, LaTeX, or SliTeX. | |
785 Tries to determine (by looking at the beginning of the file) whether | 793 Tries to determine (by looking at the beginning of the file) whether |
786 this file is for plain TeX, LaTeX, or SliTeX and calls `plain-tex-mode', | 794 this file is for plain TeX, LaTeX, or SliTeX and calls `plain-tex-mode', |
787 `latex-mode', or `slitex-mode', respectively. If it cannot be determined, | 795 `latex-mode', or `slitex-mode', respectively. If it cannot be determined, |
788 such as if there are no commands in the file, the value of `tex-default-mode' | 796 such as if there are no commands in the file, the value of `tex-default-mode' |
789 says which mode to use." | 797 says which mode to use." |
790 (interactive) | 798 (interactive) |
791 (if delay-mode-hooks | 799 (if delay-mode-hooks |
792 ;; We're called from one of the children already. | 800 ;; We're called from one of the children already. |
793 (funcall ,(symbol-function 'tex-mode)) | 801 (tex-mode-internal) |
794 (tex-guess-mode)))) | 802 (tex-guess-mode))) |
795 | 803 |
796 ;;;###autoload | 804 ;;;###autoload |
797 (defalias 'TeX-mode 'tex-mode) | 805 (defalias 'TeX-mode 'tex-mode) |
798 ;;;###autoload | 806 ;;;###autoload |
799 (defalias 'plain-TeX-mode 'plain-tex-mode) | 807 (defalias 'plain-TeX-mode 'plain-tex-mode) |