(defvar TeX-mode-syntax-table nil "Syntax table used while in TeX mode.") (defvar TeX-zap-file nil "Temporary file name used for text being sent as input to TeX.") (defvar TeX-command "cd /tmp; tex" "The command to run TeX on a file in /tmp, to make output in /tmp.") (defvar TeX-dvi-print-command "lpr -d" "Command string used to print a .dvi file.") (defvar TeX-trailer "\\bye " "TeX input supplied after the end of a region sent to TeX by M-x TeX-region.") (defvar TeX-mode-map nil) (if TeX-mode-map nil (setq TeX-mode-map (make-sparse-keymap)) (define-key TeX-mode-map " " (quote TeX-terminate-paragraph)) (define-key TeX-mode-map "{" (quote TeX-insert-braces)) (define-key TeX-mode-map "}" (quote up-list)) (define-key TeX-mode-map "\"" (quote TeX-insert-quote)) (define-key TeX-mode-map "" (quote TeX-region)) (define-key TeX-mode-map "" (quote TeX-buffer)) (define-key TeX-mode-map "" (quote TeX-print))) (defun TeX-insert-quote (count) "\ Insert ``, '' or \" according to preceding character. With numeric arg N, always insert N \" characters." (interactive "P") (byte-code " !0 o !!) Ȃ/ hU* ʂ/ / c" [count t nil self-insert-command forward-char -1 looking-at "[ ]\\|\\s(" "``" 92 34 "''"] 5)) (defun validate-TeX-buffer nil "\ Check current buffer for paragraphs containing mismatched $'s. As each such paragraph is found, a mark is pushed at its beginning, and the location is displayed for a few seconds." (interactive) (byte-code "`dbÎ ? o?3 ` #` \". `!!!) ))" [opoint end nil ((byte-code "b" [opoint] 1)) input-pending-p search-backward " " move TeX-validate-paragraph push-mark message "Mismatch found in pararaph starting here" sit-for 4] 8)) (defun TeX-validate-paragraph (start end) (byte-code "ŏ" [nil start end t (byte-code " \"b Z! ))" [start end t narrow-to-region forward-sexp] 4) ((error (byte-code "" [nil] 1)))] 3)) (defun TeX-terminate-paragraph (inhibit-validation) "\ Insert two newlines, breaking a paragraph for TeX. Check for mismatched braces/$'s in paragraph being terminated. A prefix arg inhibits the checking." (interactive "P") (byte-code " #`)`\" !c" [inhibit-validation nil TeX-validate-paragraph search-backward " " move message "Paragraph being closed appears to contain a mismatch"] 5)) (defun TeX-insert-braces nil "\ Make a pair of braces and be poised to type inside of them." (interactive) (byte-code "cc)" [nil 123 125] 1)) (defun tex-mode nil "\ Major mode for editing files of input for TeX. Makes $ and } display the characters they match. Makes \" insert `` when it seems to be the beginning of a quotation, and '' when it appears to be the end; it inserts \" only after a \\. Use M-x validate-TeX-buffer to check buffer for paragraphs containing mismatched $'s or braces. Use C-c C-r to run TeX on the current region, plus a \"header\" copied from the top of the file (containing macro definitions, etc.), running TeX under a special subshell. C-c C-b does the whole buffer. C-c C-p prints the .dvi file made by either of those. Special commands: \\{TeX-mode-map} Entering TeX mode calls the value of text-mode-hook, and then the value of TeX-mode-hook." (interactive) (byte-code "ˈ !Ήω ?C !\"\"\"\"\"\"F !!߉!!! ! \"" [TeX-mode-map mode-name major-mode local-abbrev-table text-mode-abbrev-table TeX-mode-syntax-table paragraph-start paragraph-separate comment-start comment-start-skip comment-indent-hook nil kill-all-local-variables use-local-map "TeX" TeX-mode make-syntax-table set-syntax-table modify-syntax-entry 92 "\\ " 36 "$$ " 37 "< " 12 "> " 10 39 "w " make-local-variable "^ " "%" "[^\\]\\(\\\\\\\\\\)*%+ *" TeX-comment-indent run-hooks text-mode-hook TeX-mode-hook] 19)) (defun TeX-comment-indent nil (byte-code "! i !iT]" [comment-column looking-at "%%%" skip-chars-backward " "] 4)) (defun TeX-region (beg end) "\ Run TeX on current region. Optionally process buffer's header first. The buffer's header is everything up to a line saying \"%**end of header\". It is processed as input by TeX before the region itself. The file has a header if one of the first ten lines says \"%**start of header\". The value of TeX-trailer is supplied as input to TeX after the region. It defaults to \"\\bye\\n\"." (interactive "r") (byte-code "Ɉ! !\" !Peb!`eb #9 ` WS !`! ` #X `` # $*) R\"){ \"| Ɉ!" [TeX-zap-file tex-out-file search-end hbeg t beg end TeX-command TeX-trailer nil get-buffer "*TeX-shell*" require shell make-shell "TeX-shell" "csh" make-temp-name "/tmp/tz" ".tex" forward-line 10 search-forward "%**start of header" 1 "%**end of header" beginning-of-line write-region send-string " " " " pop-to-buffer] 18)) (defun TeX-buffer nil "\ Run TeX on current buffer." (interactive) (byte-code "ed\")" [TeX-trailer nil TeX-region] 3)) (defun TeX-print nil "\ Print the .dvi file made by \\[TeX-region] or \\[TeX-buffer]." (interactive) (byte-code " R\"" [TeX-dvi-print-command TeX-zap-file nil send-string "TeX-shell" " " ".dvi "] 6))