Mercurial > emacs
comparison lisp/textmodes/tex-mode.el @ 4917:550746214170
(tex-alt-print): New function for menu bar.
(tex-define-common-keys, tex-mode-map): Move some items from
tex-define-common-keys to tex-mode-map.
Add more menu-enable properties.
(tex-append): Cope with both the original
Pascal-based TeX and the newer C-based TeX.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 06 Nov 1993 05:56:11 +0000 |
parents | bca0ff204d70 |
children | a7b2df620d1a |
comparison
equal
deleted
inserted
replaced
4916:83db42883f64 | 4917:550746214170 |
---|---|
194 (define-key keymap "\C-c\C-v" 'tex-view) | 194 (define-key keymap "\C-c\C-v" 'tex-view) |
195 | 195 |
196 (define-key keymap [menu-bar tex] (cons "TeX" (make-sparse-keymap "TeX"))) | 196 (define-key keymap [menu-bar tex] (cons "TeX" (make-sparse-keymap "TeX"))) |
197 | 197 |
198 (define-key keymap [menu-bar tex tex-kill-job] '("Tex Kill" . tex-kill-job)) | 198 (define-key keymap [menu-bar tex tex-kill-job] '("Tex Kill" . tex-kill-job)) |
199 (define-key keymap [menu-bar tex tex-validate-region] | 199 (define-key keymap [menu-bar tex tex-recenter-output-buffer] |
200 '("Validate Region" . tex-validate-region)) | 200 '("Tex Recenter" . tex-recenter-output-buffer)) |
201 (define-key keymap [menu-bar tex validate-tex-buffer] | |
202 '("Validate Buffer" . validate-tex-buffer)) | |
203 (define-key keymap [menu-bar tex tex-show-print-queue] | 201 (define-key keymap [menu-bar tex tex-show-print-queue] |
204 '("Show Print Queue" . tex-show-print-queue)) | 202 '("Show Print Queue" . tex-show-print-queue)) |
203 (define-key keymap [menu-bar tex tex-alt-print] | |
204 '("Tex Print (alt printer)" . tex-alt-print)) | |
205 (define-key keymap [menu-bar tex tex-print] '("Tex Print" . tex-print)) | |
205 (define-key keymap [menu-bar tex tex-view] '("Tex View" . tex-view)) | 206 (define-key keymap [menu-bar tex tex-view] '("Tex View" . tex-view)) |
206 (define-key keymap [menu-bar tex tex-print] '("Tex Print" . tex-print)) | |
207 (define-key keymap [menu-bar tex tex-recenter-output-buffer] | |
208 '("Tex Recenter" . tex-recenter-output-buffer)) | |
209 (define-key keymap [menu-bar tex tex-file] '("Tex File" . tex-file)) | |
210 (define-key keymap [menu-bar tex tex-region] '("Tex Region" . tex-region)) | |
211 (define-key keymap [menu-bar tex tex-buffer] '("Tex Buffer" . tex-buffer)) | |
212 ) | 207 ) |
213 | |
214 (put 'tex-region 'menu-enable 'mark-active) | |
215 (put 'tex-validate-region 'menu-enable 'mark-active) | |
216 | 208 |
217 (defvar tex-mode-map nil "Keymap for TeX mode.") | 209 (defvar tex-mode-map nil "Keymap for TeX mode.") |
218 | 210 |
219 (if tex-mode-map | 211 (if tex-mode-map |
220 nil | 212 nil |
227 (define-key tex-mode-map "\C-c\C-r" 'tex-region) | 219 (define-key tex-mode-map "\C-c\C-r" 'tex-region) |
228 (define-key tex-mode-map "\C-c\C-b" 'tex-buffer) | 220 (define-key tex-mode-map "\C-c\C-b" 'tex-buffer) |
229 (define-key tex-mode-map "\C-c\C-f" 'tex-file) | 221 (define-key tex-mode-map "\C-c\C-f" 'tex-file) |
230 (define-key tex-mode-map "\C-c\C-i" 'tex-bibtex-file) | 222 (define-key tex-mode-map "\C-c\C-i" 'tex-bibtex-file) |
231 (define-key tex-mode-map "\C-c\C-o" 'tex-latex-block) | 223 (define-key tex-mode-map "\C-c\C-o" 'tex-latex-block) |
232 (define-key tex-mode-map "\C-c\C-e" 'tex-close-latex-block)) | 224 (define-key tex-mode-map "\C-c\C-e" 'tex-close-latex-block) |
225 (define-key tex-mode-map [menu-bar tex tex-validate-region] | |
226 '("Validate Region" . tex-validate-region)) | |
227 (define-key tex-mode-map [menu-bar tex validate-tex-buffer] | |
228 '("Validate Buffer" . validate-tex-buffer)) | |
229 (define-key tex-mode-map [menu-bar tex tex-region] | |
230 '("Tex Region" . tex-region)) | |
231 (define-key tex-mode-map [menu-bar tex tex-buffer] | |
232 '("Tex Buffer" . tex-buffer)) | |
233 (define-key tex-mode-map [menu-bar tex tex-file] '("Tex File" . tex-file))) | |
234 | |
235 (put 'tex-region 'menu-enable 'mark-active) | |
236 (put 'tex-validate-region 'menu-enable 'mark-active) | |
237 (put 'tex-print 'menu-enable '(stringp tex-print-file)) | |
238 (put 'tex-alt-print 'menu-enable '(stringp tex-print-file)) | |
239 (put 'tex-view 'menu-enable '(stringp tex-print-file)) | |
240 (put 'tex-recenter-output-buffer 'menu-enable '(get-buffer "*tex-shell*")) | |
241 (put 'tex-kill-job 'menu-enable '(tex-shell-running)) | |
242 | |
233 | 243 |
234 (defvar tex-shell-map nil | 244 (defvar tex-shell-map nil |
235 "Keymap for the tex-shell. A comint-mode-map with a few additions.") | 245 "Keymap for the tex-shell. A comint-mode-map with a few additions.") |
236 | 246 |
237 (defvar compare-windows-whitespace nil) ; Pacify the byte-compiler | 247 (defvar compare-windows-whitespace nil) ; Pacify the byte-compiler |
974 (error "No appropriate `.dvi' file could be found") | 984 (error "No appropriate `.dvi' file could be found") |
975 (tex-send-command | 985 (tex-send-command |
976 (if alt tex-alt-dvi-print-command tex-dvi-print-command) | 986 (if alt tex-alt-dvi-print-command tex-dvi-print-command) |
977 print-file-name-dvi t)))) | 987 print-file-name-dvi t)))) |
978 | 988 |
989 (defun tex-alt-print () | |
990 "Print the .dvi file made by \\[tex-region], \\[tex-buffer] or \\[tex-file]. | |
991 Runs the shell command defined by tex-alt-dvi-print-command." | |
992 (interactive) | |
993 (tex-print t)) | |
994 | |
979 (defun tex-view () | 995 (defun tex-view () |
980 "Preview the last `.dvi' file made by running TeX under Emacs. | 996 "Preview the last `.dvi' file made by running TeX under Emacs. |
981 This means, made using \\[tex-region], \\[tex-buffer] or \\[tex-file]. | 997 This means, made using \\[tex-region], \\[tex-buffer] or \\[tex-file]. |
982 The variable `tex-dvi-view-command' specifies the shell command for preview." | 998 The variable `tex-dvi-view-command' specifies the shell command for preview." |
983 (interactive) | 999 (interactive) |
984 (let ((tex-dvi-print-command tex-dvi-view-command)) | 1000 (let ((tex-dvi-print-command tex-dvi-view-command)) |
985 (tex-print))) | 1001 (tex-print))) |
986 | 1002 |
987 (defun tex-append (file-name suffix) | 1003 (defun tex-append (file-name suffix) |
988 "Append to FILENAME the suffix SUFFIX, using same algorithm TeX uses. | 1004 "Append to FILENAME the suffix SUFFIX, using same algorithm TeX uses. |
989 Scans for the first (not last) period. | 1005 Pascal-based TeX scans for the first period, C TeX uses the last. |
990 No period is retained immediately before SUFFIX, | 1006 No period is retained immediately before SUFFIX, |
991 so normally SUFFIX starts with one." | 1007 so normally SUFFIX starts with one." |
992 (if (stringp file-name) | 1008 (if (stringp file-name) |
993 (let ((file (file-name-nondirectory file-name))) | 1009 (let ((file (file-name-nondirectory file-name)) |
994 (concat (file-name-directory file-name) | 1010 trial-name) |
995 (substring file 0 | 1011 ;; try spliting on first period |
996 (string-match "\\." file)) | 1012 (setq trial-name |
997 suffix)) | 1013 (concat (file-name-directory file-name) |
1014 (substring file 0 | |
1015 (string-match "\\." file)) | |
1016 suffix)) | |
1017 (if (or (file-exists-p trial-name) | |
1018 (file-exists-p (concat trial-name ".aux"))) ;for BibTeX files | |
1019 trial-name | |
1020 ;; not found, so split on last period | |
1021 (concat (file-name-directory file-name) | |
1022 (substring file 0 | |
1023 (string-match "\\.[^.]*$" file)) | |
1024 suffix))) | |
998 " ")) | 1025 " ")) |
999 | |
1000 ;;; Use this code after discussing with rms. (bfox@ai.mit.edu) | |
1001 ;;; Date: Tue, 31 Aug 1993 14:30:26 EDT | |
1002 ;;; From: Stephen Gildea <gildea@expo2.x.org> | |
1003 ;;; Sender: gnulists@ai.mit.edu | |
1004 ;;; Resent-From: bug-gnu-emacs-request@prep.ai.mit.edu | |
1005 ;;; | |
1006 ;;; The function tex-append in Emacs 19.19 needs to be updated for the | |
1007 ;;; newer C version of TeX, which parses filenames differently. | |
1008 ;;; Pascal-based TeX scans for the first period; C TeX uses the last. | |
1009 ;;; Here is a version of tex-append which tries both ways. | |
1010 ;;; | |
1011 ;;; (defun tex-append (file-name suffix) | |
1012 ;;; "Append to FILENAME the suffix SUFFIX, using same algorithm TeX uses. | |
1013 ;;; Pascal-based TeX scans for the first period, C TeX uses the last. | |
1014 ;;; No period is retained immediately before SUFFIX, | |
1015 ;;; so normally SUFFIX starts with one." | |
1016 ;;; (if (stringp file-name) | |
1017 ;;; (let ((file (file-name-nondirectory file-name)) | |
1018 ;;; trial-name) | |
1019 ;;; ;; try spliting on first period | |
1020 ;;; (setq trial-name | |
1021 ;;; (concat (file-name-directory file-name) | |
1022 ;;; (substring file 0 | |
1023 ;;; (string-match "\\." file)) | |
1024 ;;; suffix)) | |
1025 ;;; (if (or (file-exists-p trial-name) | |
1026 ;;; (file-exists-p (concat trial-name ".aux"))) ;for BibTeX files | |
1027 ;;; trial-name | |
1028 ;;; ;; not found, so split on last period | |
1029 ;;; (concat (file-name-directory file-name) | |
1030 ;;; (substring file 0 | |
1031 ;;; (string-match "\\.[^.]*$" file)) | |
1032 ;;; suffix))) | |
1033 ;;; " ")) | |
1034 | 1026 |
1035 (defun tex-show-print-queue () | 1027 (defun tex-show-print-queue () |
1036 "Show the print queue that \\[tex-print] put your job on. | 1028 "Show the print queue that \\[tex-print] put your job on. |
1037 Runs the shell command defined by `tex-show-queue-command'." | 1029 Runs the shell command defined by `tex-show-queue-command'." |
1038 (interactive) | 1030 (interactive) |