4.4BSD/usr/src/contrib/emacs-18.57/lisp/tex-mode.elc


(provide (quote tex-mode))

(defvar TeX-directory "/tmp/" "\
*Directory in which to run TeX subjob.  Temporary files are
created in this directory.")

(defvar TeX-dvi-print-command "lpr -d" "\
*Command string used by \\[TeX-print] to print a .dvi file.")

(defvar TeX-show-queue-command "lpq" "\
*Command string used by \\[TeX-show-print-queue] to show the print queue
that \\[TeX-print] put your job on.")

(defvar TeX-default-mode (quote plain-TeX-mode) "\
*Mode to enter for a new file when it can't be determined whether
the file is plain TeX or LaTeX or what.")

(defvar TeX-command nil "\
The command to run TeX on a file.  The name of the file will be appended
to this string, separated by a space.")

(defvar TeX-trailer nil "\
String appended after the end of a region sent to TeX by \\[TeX-region].")

(defvar TeX-start-of-header nil "\
String used by \\[TeX-region] to delimit the start of the file's header.")

(defvar TeX-end-of-header nil "\
String used by \\[TeX-region] to delimit the end of the file's header.")

(defvar TeX-shell-cd-command "cd" "\
Command to give to shell running TeX to change directory.  The value of
TeX-directory will be appended to this, separated by a space.")

(defvar TeX-zap-file nil "\
Temporary file name used for text being sent as input to TeX.
Should be a simple file name with no extension or directory specification.")

(defvar TeX-mode-syntax-table nil "\
Syntax table used while in TeX mode.")

(defun TeX-define-common-keys (keymap) "\
Define the keys that we want defined both in TeX-mode
and in the TeX-shell." (byte-code "####" [keymap define-key "" TeX-kill-job "" TeX-recenter-output-buffer "" TeX-show-print-queue "" TeX-print] 7))

(defvar TeX-mode-map nil "\
Keymap for TeX mode")

(if TeX-mode-map nil (setq TeX-mode-map (make-sparse-keymap)) (TeX-define-common-keys TeX-mode-map) (define-key TeX-mode-map "\"" (quote TeX-insert-quote)) (define-key TeX-mode-map "
" (quote TeX-terminate-paragraph)) (define-key TeX-mode-map "}" (quote up-list)) (define-key TeX-mode-map "{" (quote TeX-insert-braces)) (define-key TeX-mode-map "" (quote TeX-region)) (define-key TeX-mode-map "" (quote TeX-buffer)) (define-key TeX-mode-map "" (quote TeX-close-LaTeX-block)))

(defvar TeX-shell-map nil "\
Keymap for the TeX shell.  A shell-mode-map with a few additions")

(defun tex-mode nil "\
Major mode for editing files of input for TeX or LaTeX.
Trys to intuit whether this file is for plain TeX or LaTeX and
calls plain-tex-mode or latex-mode.  If it cannot be determined
(e.g., there are no commands in the file), the value of
TeX-default-mode is used." (interactive) (byte-code "Èeb#%` 
#))-È	4
?D!A͂BΉ)P!T!+" [mode slash comment nil t search-end TeX-default-mode search-forward "\\" beginning-of-line "%" looking-at "documentstyle" latex-mode plain-tex-mode funcall] 7))

(fset (quote plain-TeX-mode) (quote plain-tex-mode))

(fset (quote LaTeX-mode) (quote latex-mode))

(defun plain-tex-mode nil "\
Major mode for editing files of input for plain 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 \\[TeX-region] 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.  \\[TeX-buffer] does the whole buffer.
\\[TeX-print] prints the .dvi file made by either of these.

Use \\[validate-TeX-buffer] to check buffer for paragraphs containing
mismatched $'s or braces.

Special commands:
\\{TeX-mode-map}

Mode variables:
TeX-directory
	Directory in which to create temporary files for TeX jobs
	run by \\[TeX-region] or \\[TeX-buffer].
TeX-dvi-print-command
	Command string used by \\[TeX-print] to print a .dvi file.
TeX-show-queue-command
	Command string used by \\[TeX-show-print-queue] to show the print
	queue that \\[TeX-print] put your job on.

Entering plain-TeX mode calls the value of text-mode-hook,
then the value of TeX-mode-hook, and then the value
of plain-TeX-mode-hook." (interactive) (byte-code "ƈ ȉɉʉˉ͉̉#" [mode-name major-mode TeX-command TeX-start-of-header TeX-end-of-header TeX-trailer nil TeX-common-initialization "TeX" plain-TeX-mode "tex" "%**start of header" "%**end of header" "\\bye
" run-hooks text-mode-hook TeX-mode-hook plain-TeX-mode-hook] 5))

(defun latex-mode nil "\
Major mode for editing files of input for LaTeX.
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 \\[TeX-region] to run LaTeX on the current region, plus the preamble
copied from the top of the file (containing \\documentstyle, etc.),
running LaTeX under a special subshell.  \\[TeX-buffer] does the whole buffer.
\\[TeX-print] prints the .dvi file made by either of these.

Use \\[validate-TeX-buffer] to check buffer for paragraphs containing
mismatched $'s or braces.

Special commands:
\\{TeX-mode-map}

Mode variables:
TeX-directory
	Directory in which to create temporary files for TeX jobs
	run by \\[TeX-region] or \\[TeX-buffer].
TeX-dvi-print-command
	Command string used by \\[TeX-print] to print a .dvi file.
TeX-show-queue-command
	Command string used by \\[TeX-show-print-queue] to show the print
	queue that \\[TeX-print] put your job on.

Entering LaTeX mode calls the value of text-mode-hook,
then the value of TeX-mode-hook, and then the value
of LaTeX-mode-hook." (interactive) (byte-code "ƈ ȉɉʉˉ͉̉#" [mode-name major-mode TeX-command TeX-start-of-header TeX-end-of-header TeX-trailer nil TeX-common-initialization "LaTeX" LaTeX-mode "latex" "\\documentstyle" "\\begin{document}" "\\end{document}
" run-hooks text-mode-hook TeX-mode-hook LaTeX-mode-hook] 5))

(defun TeX-common-initialization nil (byte-code " !
?R !\"\"\"\"\"\"\"\"\"\"\"U!!!!!!!!!!" [TeX-mode-map local-abbrev-table text-mode-abbrev-table TeX-mode-syntax-table paragraph-start paragraph-separate comment-start comment-start-skip comment-indent-hook kill-all-local-variables use-local-map make-syntax-table set-syntax-table modify-syntax-entry 92 "." 12 ">" 10 36 "$$" 37 "<" 34 38 95 64 "_" 126 " " 39 "w" make-local-variable "^[ 	]*$\\|^[\\\\%]" "%" "\\(\\(^\\|[^\\]\\)\\(\\\\\\\\\\)*\\)\\(%+ *\\)" TeX-comment-indent TeX-command TeX-start-of-header TeX-end-of-header TeX-trailer] 26))

(defun TeX-comment-indent nil (byte-code "!
i!nłiT]" [comment-column looking-at "%%%" skip-chars-backward " 	" 0] 4))

(defun TeX-insert-quote (arg) "\
Insert ``, '' or \" according to preceding character.
With prefix argument, always insert \" characters." (interactive "P") (byte-code "È!<!	!)<o)!!)0˂;hU:͂;c" [arg count t nil prefix-numeric-value self-insert-command 1 forward-char -1 looking-at "[ 	
]\\|\\s(" "``" 92 34 "''"] 7))

(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 (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-close-LaTeX-block nil "\
Creates an \\end{...} to match \\begin{...} on the current line and
puts point on the blank line between them." (interactive "*") (byte-code "Ĉ` NJ `)#8!!\"i  cj
#!*=b )" [fail-point t text indentation nil end-of-line re-search-backward "\\\\begin{\\([^}
]*\\)}" beginning-of-line buffer-substring match-beginning 1 match-end delete-horizontal-space "

" insert "\\end{" "}" forward-line -1 ding] 12))

(defun TeX-start-shell nil (byte-code "!$q
!	!	! !%!)" [nil TeX-shell-map shell-mode-map require shell make-shell "TeX-shell" "-v" copy-keymap TeX-define-common-keys use-local-map zerop buffer-size sleep-for 1] 9))

(defun set-buffer-directory (buffer directory) "\
Set BUFFER's default directory to be DIRECTORY." (byte-code "!!!?\"	q)" [directory buffer default-directory file-name-as-directory expand-file-name file-directory-p error "%s is not a directory"] 6))

(defun TeX-region (beg end) "\
Run TeX on the current region.  A temporary file (TeX-zap-file) is
written in directory TeX-directory, and TeX is run in that directory.
If the buffer has a header, it is written to the temporary file before
the region itself.  The buffer's header is all lines between the
strings defined by TeX-start-of-header and TeX-end-of-header
inclusive.  The header must start in the first 100 lines.  The value
of TeX-trailer is appended to the temporary file after the region." (interactive "r") (byte-code "̈!
  !P!!! eb!`eeeb	
#k `#g!`ke
^	%
]	%,
q !!
\"ed	%)))\"R\"	R\"+!" [TeX-zap-file tex-out-file temp-buffer zap-directory TeX-directory search-end hbeg hend default-directory TeX-start-of-header t TeX-end-of-header nil beg end local-tex-trailer TeX-trailer TeX-shell-cd-command TeX-command get-buffer "*TeX-shell*" TeX-kill-job TeX-start-shell make-temp-name "#tz" ".tex" get-buffer-create " TeX-Output-Buffer" file-name-as-directory expand-file-name widen forward-line 100 search-forward beginning-of-line 1 write-region erase-buffer insert-string "
" set-buffer-directory send-string "TeX-shell" " " " \"" "\"
" TeX-recenter-output-buffer 0] 28))

(defun TeX-buffer nil "\
Run TeX on current buffer.  See \\[TeX-region] for more information." (interactive) (byte-code "ed\"" [nil TeX-region] 3))

(defun TeX-kill-job nil "\
Kill the currently running TeX job." (interactive) (byte-code "\"" [t nil quit-process "TeX-shell"] 3))

(defun TeX-recenter-output-buffer (linenum) "\
Redisplay buffer of TeX job output so that most recent output can be seen.
The last line of the buffer is displayed on
line LINE of the window, or centered if LINE is nil." (interactive "P") (byte-code "È!p?!3!!db
)
!. \"!	!*" [tex-shell old-buffer linenum nil get-buffer "*TeX-shell*" message "No TeX output buffer" pop-to-buffer bury-buffer recenter prefix-numeric-value / window-height 2] 10))

(defun TeX-print nil "\
Print the .dvi file made by \\[TeX-region] or \\[TeX-buffer].
Runs the shell command defined by TeX-dvi-print-command." (interactive) (byte-code "ˆ	R\"!" [TeX-dvi-print-command TeX-zap-file nil send-string "TeX-shell" " \"" ".dvi\"
" TeX-recenter-output-buffer] 6))

(defun TeX-show-print-queue nil "\
Show the print queue that \\[TeX-print] put your job on.
Runs the shell command defined by TeX-show-queue-command." (interactive) (byte-code "!? P\"!" [TeX-show-queue-command nil get-buffer "*TeX-shell*" TeX-start-shell send-string "TeX-shell" "
" TeX-recenter-output-buffer] 6))