diff options
| author | Richard M. Stallman | 1993-11-06 05:56:11 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-11-06 05:56:11 +0000 |
| commit | cf6d6e8acd48e3ed12435db16a55f3b35f6e302a (patch) | |
| tree | ec7cc855a83adb4591d27d77b2743b36b5fcb375 | |
| parent | 1bf96fb5d09ceea5262d7f084f1ddbee8d673e54 (diff) | |
| download | emacs-cf6d6e8acd48e3ed12435db16a55f3b35f6e302a.tar.gz emacs-cf6d6e8acd48e3ed12435db16a55f3b35f6e302a.zip | |
(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.
| -rw-r--r-- | lisp/textmodes/tex-mode.el | 102 |
1 files changed, 47 insertions, 55 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 92712689bd1..f91245c81d6 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -196,24 +196,16 @@ Set by \\[tex-region], \\[tex-buffer], and \\[tex-file].") | |||
| 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)) |
| 205 | (define-key keymap [menu-bar tex tex-view] '("Tex View" . tex-view)) | 203 | (define-key keymap [menu-bar tex tex-alt-print] |
| 204 | '("Tex Print (alt printer)" . tex-alt-print)) | ||
| 206 | (define-key keymap [menu-bar tex tex-print] '("Tex Print" . tex-print)) | 205 | (define-key keymap [menu-bar tex tex-print] '("Tex Print" . tex-print)) |
| 207 | (define-key keymap [menu-bar tex tex-recenter-output-buffer] | 206 | (define-key keymap [menu-bar tex tex-view] '("Tex View" . tex-view)) |
| 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 | 208 | ||
| 214 | (put 'tex-region 'menu-enable 'mark-active) | ||
| 215 | (put 'tex-validate-region 'menu-enable 'mark-active) | ||
| 216 | |||
| 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 |
| @@ -229,7 +221,25 @@ Set by \\[tex-region], \\[tex-buffer], and \\[tex-file].") | |||
| 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.") |
| @@ -976,6 +986,12 @@ is provided, use the alternative command, `tex-alt-dvi-print-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]. |
| @@ -986,52 +1002,28 @@ The variable `tex-dvi-view-command' specifies the shell command for preview." | |||
| 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 | 1026 | ||
| 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 | |||
| 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'." |