Commit cf6d6e8a authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(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.
parent 1bf96fb5
......@@ -196,24 +196,16 @@ Set by \\[tex-region], \\[tex-buffer], and \\[tex-file].")
(define-key keymap [menu-bar tex] (cons "TeX" (make-sparse-keymap "TeX")))
(define-key keymap [menu-bar tex tex-kill-job] '("Tex Kill" . tex-kill-job))
(define-key keymap [menu-bar tex tex-validate-region]
'("Validate Region" . tex-validate-region))
(define-key keymap [menu-bar tex validate-tex-buffer]
'("Validate Buffer" . validate-tex-buffer))
(define-key keymap [menu-bar tex tex-recenter-output-buffer]
'("Tex Recenter" . tex-recenter-output-buffer))
(define-key keymap [menu-bar tex tex-show-print-queue]
'("Show Print Queue" . tex-show-print-queue))
(define-key keymap [menu-bar tex tex-view] '("Tex View" . tex-view))
(define-key keymap [menu-bar tex tex-alt-print]
'("Tex Print (alt printer)" . tex-alt-print))
(define-key keymap [menu-bar tex tex-print] '("Tex Print" . tex-print))
(define-key keymap [menu-bar tex tex-recenter-output-buffer]
'("Tex Recenter" . tex-recenter-output-buffer))
(define-key keymap [menu-bar tex tex-file] '("Tex File" . tex-file))
(define-key keymap [menu-bar tex tex-region] '("Tex Region" . tex-region))
(define-key keymap [menu-bar tex tex-buffer] '("Tex Buffer" . tex-buffer))
(define-key keymap [menu-bar tex tex-view] '("Tex View" . tex-view))
)
(put 'tex-region 'menu-enable 'mark-active)
(put 'tex-validate-region 'menu-enable 'mark-active)
(defvar tex-mode-map nil "Keymap for TeX mode.")
(if tex-mode-map
......@@ -229,7 +221,25 @@ Set by \\[tex-region], \\[tex-buffer], and \\[tex-file].")
(define-key tex-mode-map "\C-c\C-f" 'tex-file)
(define-key tex-mode-map "\C-c\C-i" 'tex-bibtex-file)
(define-key tex-mode-map "\C-c\C-o" 'tex-latex-block)
(define-key tex-mode-map "\C-c\C-e" 'tex-close-latex-block))
(define-key tex-mode-map "\C-c\C-e" 'tex-close-latex-block)
(define-key tex-mode-map [menu-bar tex tex-validate-region]
'("Validate Region" . tex-validate-region))
(define-key tex-mode-map [menu-bar tex validate-tex-buffer]
'("Validate Buffer" . validate-tex-buffer))
(define-key tex-mode-map [menu-bar tex tex-region]
'("Tex Region" . tex-region))
(define-key tex-mode-map [menu-bar tex tex-buffer]
'("Tex Buffer" . tex-buffer))
(define-key tex-mode-map [menu-bar tex tex-file] '("Tex File" . tex-file)))
(put 'tex-region 'menu-enable 'mark-active)
(put 'tex-validate-region 'menu-enable 'mark-active)
(put 'tex-print 'menu-enable '(stringp tex-print-file))
(put 'tex-alt-print 'menu-enable '(stringp tex-print-file))
(put 'tex-view 'menu-enable '(stringp tex-print-file))
(put 'tex-recenter-output-buffer 'menu-enable '(get-buffer "*tex-shell*"))
(put 'tex-kill-job 'menu-enable '(tex-shell-running))
(defvar tex-shell-map nil
"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'."
(if alt tex-alt-dvi-print-command tex-dvi-print-command)
print-file-name-dvi t))))
(defun tex-alt-print ()
"Print the .dvi file made by \\[tex-region], \\[tex-buffer] or \\[tex-file].
Runs the shell command defined by tex-alt-dvi-print-command."
(interactive)
(tex-print t))
(defun tex-view ()
"Preview the last `.dvi' file made by running TeX under Emacs.
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."
(defun tex-append (file-name suffix)
"Append to FILENAME the suffix SUFFIX, using same algorithm TeX uses.
Scans for the first (not last) period.
Pascal-based TeX scans for the first period, C TeX uses the last.
No period is retained immediately before SUFFIX,
so normally SUFFIX starts with one."
(if (stringp file-name)
(let ((file (file-name-nondirectory file-name)))
(concat (file-name-directory file-name)
(substring file 0
(string-match "\\." file))
suffix))
(let ((file (file-name-nondirectory file-name))
trial-name)
;; try spliting on first period
(setq trial-name
(concat (file-name-directory file-name)
(substring file 0
(string-match "\\." file))
suffix))
(if (or (file-exists-p trial-name)
(file-exists-p (concat trial-name ".aux"))) ;for BibTeX files
trial-name
;; not found, so split on last period
(concat (file-name-directory file-name)
(substring file 0
(string-match "\\.[^.]*$" file))
suffix)))
" "))
;;; Use this code after discussing with rms. (bfox@ai.mit.edu)
;;; Date: Tue, 31 Aug 1993 14:30:26 EDT
;;; From: Stephen Gildea <gildea@expo2.x.org>
;;; Sender: gnulists@ai.mit.edu
;;; Resent-From: bug-gnu-emacs-request@prep.ai.mit.edu
;;;
;;; The function tex-append in Emacs 19.19 needs to be updated for the
;;; newer C version of TeX, which parses filenames differently.
;;; Pascal-based TeX scans for the first period; C TeX uses the last.
;;; Here is a version of tex-append which tries both ways.
;;;
;;; (defun tex-append (file-name suffix)
;;; "Append to FILENAME the suffix SUFFIX, using same algorithm TeX uses.
;;; Pascal-based TeX scans for the first period, C TeX uses the last.
;;; No period is retained immediately before SUFFIX,
;;; so normally SUFFIX starts with one."
;;; (if (stringp file-name)
;;; (let ((file (file-name-nondirectory file-name))
;;; trial-name)
;;; ;; try spliting on first period
;;; (setq trial-name
;;; (concat (file-name-directory file-name)
;;; (substring file 0
;;; (string-match "\\." file))
;;; suffix))
;;; (if (or (file-exists-p trial-name)
;;; (file-exists-p (concat trial-name ".aux"))) ;for BibTeX files
;;; trial-name
;;; ;; not found, so split on last period
;;; (concat (file-name-directory file-name)
;;; (substring file 0
;;; (string-match "\\.[^.]*$" file))
;;; suffix)))
;;; " "))
(defun tex-show-print-queue ()
"Show the print queue that \\[tex-print] put your job on.
Runs the shell command defined by `tex-show-queue-command'."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment