(describe-function): Fix previous change.
[bpt/emacs.git] / lisp / textmodes / tex-mode.el
index 103ebda..ebf39c2 100644 (file)
@@ -239,7 +239,7 @@ Set by \\[tex-region], \\[tex-buffer], and \\[tex-file].")
   "Keymap for the TeX shell.
 Inherits `comint-mode-map' with a few additions.")
 
-(defvar compare-windows-whitespace nil)        ; Pacify the byte-compiler
+(defvar compare-windows-whitespace)    ; Pacify the byte-compiler
 
 ;;; This would be a lot simpler if we just used a regexp search,
 ;;; but then it would be too slow.
@@ -261,8 +261,9 @@ says which mode to use."
                                    (beginning-of-line)
                                    (search-forward "%" search-end t))))))
       (if (and slash (not comment))
-         (setq mode (if (looking-at "documentstyle")
-                         (if (looking-at "documentstyle{slides}")
+         (setq mode (if (looking-at "documentstyle\\|documentclass")
+                         (if (looking-at
+                             "document\\(style\\|class\\)\\(\\[.*\\]\\)?{slides}")
                              'slitex-mode
                            'latex-mode)
                       'plain-tex-mode))))
@@ -394,10 +395,10 @@ subshell is initiated, `tex-shell-hook' is run."
 ^\\\\chapter\\>\\|^\\\\section\\>\\|\
 ^\\\\subsection\\>\\|^\\\\subsubsection\\>\\|\
 ^\\\\paragraph\\>\\|^\\\\subparagraph\\>\\|\
-^\\\\item[ \t]*$\\|^\\\\bibitem[ \t]*$\\|^\\\\newline[ \t]*$\\|^\\\\noindent[ \t]*$\\|\
-^\\\\[a-z]*space[ \t]*$\\|^\\\\[a-z]*skip[ \t]*$\\|\
-^\\\\newpage[ \t]*$\\|^\\\\[a-z]*page[a-z]*[ \t]*$\\|^\\\\footnote[ \t]*$\\|\
-^\\\\marginpar[ \t]*$\\|^\\\\parbox[ \t]*$\\|^\\\\caption[ \t]*$")
+\\(^\\\\item\\|^\\\\bibitem\\|^\\\\newline\\|^\\\\noindent\\|\
+^\\\\[a-z]*space\\|^\\\\[a-z]*skip\\|\
+^\\\\newpage\\|^\\\\[a-z]*page[a-z]*\\|^\\\\footnote\\|\
+^\\\\marginpar\\|^\\\\parbox\\|^\\\\caption\\)[ \t]*\\($\\|%\\)")
   (run-hooks 'text-mode-hook 'tex-mode-hook 'latex-mode-hook))
 
 ;;;###autoload
@@ -823,7 +824,8 @@ line numbers for the errors."
     (let ((proc (get-process "tex-shell")))
       (set-process-sentinel proc 'tex-shell-sentinel)
       (process-kill-without-query proc)
-      (setq tex-shell-map (copy-keymap shell-mode-map))
+      (setq comint-prompt-regexp shell-prompt-pattern)
+      (setq tex-shell-map (copy-keymap comint-mode-map))
       (tex-define-common-keys tex-shell-map)
       (use-local-map tex-shell-map)
       (run-hooks 'tex-shell-hook)
@@ -930,7 +932,9 @@ The value of `tex-command' specifies the command to use to run TeX."
          (zap-directory
           (file-name-as-directory (expand-file-name tex-directory)))
          (tex-out-file (concat zap-directory tex-zap-file)))
-    (tex-delete-last-temp-files t)
+    ;; Don't delete temp files if we do the same buffer twice in a row.
+    (or (eq (current-buffer) tex-last-buffer-texed)
+       (tex-delete-last-temp-files t))
     ;; Write the new temp file.
     (save-excursion
       (save-restriction