branch: externals/auctex commit 3b5f047045557baa00f6a5bc26cf1b24037145a8 Author: Mosè Giordano <m...@gnu.org> Commit: Mosè Giordano <m...@gnu.org>
Add supporto to ConTeXt Mark IV in some sentinels. * context.el (TeX-ConTeXt-sentinel): Parse ConTeXt Mark IV output. * tex-buf.el (TeX-TeX-sentinel-check): Ditto. --- ChangeLog | 6 ++++++ context.el | 59 +++++++++++++++++++++++++++++++++++++---------------------- tex-buf.el | 24 ++++++++++++++++++++---- 3 files changed, 63 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 61de4d3..b287587 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-10-05 Mos� Giordano <m...@gnu.org> + + * context.el (TeX-ConTeXt-sentinel): Parse ConTeXt Mark IV output. + + * tex-buf.el (TeX-TeX-sentinel-check): Ditto. + 2015-10-05 Arash Esbati <esb...@gmx.de> * style/newfloat.el (LaTeX-newfloat-auto-cleanup): Check if diff --git a/context.el b/context.el index 0aa7311..ccd32a5 100644 --- a/context.el +++ b/context.el @@ -564,28 +564,43 @@ inserted after the sectioning command." ;; Various (defun TeX-ConTeXt-sentinel (process name) "Cleanup TeX output buffer after running ConTeXt." - (cond ((TeX-TeX-sentinel-check process name)) - ((save-excursion - ;; in a full ConTeXt run there will multiple texutil - ;; outputs. Just looking for "another run needed" would - ;; find the first occurence - (goto-char (point-max)) - (re-search-backward "TeXUtil " nil t) - (re-search-forward "another run needed" nil t)) - (message (concat "You should run ConTeXt again " - "to get references right, " - (TeX-current-pages))) - (setq TeX-command-next TeX-command-default)) - ((re-search-forward "removed files :" nil t) - (message "sucessfully cleaned up")) - ((re-search-forward "^ ?TeX\\(Exec\\|Util\\)" nil t) ;; strange regexp --pg - (message (concat name ": successfully formatted " - (TeX-current-pages))) - (setq TeX-command-next TeX-command-Show)) - (t - (message (concat name ": problems after " - (TeX-current-pages))) - (setq TeX-command-next TeX-command-default)))) + (cond + ;; Mark IV + ((with-current-buffer TeX-command-buffer + (string= ConTeXt-Mark-version "IV")) + (cond ((TeX-TeX-sentinel-check process name)) + ((re-search-forward "fatal error: " nil t) + (message (concat name ": problems after " + (TeX-current-pages name))) + (setq TeX-command-next TeX-command-default)) + (t + (message (concat name ": successfully formatted " + (TeX-current-pages name))) + (setq TeX-command-next TeX-command-Show)))) + ;; Mark II + (t + (cond ((TeX-TeX-sentinel-check process name)) + ((save-excursion + ;; in a full ConTeXt run there will multiple texutil + ;; outputs. Just looking for "another run needed" would + ;; find the first occurence + (goto-char (point-max)) + (re-search-backward "TeXUtil " nil t) + (re-search-forward "another run needed" nil t)) + (message (concat "You should run ConTeXt again " + "to get references right, " + (TeX-current-pages))) + (setq TeX-command-next TeX-command-default)) + ((re-search-forward "removed files :" nil t) + (message "sucessfully cleaned up")) + ((re-search-forward "^ ?TeX\\(Exec\\|Util\\)" nil t) ;; strange regexp --pg + (message (concat name ": successfully formatted " + (TeX-current-pages))) + (setq TeX-command-next TeX-command-Show)) + (t + (message (concat name ": problems after " + (TeX-current-pages))) + (setq TeX-command-next TeX-command-default)))))) ;;; Environments diff --git a/tex-buf.el b/tex-buf.el index bfe684e..d42b547 100644 --- a/tex-buf.el +++ b/tex-buf.el @@ -1292,17 +1292,33 @@ errors or warnings to show." Return nil ifs no errors were found." (save-excursion (goto-char (point-max)) - (if (re-search-backward "^Output written on \\(.*?\\) (\\([0-9]+\\) page" - nil t) + (cond + ((and (string-match "ConTeXt" name) + (with-current-buffer TeX-command-buffer + (string= ConTeXt-Mark-version "IV"))) + (when (re-search-backward " > result saved in file: \\(.*?\\), " nil t) (let ((output-file (TeX-match-buffer 1))) - (setq TeX-current-page (concat "{" (TeX-match-buffer 2) "}")) ;; Shave off quotation marks if present. (when (string-match "\\`\"\\(.*\\)\"\\'" output-file) (setq output-file (match-string 1 output-file))) (setq TeX-output-extension (if (string-match "\\.\\([^.]*\\)$" output-file) (match-string 1 output-file) - "dvi"))))) + "dvi"))) + (if (re-search-forward ", \\([0-9]+\\) shipped pages, " nil t) + (setq TeX-current-page (concat "{" (TeX-match-buffer 1) "}"))))) + (t + (if (re-search-backward "^Output written on \\(.*?\\) (\\([0-9]+\\) page" + nil t) + (let ((output-file (TeX-match-buffer 1))) + (setq TeX-current-page (concat "{" (TeX-match-buffer 2) "}")) + ;; Shave off quotation marks if present. + (when (string-match "\\`\"\\(.*\\)\"\\'" output-file) + (setq output-file (match-string 1 output-file))) + (setq TeX-output-extension + (if (string-match "\\.\\([^.]*\\)$" output-file) + (match-string 1 output-file) + "dvi"))))))) (if process (TeX-format-mode-line process)) (if (re-search-forward "^\\(!\\|.*:[0-9]+:\\) " nil t) (progn