tex-mode.elc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. (defvar TeX-directory "/tmp/" "\
  2. *Directory in which to run TeX subjob. Temporary files are
  3. created in this directory.")
  4. (defvar TeX-dvi-print-command "lpr -d" "\
  5. *Command string used by \\[TeX-print] to print a .dvi file.")
  6. (defvar TeX-show-queue-command "lpq" "\
  7. *Command string used by \\[TeX-show-print-queue] to show the print queue
  8. that \\[TeX-print] put your job on.")
  9. (defvar TeX-default-mode (quote plain-TeX-mode) "\
  10. *Mode to enter for a new file when it can't be determined whether
  11. the file is plain TeX or LaTeX or what.")
  12. (defvar TeX-command nil "\
  13. The command to run TeX on a file. The name of the file will be appended
  14. to this string, separated by a space.")
  15. (defvar TeX-trailer nil "\
  16. String appended after the end of a region sent to TeX by \\[TeX-region].")
  17. (defvar TeX-start-of-header nil "\
  18. String used by \\[TeX-region] to delimit the start of the file's header.")
  19. (defvar TeX-end-of-header nil "\
  20. String used by \\[TeX-region] to delimit the end of the file's header.")
  21. (defvar TeX-shell-cd-command "cd" "\
  22. Command to give to shell running TeX to change directory. The value of
  23. TeX-directory will be appended to this, separated by a space.")
  24. (defvar TeX-zap-file nil "\
  25. Temporary file name used for text being sent as input to TeX.
  26. Should be a simple file name with no extension or directory specification.")
  27. (defvar TeX-mode-syntax-table nil "\
  28. Syntax table used while in TeX mode.")
  29. (defvar TeX-mode-map nil)
  30. (defun TeX-define-common-keys (keymap) "\
  31. Define the keys that we want defined both in TeX-mode
  32. and in the TeX-shell." (byte-code "ÁÂÃ#ˆÁÄÅ#ˆÁÆÇ#ˆÁÈÉ#‡" [keymap define-key " " TeX-kill-job " " TeX-recenter-output-buffer "" TeX-show-print-queue "" TeX-print] 7))
  33. (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 "
  34. " (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)))
  35. (defun tex-mode nil "\
  36. Major mode for editing files of input for TeX or LaTeX.
  37. Trys to intuit whether this file is for plain TeX or LaTeX and
  38. calls plain-tex-mode or latex-mode. If it cannot be determined
  39. (e.g., the file is empty), the value of TeX-default-mode is used." (interactive) (byte-code "ÁˆŠebˆÅÆÁÂ#…`ŠÇ ˆÅÈ Â#))…#Áˆ‚ˆm?…4ÉÊ!ƒ3Ë‚4Ì)ƒ@Í!‚CÍ !)‡" [mode nil t search-end TeX-default-mode search-forward "\\" beginning-of-line "%" looking-at "documentstyle" latex-mode plain-tex-mode funcall] 7))
  40. (fset (quote plain-TeX-mode) (quote plain-tex-mode))
  41. (fset (quote LaTeX-mode) (quote latex-mode))
  42. (defun plain-tex-mode nil "\
  43. Major mode for editing files of input for plain TeX.
  44. Makes $ and } display the characters they match.
  45. Makes \" insert `` when it seems to be the beginning of a quotation,
  46. and '' when it appears to be the end; it inserts \" only after a \\.
  47. Use \\[TeX-region] to run TeX on the current region, plus a \"header\"
  48. copied from the top of the file (containing macro definitions, etc.),
  49. running TeX under a special subshell. \\[TeX-buffer] does the whole buffer.
  50. \\[TeX-print] prints the .dvi file made by either of these.
  51. Use \\[validate-TeX-buffer] to check buffer for paragraphs containing
  52. mismatched $'s or braces.
  53. Special commands:
  54. \\{TeX-mode-map}
  55. Mode variables:
  56. TeX-directory
  57. Directory in which to create temporary files for TeX jobs
  58. run by \\[TeX-region] or \\[TeX-buffer].
  59. TeX-dvi-print-command
  60. Command string used by \\[TeX-print] to print a .dvi file.
  61. TeX-show-queue-command
  62. Command string used by \\[TeX-show-print-queue] to show the print
  63. queue that \\[TeX-print] put your job on.
  64. Entering plain-TeX mode calls the value of text-mode-hook,
  65. then the value of TeX-mode-hook, and then the value
  66. 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 make-local-variable "tex" "%**start of header" "%**end of header" "\\bye
  67. " run-hooks text-mode-hook TeX-mode-hook plain-TeX-mode-hook] 9))
  68. (defun latex-mode nil "\
  69. Major mode for editing files of input for LaTeX.
  70. Makes $ and } display the characters they match.
  71. Makes \" insert `` when it seems to be the beginning of a quotation,
  72. and '' when it appears to be the end; it inserts \" only after a \\.
  73. Use \\[TeX-region] to run LaTeX on the current region, plus the preamble
  74. copied from the top of the file (containing \\documentstyle, etc.),
  75. running LaTeX under a special subshell. \\[TeX-buffer] does the whole buffer.
  76. \\[TeX-print] prints the .dvi file made by either of these.
  77. Use \\[validate-TeX-buffer] to check buffer for paragraphs containing
  78. mismatched $'s or braces.
  79. Special commands:
  80. \\{TeX-mode-map}
  81. Mode variables:
  82. TeX-directory
  83. Directory in which to create temporary files for TeX jobs
  84. run by \\[TeX-region] or \\[TeX-buffer].
  85. TeX-dvi-print-command
  86. Command string used by \\[TeX-print] to print a .dvi file.
  87. TeX-show-queue-command
  88. Command string used by \\[TeX-show-print-queue] to show the print
  89. queue that \\[TeX-print] put your job on.
  90. Entering LaTeX mode calls the value of text-mode-hook,
  91. then the value of TeX-mode-hook, and then the value
  92. 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 make-local-variable "latex" "\\documentstyle" "\\begin{document}" "\\end{document}
  93. " run-hooks text-mode-hook TeX-mode-hook LaTeX-mode-hook] 9))
  94. (defun TeX-common-initialization nil (byte-code "É ˆÊ!ˆ
  95. ‰ˆ ?ƒ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] 23))
  96. (defun TeX-comment-indent nil (byte-code "ÁÂ!ƒ
  97. i‚ÃÄ!ˆnƒÅ‚iT]‡" [comment-column looking-at "%%%" skip-chars-backward " " 0] 4))
  98. (defun TeX-insert-quote (arg) "\
  99. Insert ``, '' or \" according to preceding character.
  100. With prefix argument, always insert \" characters." (interactive "P") (byte-code "ȃÄ!<ƒÅÆ!‚Å !)‚<o†)ŠÇÈ!ˆÉÊ!)ƒ0Ë‚;hÌUƒ:Í‚;Îc‡" [arg count t nil prefix-numeric-value self-insert-command 1 forward-char -1 looking-at "[
  101. ]\\|\\s(" "``" 92 34 "''"] 7))
  102. (defun validate-TeX-buffer nil "\
  103. Check current buffer for paragraphs containing mismatched $'s.
  104. As each such paragraph is found, a mark is pushed at its beginning,
  105. 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 "
  106. " move TeX-validate-paragraph push-mark message "Mismatch found in pararaph starting here" sit-for 4] 8))
  107. (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))
  108. (defun TeX-terminate-paragraph (inhibit-validation) "\
  109. Insert two newlines, breaking a paragraph for TeX.
  110. Check for mismatched braces/$'s in paragraph being terminated.
  111. A prefix arg inhibits the checking." (interactive "P") (byte-code "Áˆ†ŠÃÄÁÅ#ˆ`)`\"†ÆÇ!ˆÄc‡" [inhibit-validation nil TeX-validate-paragraph search-backward "
  112. " move message "Paragraph being closed appears to contain a mismatch"] 5))
  113. (defun TeX-insert-braces nil "\
  114. Make a pair of braces and be poised to type inside of them." (interactive) (byte-code "ÀˆÁcˆŠÂc)‡" [nil 123 125] 1))
  115. (defun TeX-close-LaTeX-block nil "\
  116. Creates an \\end{...} to match \\begin{...} on the current line and
  117. puts point on the blank line between them." (interactive "*") (byte-code "Ĉ`Å ˆÆÇŠÈ ˆ`)Á#ƒ8ÉÊË!ÌË!\"iÅ ˆÍ ˆÎcˆ jˆÏÐ
  118. Ñ#ˆÒÓ!*‚=bˆÔ )‡" [fail-point t text indentation nil end-of-line re-search-backward "\\\\begin{\\([^}
  119. ]*\\)}" beginning-of-line buffer-substring match-beginning 1 match-end delete-horizontal-space "
  120. " insert "\\end{" "}" forward-line -1 ding] 12))
  121. (defun TeX-region (beg end) "\
  122. Run TeX on the current region. A temporary file (TeX-zap-file) is
  123. written in directory TeX-directory, and TeX is run in that directory.
  124. If the buffer has a header, it is written to the temporary file before
  125. the region itself. The buffer's header is all lines between the
  126. strings defined by TeX-start-of-header and TeX-end-of-header
  127. inclusive. The header must start in the first 100 lines. The value
  128. of TeX-trailer is appended to the temporary file after the region." (interactive "r") (byte-code "̈ÓÔ!ƒ Õ ‚Ö ˆ†ר!‰ˆÙPÚÛ!Ü !ŠŒÝ ˆebˆÞß!ˆ`ee ebˆà Ê#…jÞá!ˆ`‰ˆà ÌÊ#ƒfÞâ!ˆ`‰‚je‰ˆã ^ ÌÌ%ˆã ] ÊÌ%,ˆ
  129. qˆä ˆåæ!ˆ…�å!ˆç
  130. \"ˆã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" expand-directory-name widen forward-line 100 search-forward -1 1 write-region erase-buffer insert-string "
  131. " set-buffer-directory send-string "TeX-shell" " " " \"" "\"
  132. " TeX-recenter-output-buffer 0] 27))
  133. (defun TeX-start-shell nil (byte-code "ÀÁ!ˆŠÂÃÄÅÆ$qˆÇÈ !)‡" [require shell make-shell "TeX-shell" "sh" "/dev/null" "-v" TeX-define-common-keys current-local-map] 6))
  134. (defun set-buffer-directory (buffer directory) "\
  135. Set BUFFER's default directory to be DIRECTORY." (byte-code "Ã!‰ˆÄ!?ƒÅÆ\"‚Š qˆ‰)‡" [directory buffer default-directory expand-directory-name file-directory-p error "%s is not a directory"] 5))
  136. (defun expand-directory-name (name) "\
  137. Like expand-file-name, but returns a directory name." (byte-code " !ÃÄ\"†ÅP‰ˆ)‡" [dir-name name expand-file-name string-match "/$" "/"] 4))
  138. (defun TeX-buffer nil "\
  139. Run TeX on current buffer. See TeX-region for more information." (interactive) (byte-code "ÀˆÁed\"‡" [nil TeX-region] 3))
  140. (defun TeX-kill-job nil "\
  141. Kill the currently running TeX job." (interactive) (byte-code "ÁˆÂÃÀ\"‡" [t nil quit-process "TeX-shell"] 3))
  142. (defun TeX-recenter-output-buffer (linenum) "\
  143. Redisplay buffer showing current TeX job so that most recent
  144. output can be seen. The last line of the buffer is displayed on
  145. line LINE of the window, or centered if LINE is nil." (interactive "P") (byte-code "ÈÄÅ!p?ƒÆÇ!‚3È!ˆÉ!ˆdbˆÊ
  146. ƒ)Ë
  147. !‚.ÌÍ Î\"!ˆÈ !*‡" [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))
  148. (defun TeX-print nil "\
  149. Print the .dvi file made by \\[TeX-region] or \\[TeX-buffer].
  150. 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\"
  151. " TeX-recenter-output-buffer] 6))
  152. (defun TeX-show-print-queue nil "\
  153. Show the print queue that \\[TeX-print] put your job on.
  154. 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" "
  155. " TeX-recenter-output-buffer] 6))