annotate lisp/auctex/auc-old.el @ 100:4be1180a9e89 r20-1b2

Import from CVS: tag r20-1b2
author cvs
date Mon, 13 Aug 2007 09:15:11 +0200
parents 4103f0995bd7
children 441bb1e64a06
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
1 ;;; auc-old.el - Compatibility with AUC TeX 6.*
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
2 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
3 ;; Maintainer: Per Abrahamsen <auc-tex@sunsite.auc.dk>
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
4 ;; Version: 9.7i
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
5 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
6 ;; Copyright (C) 1991 Kresten Krab Thorup
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
7 ;; Copyright (C) 1993 Per Abrahamsen
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
8 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
9 ;; This program is free software; you can redistribute it and/or modify
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 1, or (at your option)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
12 ;; any later version.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
13 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
14 ;; This program is distributed in the hope that it will be useful,
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
17 ;; GNU General Public License for more details.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
18 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
20 ;; along with this program; if not, write to the Free Software
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
21 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
22
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
23 ;;; Commentary:
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
25 ;; This file contains an alternative keymapping, compatible with
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
26 ;; older versions of AUC TeX. You are strongly suggested to try the
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
27 ;; new keyboard layout, as we would like this file to go away
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
28 ;; eventually.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
29
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
30 ;;; Code:
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
31
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
32 (require 'latex)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
33
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
34 ;;; Keymaps
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
35
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
36 (defun TeX-define-key (key value)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
37 "OBSOLETE: Define KEY to VALUE in TeX and LaTeX mode."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
38 (define-key plain-TeX-mode-map key value)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
39 (define-key LaTeX-mode-map key value))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
40
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
41 (TeX-define-key "\n" 'TeX-terminate-paragraph)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
42 (TeX-define-key "\e}" 'up-list)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
43 (TeX-define-key "\e{" 'TeX-insert-braces)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
44 (TeX-define-key "\C-c\C-b" 'TeX-bold)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
45 (TeX-define-key "\C-c\C-i" 'TeX-italic)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
46 (TeX-define-key "\C-c\C-s" 'TeX-slanted)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
47 (TeX-define-key "\C-c\C-r" 'TeX-roman)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
48 (TeX-define-key "\C-c\C-e" 'TeX-emphasize)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
49 (TeX-define-key "\C-c\C-t" 'TeX-typewriter)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
50 (TeX-define-key "\C-c\C-y" 'TeX-small-caps)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
51 (TeX-define-key "\C-c\C-d" 'TeX-region)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
52 (TeX-define-key "\C-c\C-a" 'TeX-buffer)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
53 (TeX-define-key "\C-c\C-p" 'TeX-preview)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
54 (TeX-define-key "\C-c\C-n" 'TeX-next-error)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
55 (TeX-define-key "\C-c!" 'TeX-print)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
56 (TeX-define-key "\e\t" 'TeX-complete-symbol)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
57 (TeX-define-key "\C-c$" 'TeX-run-lacheck)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
58
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
59 (define-key LaTeX-mode-map "\C-c\n" 'TeX-terminate-paragraph)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
60 (define-key LaTeX-mode-map "\C-c\C-x" 'LaTeX-section)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
61 (define-key LaTeX-mode-map "\C-c\C-c" 'LaTeX-environment)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
62 (define-key LaTeX-mode-map "\C-c@" 'LaTeX-bibtex)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
63 (define-key LaTeX-mode-map "\C-c#" 'LaTeX-makeindex)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
64 (define-key LaTeX-mode-map "\em" 'LaTeX-math-mode)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
65 (define-key LaTeX-mode-map "\es" 'LaTeX-fill-section)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
66 (define-key LaTeX-mode-map "\e\C-e" 'LaTeX-mark-environment)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
67 (define-key LaTeX-mode-map "\e\C-x" 'LaTeX-mark-section)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
68 (define-key LaTeX-mode-map "\e\C-q" 'LaTeX-fill-environment)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
69
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
70 ;;; Buffer
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
71
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
72 (defun TeX-region (begin end)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
73 "OBSOLETE: Run TeX-command-default on current region."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
74 (interactive "r")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
75 (require 'tex-buf)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
76 (setq TeX-current-process-region-p t)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
77 (if (nth 4 (assoc TeX-command-default TeX-command-list))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
78 (TeX-region-create (TeX-region-file "tex")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
79 (buffer-substring begin end)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
80 (file-name-nondirectory (buffer-file-name))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
81 (count-lines (point-min) begin)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
82 (TeX-command TeX-command-default 'TeX-region-file))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
83
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
84 (defun TeX-buffer ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
85 "OBSOLETE: Run TeX-command-default on the current document."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
86 (interactive)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
87 (save-some-buffers) ; added for compatibility reasons
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
88 (require 'tex-buf)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
89 (setq TeX-current-process-region-p nil)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
90 (TeX-command TeX-command-default 'TeX-master-file))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
91
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
92 (defun TeX-old-command (name)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
93 "OBSOLETE: Run command NAME on either the current document or region."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
94 (require 'tex-buf)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
95 (if TeX-current-process-region-p
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
96 (TeX-command name 'TeX-region-file)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
97 (TeX-command name 'TeX-master-file)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
98
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
99 (defun TeX-preview ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
100 "OBSOLETE: Run View command on either the current document or region."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
101 (interactive)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
102 (TeX-old-command "View"))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
103
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
104 (defun TeX-print ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
105 "OBSOLETE: Run Print command on either the current document or region."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
106 (interactive)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
107 (TeX-old-command "Print"))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
108
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
109 (defun TeX-run-lacheck()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
110 "OBSOLETE: Run lacheck command on either the current document or region."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
111 (interactive)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
112 (TeX-old-command "Check"))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
113
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
114 (defun LaTeX-bibtex ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
115 "OBSOLETE: Run BibTeX command on either the current document or region."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
116 (interactive)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
117 (TeX-old-command TeX-command-BibTeX))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
118
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
119 (defun LaTeX-makeindex ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
120 "OBSOLETE: Run Index command on either the current document or region."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
121 (interactive)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
122 (TeX-old-command "Index"))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
123
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
124 ;;; Fonts
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
125
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
126 (defun TeX-bold ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
127 (interactive "*")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
128 (insert TeX-grop TeX-esc "bf " TeX-grcl)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
129 (backward-char 1))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
130
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
131 (defun TeX-italic ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
132 (interactive "*")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
133 (insert TeX-grop TeX-esc "it " TeX-esc "/" TeX-grcl)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
134 (backward-char 3))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
135
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
136 (defun TeX-slanted ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
137 (interactive "*")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
138 (insert TeX-grop TeX-esc "sl " TeX-esc "/" TeX-grcl)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
139 (backward-char 3))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
140
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
141 (defun TeX-roman ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
142 (interactive "*")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
143 (insert TeX-grop TeX-esc "rm " TeX-grcl)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
144 (backward-char 1))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
145
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
146 (defun TeX-emphasize ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
147 (interactive "*")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
148 (insert TeX-grop TeX-esc "em " TeX-esc "/" TeX-grcl)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
149 (backward-char 3))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
150
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
151 (defun TeX-typewriter ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
152 (interactive "*")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
153 (insert TeX-grop TeX-esc "tt " TeX-grcl)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
154 (backward-char 1))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
155
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
156 (defun TeX-small-caps ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
157 (interactive "*")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
158 (insert TeX-grop TeX-esc "sc " TeX-grcl)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
159 (backward-char 1))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
160
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
161 ;;; AUC (La)TeX Mode
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
162 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
163 ;; Added by marsj@ida.liu.se Thu Mar 5 17:52:38 1992 to support
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
164 ;; automatic mode change after using insert-mode-line hook. Also
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
165 ;; modified regexp to choose tex mode to be more aware of latex
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
166 ;; (documentstyle is uniq, isn'it)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
167
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
168 (defun insert-mode-line ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
169 "This little macro inserts `% -*- mode-name -*-' if not present.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
170 You should insert this in your TeX-mode-hook!"
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
171 (interactive "*")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
172 (save-excursion
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
173 (goto-char (point-min))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
174 (if (not (re-search-forward "-\\*-.*-\\*-" 100 t))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
175 (insert-string (concat "% -*- "
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
176 (substring (symbol-name major-mode) 0 -5)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
177 " -*-\n")))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
178
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
179 (defun auc-tex-mode ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
180 "Called when we have a mode line specification in first line."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
181 (interactive)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
182 (plain-tex-mode))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
183
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
184 (defun auc-latex-mode ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
185 "Called when we have a mode line specification in first line."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
186 (interactive)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
187 (latex-mode))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
188
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
189 ;;; Validation
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
190
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
191 (defun TeX-validate-buffer ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
192 "Check current buffer for paragraphs containing mismatched $'s.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
193 As each such paragraph is found, a mark is pushed at its beginning,
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
194 and the location is displayed for a few seconds."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
195 (interactive)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
196 (let ((opoint (point)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
197 (goto-char (point-max))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
198 ;; Does not use save-excursion
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
199 ;; because we do not want to save the mark.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
200 (unwind-protect
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
201 (while (and (not (input-pending-p)) (not (bobp)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
202 (let ((end (point)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
203 (search-backward "\n\n" nil 'move)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
204 (or (TeX-validate-paragraph (point) end)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
205 (progn
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
206 (push-mark (point))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
207 (message "Mismatch found in pararaph starting here")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
208 (sit-for 4)))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
209 (goto-char opoint))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
210
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
211 (defun TeX-validate-paragraph (start end)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
212 (condition-case ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
213 (save-excursion
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
214 (save-restriction
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
215 (narrow-to-region start end)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
216 (goto-char start)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
217 (forward-sexp (- end start))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
218 t))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
219 (error nil)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
220
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
221 (defun TeX-terminate-paragraph (inhibit-validation)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
222 "Insert two newlines, breaking a paragraph for TeX.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
223 Check for mismatched braces/$'s in paragraph being terminated.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
224 A prefix arg inhibits the checking."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
225 (interactive "*P")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
226 (or inhibit-validation
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
227 (TeX-validate-paragraph
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
228 (save-excursion
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
229 (search-backward "\n\n" nil 'move)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
230 (point))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
231 (point))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
232 (message "Paragraph being closed appears to contain a mismatch"))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
233 (reindent-then-newline-and-indent)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
234 (newline-and-indent))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
235
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
236 ;;; Miscellaneous
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
237
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
238 (defun TeX-cmd-on-region (begin end command)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
239 "Reads a (La)TeX-command. Makes current region a TeX-group.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
240 Inserts command at the start of the group."
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
241 (interactive "*r\ns(La)TeX-command on region: ")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
242 (save-excursion
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
243 (goto-char end) (insert TeX-grcl)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
244 (goto-char begin) (insert TeX-grop TeX-esc command " ")))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
245
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
246 (provide 'auc-old)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
247 (provide 'auc-tex)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
248
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
249 ;;; auc-old.el ends here