"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.
(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))))
;; A line starting with $$ starts a paragraph,
;; but does not separate paragraphs if it has more stuff on it.
(setq paragraph-start "^[ \t]*$\\|^[\f%]\\|^[ \t]*\\$\\$\\|\
-^\\\\begin\\>\\|^\\\\label\\>\\|^\\\\end\\>\\|^\\\\\\[\\|\
+^\\\\begin\\>\\|^\\\\label\\>\\|^\\\\end\\>\\|^\\\\\\[\\|^\\\\\\]\\|\
^\\\\chapter\\>\\|^\\\\section\\>\\|\
^\\\\subsection\\>\\|^\\\\subsubsection\\>\\|\
^\\\\paragraph\\>\\|^\\\\subparagraph\\>\\|\
^\\\\[a-z]*space\\>\\|^\\\\[a-z]*skip\\>\\|\
^\\\\newpage\\>\\|^\\\\[a-z]*page\\|^\\\\footnote\\>\\|\
^\\\\marginpar\\>\\|^\\\\parbox\\>\\|^\\\\caption\\>")
- (setq paragraph-separate "^[ \t]*$\\|^[\f\\\\%]\\|^[ \t]*\\$\\$[ \t]*$\\|\
-^\\\\begin\\>\\|^\\\\label\\>\\|^\\\\end\\>\\|^\\\\\\[\\|\
+ (setq paragraph-separate "^[ \t]*$\\|^[\f%]\\|^[ \t]*\\$\\$[ \t]*$\\|\
+^\\\\begin\\>\\|^\\\\label\\>\\|^\\\\end\\>\\|^\\\\\\[\\|^\\\\\\]\\|\
^\\\\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
;; A line starting with $$ starts a paragraph,
;; but does not separate paragraphs if it has more stuff on it.
(setq paragraph-start "^[ \t]*$\\|^[\f%]\\|^[ \t]*\\$\\$\\|\
-^\\\\begin\\>\\|^\\\\label\\>\\|^\\\\end\\>\\|^\\\\\\[\\|\
+^\\\\begin\\>\\|^\\\\label\\>\\|^\\\\end\\>\\|^\\\\\\[\\|^\\\\\\]\\|\
^\\\\chapter\\>\\|^\\\\section\\>\\|\
^\\\\subsection\\>\\|^\\\\subsubsection\\>\\|\
^\\\\paragraph\\>\\|^\\\\subparagraph\\>\\|\
^\\\\[a-z]*space\\>\\|^\\\\[a-z]*skip\\>\\|\
^\\\\newpage\\>\\|^\\\\[a-z]*page\\|^\\\\footnote\\>\\|\
^\\\\marginpar\\>\\|^\\\\parbox\\>\\|^\\\\caption\\>")
- (setq paragraph-separate "^[ \t]*$\\|^[\f\\\\%]\\|^[ \t]*\\$\\$[ \t]*$\\|\
-^\\\\begin\\>\\|^\\\\label\\>\\|^\\\\end\\>\\|^\\\\\\[\\|\
+ (setq paragraph-separate "^[ \t]*$\\|^[\f%]\\|^[ \t]*\\$\\$[ \t]*$\\|\
+^\\\\begin\\>\\|^\\\\label\\>\\|^\\\\end\\>\\|^\\\\\\[\\|^\\\\\\]\\|\
^\\\\chapter\\>\\|^\\\\section\\>\\|\
^\\\\subsection\\>\\|^\\\\subsubsection\\>\\|\
^\\\\paragraph\\>\\|^\\\\subparagraph\\>\\|\
;;; The utility functions:
+;;;###autoload
(defun tex-start-shell ()
(save-excursion
(set-buffer
(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)
If NOT-ALL is non-nil, save the `.dvi' file."
(if tex-last-temp-file
(let* ((dir (file-name-directory tex-last-temp-file))
- (list (file-name-all-completions
- (file-name-nondirectory tex-last-temp-file) dir)))
- (while list
+ (list (and (file-directory-p dir)
+ (file-name-all-completions
+ (file-name-nondirectory tex-last-temp-file) dir))))
+ (while list
(if not-all
(and
;; If arg is non-nil, don't delete the .dvi file.
(if (tex-shell-running)
(tex-kill-job)
(tex-start-shell))
+ (display-buffer (process-buffer (get-process "tex-shell")))
(or tex-zap-file
(setq tex-zap-file (tex-generate-zap-file-name)))
(let* ((temp-buffer (get-buffer-create " TeX-Output-Buffer"))
(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
(if (tex-shell-running)
(tex-kill-job)
(tex-start-shell))
+ (display-buffer (process-buffer (get-process "tex-shell")))
(tex-send-command tex-shell-cd-command file-dir)
(tex-send-command tex-command tex-out-file))
(setq tex-last-buffer-texed (current-buffer))
(if (tex-shell-running)
(tex-kill-job)
(tex-start-shell))
+ (display-buffer (process-buffer (get-process "tex-shell")))
(tex-send-command tex-show-queue-command))
(defun tex-bibtex-file ()
(if (tex-shell-running)
(tex-kill-job)
(tex-start-shell))
+ (display-buffer (process-buffer (get-process "tex-shell")))
(let ((tex-out-file
(tex-append (file-name-nondirectory (buffer-file-name)) ""))
(file-dir (file-name-directory (buffer-file-name))))