Function: TeX-help-error

TeX-help-error is a byte-compiled function defined in tex.el.

Signature

(TeX-help-error ERROR OUTPUT RUNBUFFER TYPE)

Documentation

Print ERROR in context OUTPUT from RUNBUFFER in another window.

TYPE is a symbol specifing if ERROR is a real error, a warning or a bad box.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-help-error (error output runbuffer type)
  "Print ERROR in context OUTPUT from RUNBUFFER in another window.
TYPE is a symbol specifing if ERROR is a real error, a warning or
a bad box."

  (let ((old-buffer (current-buffer))
        (log-file (with-current-buffer runbuffer
                    (with-current-buffer TeX-command-buffer
                      (expand-file-name (TeX-active-master "log")))))
        (error-description-list
         (append TeX-error-description-list
                 (buffer-local-value 'TeX-error-description-list-local
                                     (buffer-local-value
                                      'TeX-command-buffer
                                      runbuffer))))
        (TeX-error-pointer 0))

    ;; Find help text entry.
    (while (not (string-match (car (nth TeX-error-pointer
                                        error-description-list))
                              error))
      (setq TeX-error-pointer (+ TeX-error-pointer 1)))

    (TeX-pop-to-buffer (get-buffer-create "*TeX Help*") nil t)
    (let ((inhibit-read-only t))
      (erase-buffer)
      (insert
       (cond
        ((equal type 'error)
         (propertize "ERROR" 'font-lock-face 'TeX-error-description-error))
        ((equal type 'warning)
         (propertize "WARNING" 'font-lock-face 'TeX-error-description-warning))
        ((equal type 'bad-box)
         (propertize "BAD BOX" 'font-lock-face 'TeX-error-description-warning)))
       ": " error
       (propertize "\n\n--- TeX said ---" 'font-lock-face
                   'TeX-error-description-tex-said)
       output
       (propertize "\n--- HELP ---\n" 'font-lock-face
                   'TeX-error-description-help)
       (let ((help (cdr (nth TeX-error-pointer
                             error-description-list))))
         (or (and (= (1+ TeX-error-pointer)
                     (length error-description-list))
                  (with-current-buffer
                      (get-buffer-create (format " *%s*" log-file))
                    (let ((modtime (file-attribute-modification-time
                                    (file-attributes log-file))))
                      (unless (and TeX--log-file-readin-modtime
                                   (time-equal-p TeX--log-file-readin-modtime
                                                 modtime))
                        (insert-file-contents log-file nil nil nil 'replace)
                        (setq TeX--log-file-readin-modtime modtime)))
                    (goto-char (point-min))
                    (when (and (search-forward error nil t 1)
                               (re-search-forward "^l\\." nil t)
                               (re-search-forward "^ [^\n]+$" nil t))
                      (let ((start (1+ (point))))
                        (forward-char 1)
                        (re-search-forward "^$")
                        (concat "From the .log file...\n\n"
                                (buffer-substring start (point)))))))
             help))))
    (goto-char (point-min))
    (TeX-special-mode)
    (TeX-pop-to-buffer old-buffer nil t)))