Function: TeX-ConTeXt-sentinel-check

TeX-ConTeXt-sentinel-check is a byte-compiled function defined in context.el.

Signature

(TeX-ConTeXt-sentinel-check PROCESS NAME)

Documentation

Check ConTeXt (LMTX) output buffer after running TeX.

Return t if errors were found.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.2.0/context.el
;; Various

;; This function is called with (current-buffer) = the output buffer.
(defun TeX-ConTeXt-sentinel-check (process name)
  "Check ConTeXt (LMTX) output buffer after running TeX.
Return t if errors were found."
  ;; Set TeX-current-page to (effectively) match what
  ;; TeX-TeX-sentinel-check does:
  ;; -> if no errors, the number of pages shipped out; and
  ;; -> if errors, the number of pages shipped out + 1.
  ;; Also determine the extension of the output file.
  (save-excursion
    (goto-char (point-max))
    (if (re-search-backward " > flushing realpage \\([0-9]+\\), " nil t)
        (setq TeX-current-page (TeX-match-buffer 1))
      (setq TeX-current-page "0"))
    ;; If running in "don't quit on error" mode, there will be a
    ;; '^pages .* > flushing realpage' message after the '^tex error'
    ;; message.  In this case, no need to add 1.
    (goto-char (point-min))
    (if (re-search-forward "^tex error" nil t)
        (if (re-search-forward "^pages .* > flushing realpage" nil t)
            nil
          (setq TeX-current-page (number-to-string
                                  (1+ (string-to-number TeX-current-page))))))
    (setq TeX-current-page (concat "{" TeX-current-page "}"))
    (setq TeX-output-extension "pdf"))   ;; for the last 200 years now, +/-.

  (if process (TeX-format-mode-line process))

  (if (catch 'found
        (while (re-search-forward
                "^\\(?:.*tex error on line [0-9]+ in file \\(.+?\\):\\)" nil t)
          (if (or (not (match-beginning 1))
                  ;; Ignore non-error warning. (bug#55065)
                  (file-exists-p (TeX-match-buffer 1)))
              (throw 'found t))))
      (progn
        (if TeX-error-overview-open-after-TeX-run
            ;; Don't leave inconsistent message.
            (message nil)
          (message "%s errors in `%s'. Use %s to display."
                   name (buffer-name)
                   (substitute-command-keys
                    "\\<TeX-mode-map>\\[TeX-next-error]")))
        (setq TeX-command-next TeX-command-default)
        ;; error reported to TeX-error-report-switches
        (setq TeX-error-report-switches
              (plist-put TeX-error-report-switches
                         (intern (plist-get TeX-error-report-switches
                                            'TeX-current-master))
                         t))
        t)
    ;; In case that there were only non-error warnings of type
    ;; bug#55065, restore point to the initial position.
    (goto-char (point-min))
    (setq TeX-command-next TeX-command-Show)
    nil))