If nil, TeX runs with no options. See the documentation of `tex-command'."
:type 'string
:group 'tex-run
- :version "21.4")
+ :version "22.1")
;;;###autoload
(defcustom tex-start-commands "\\nonstopmode\\input"
"\\nonstopmode\\input")
(string :tag "String at your choice"))
:group 'tex-run
- :version "21.4")
+ :version "22.1")
(defvar latex-standard-block-names
'("abstract" "array" "center" "description"
(defcustom tex-dvi-view-command
'(cond
((eq window-system 'x) "xdvi")
- ((eq window-system 'w32) "yap")
+ ((eq window-system 'w32) "yap")
(t "dvi2tty * | cat -s"))
"*Command used by \\[tex-view] to display a `.dvi' file.
If it is a string, that specifies the command directly.
;; (arg "\\(?:{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)\\|\\\\[a-z*]+\\)"))
(arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)"))
(list
+ ;; font-lock-syntactic-keywords causes the \ of \end{verbatim} to be
+ ;; highlighted as tex-verbatim-face. Let's undo that.
+ ;; This is ugly and brittle :-( --Stef
+ '("^\\(\\\\\\)end" (1 (get-text-property (match-end 1) 'face) t))
;; display $$ math $$
;; We only mark the match between $$ and $$ because the $$ delimiters
;; themselves have already been marked (along with $..$) by syntactic
1 font-lock-function-name-face))))
"Subdued expressions to highlight in TeX modes.")
+(defun tex-font-lock-append-prop (prop)
+ (unless (memq (get-text-property (match-end 1) 'face)
+ '(font-lock-comment-face tex-verbatim-face))
+ prop))
+
(defconst tex-font-lock-keywords-2
(append tex-font-lock-keywords-1
(eval-when-compile
;;
;; Font environments. It seems a bit dubious to use `bold' etc. faces
;; since we might not be able to display those fonts.
- (list (concat slash bold " *" arg) 2 '(quote bold) 'append)
- (list (concat slash italic " *" arg) 2 '(quote italic) 'append)
+ (list (concat slash bold " *" arg) 2
+ '(tex-font-lock-append-prop 'bold) 'append)
+ (list (concat slash italic " *" arg) 2
+ '(tex-font-lock-append-prop 'italic) 'append)
;; (list (concat slash type arg) 2 '(quote bold-italic) 'append)
;;
;; Old-style bf/em/it/sl. Stop at `\\' and un-escaped `&', for tables.
(list (concat "\\\\\\(em\\|it\\|sl\\)\\>" args)
- 2 '(quote italic) 'append)
+ 2 '(tex-font-lock-append-prop 'italic) 'append)
;; This is separate from the previous one because of cases like
;; {\em foo {\bf bar} bla} where both match.
- (list (concat "\\\\bf\\>" args) 1 '(quote bold) 'append)))))
+ (list (concat "\\\\\\(bf\\)\\>" args)
+ 2 '(tex-font-lock-append-prop 'bold) 'append)))))
"Gaudy expressions to highlight in TeX modes.")
(defun tex-font-lock-suscript (pos)
(defvar tex-font-lock-syntactic-keywords
(let ((verbs (regexp-opt tex-verbatim-environments t)))
`((,(concat "^\\\\begin *{" verbs "}.*\\(\n\\)") 2 "|")
- (,(concat "^\\\\end *{" verbs "}\\(.?\\)") 2
- (unless (<= (match-beginning 0) (point-min))
- (put-text-property (1- (match-beginning 0)) (match-beginning 0)
- 'syntax-table (string-to-syntax "|"))
- "<"))
+ ;; Technically, we'd like to put the "|" property on the \n preceding
+ ;; the \end, but this would have 2 disadvantages:
+ ;; 1 - it's wrong if the verbatim env is empty (the same \n is used to
+ ;; start and end the fenced-string).
+ ;; 2 - font-lock considers the preceding \n as being part of the
+ ;; preceding line, so things gets screwed every time the previous
+ ;; line is re-font-locked on its own.
+ ;; There's a hack in tex-font-lock-keywords-1 to remove the verbatim
+ ;; face from the \ but C-M-f still jumps to the wrong spot :-( --Stef
+ (,(concat "^\\(\\\\\\)end *{" verbs "}\\(.?\\)") (1 "|") (3 "<"))
;; ("^\\(\\\\\\)begin *{comment}" 1 "< b")
;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b")
("\\\\verb\\**\\([^a-z@*]\\)" 1 "\""))))
(forward-sexp 1))
;; Now check that like matches like.
(goto-char start)
- (while (progn (skip-syntax-forward "^(")
- (not (eobp)))
- (let ((match (matching-paren (following-char))))
- (save-excursion
+ (while (re-search-forward "\\s(" nil t)
+ (save-excursion
+ (let ((pos (match-beginning 0)))
+ (goto-char pos)
(forward-sexp 1)
- (or (= (preceding-char) match)
- (error "Mismatched parentheses"))))
- (forward-char 1)))
+ (or (eq (preceding-char) (cdr (syntax-after pos)))
+ (eq (char-after pos) (cdr (syntax-after (1- (point)))))
+ (error "Mismatched parentheses"))))))
(error
(skip-syntax-forward " .>")
(setq failure-point (point)))))
(when (eq (char-after) ?{)
(let ((newpos (point)))
(when (ignore-errors (backward-sexp 1) t)
- (if (looking-at "\\\\end\\>")
+ (if (or (looking-at "\\\\end\\>")
+ ;; In case the \\ ends a verbatim section.
+ (and (looking-at "end\\>") (eq (char-before) ?\\)))
(tex-last-unended-begin)
(goto-char newpos))))))))
(make-comint
"tex-shell"
(or tex-shell-file-name (getenv "ESHELL") shell-file-name)
- nil)
+ nil
+ ;; Specify an interactive shell, to make sure it prompts.
+ "-i")
(let ((proc (get-process "tex-shell")))
(set-process-sentinel proc 'tex-shell-sentinel)
(set-process-query-on-exit-flag proc nil)
(let* ((file (or tex-main-file
;; Compatibility with AUCTeX.
(with-no-warnings
- (when (and (boundp 'TeX-master) (stringp TeX-master))
- (make-local-variable 'tex-main-file)
- (setq tex-main-file TeX-master)))
+ (when (boundp 'TeX-master)
+ (cond ((stringp TeX-master)
+ (make-local-variable 'tex-main-file)
+ (setq tex-main-file TeX-master))
+ ((and (eq TeX-master t) buffer-file-name)
+ (file-relative-name buffer-file-name)))))
;; Try to guess the main file.
(if (not buffer-file-name)
(error "Buffer is not associated with any file")
(when (file-newer-than-file-p f file)
(setq uptodate nil)))))
uptodate)))
-
+
(autoload 'format-spec "format-spec")
for the error messages."
(require 'thingatpt)
(setq compilation-error-list nil)
- (message "Parsing error messages...")
(let ((default-directory ; Perhaps dir has changed meanwhile.
(file-name-directory (buffer-file-name tex-last-buffer-texed)))
found-desired (num-errors-found 0)
compilation-error-list))
(goto-char end-of-error)))))
(set-marker compilation-parsing-end (point))
- (setq compilation-error-list (nreverse compilation-error-list))
- (message "Parsing error messages...done"))
+ (setq compilation-error-list (nreverse compilation-error-list)))
\f
;;; The commands: