Index: tex-buf.el =================================================================== RCS file: /cvsroot/auctex/auctex/tex-buf.el,v retrieving revision 1.239 diff -u -r1.239 tex-buf.el --- tex-buf.el 13 Oct 2005 11:02:27 -0000 1.239 +++ tex-buf.el 5 Nov 2005 12:49:29 -0000 @@ -888,6 +888,20 @@ (setq TeX-command-next TeX-command-Show) nil)) +(defun TeX-LaTeX-sentinel-has-warnings () + "Return non-nil, if the output buffer contains warnings. +Warnings can be indicated by LaTeX or packages." + (save-excursion + (goto-char (point-min)) + (re-search-forward + "^\\(LaTeX [A-Za-z]*\\|Package [A-Za-z]+ \\)Warning:" nil t))) + +(defun TeX-LaTeX-sentinel-has-bad-boxes () + "Return non-nil, if LaTeX output indicates overfull or underfull boxes." + (save-excursion + (goto-char (point-min)) + (re-search-forward "^\\(Ov\\|Und\\)erfull \\\\" nil t))) + ;; should go into latex.el? --pg (defun TeX-LaTeX-sentinel (process name) "Cleanup TeX output buffer after running LaTeX." @@ -925,8 +939,18 @@ (setq TeX-command-next TeX-command-Show)) ((re-search-forward "^\\(\\*\\* \\)?J?I?p?\\(La\\|Sli\\)TeX\\(2e\\)? \\(Version\\|ver\\.\\|<[0-9/]*>\\)" nil t) - (message (concat name ": successfully formatted " - (TeX-current-pages))) + (let* ((warnings (and TeX-debug-warnings + (TeX-LaTeX-sentinel-has-warnings))) + (bad-boxes (and TeX-debug-bad-boxes + (TeX-LaTeX-sentinel-has-bad-boxes))) + (add-info (when (or warnings bad-boxes) + (concat " (with " + (when warnings "warnings") + (when (and warnings bad-boxes) " and ") + (when bad-boxes "bad boxes") + ")")))) + (message (concat name ": successfully formatted " + (TeX-current-pages) add-info))) (setq TeX-command-next TeX-command-Show)) (t (message (concat name ": problems after " @@ -1344,16 +1368,20 @@ "Goto next error. Pop to OLD buffer if no more errors are found." (while (progn - (re-search-forward (concat "\\(" - "^! \\|" - "(\\|" - ")\\|" - "\\'\\|" - "!offset([---0-9]*)\\|" - "!name([^)]*)\\|" - "^.*erfull \\\\.*[0-9]*--[0-9]*\\|" - "^LaTeX Warning: .*[0-9]+\\.$" - "\\)")) + (re-search-forward + (concat "\\(" + "^! \\|" + "(\\|" + ")\\|" + "\\'\\|" + "!offset([---0-9]*)\\|" + "!name([^)]*)\\|" + (when TeX-debug-bad-boxes + "^.*erfull \\\\.*[0-9]*--[0-9]*") + (when (and TeX-debug-bad-boxes TeX-debug-warnings) "\\|") + (when TeX-debug-warnings + "^\\(LaTeX [A-Za-z]*\\|Package [A-Za-z]+ \\)Warning:.*") + "\\)")) (let ((string (TeX-match-buffer 1))) (cond (;; TeX error @@ -1362,13 +1390,18 @@ nil) ;; LaTeX warning - ((string-match (concat "\\(" - "^.*erfull \\\\.*[0-9]*--[0-9]*\\|" - "^LaTeX Warning: .*[0-9]+\\.$" - "\\)") - - string) - (TeX-warning string)) + ((string-match + (concat + "\\(" + "^.*erfull \\\\.*[0-9]*--[0-9]*\\|" + ;; XXX: Add full support for multi-line warnings like + ;; Package hyperref Warning: Token not allowed in a PDFDocEncoded string, + ;; (hyperref) removing `math shift' on input line 1453. + "^\\(LaTeX [A-Za-z]*\\|Package [A-Za-z]+ \\)Warning:.*" + "\\)") + string) + (TeX-warning string) + nil) ;; New file -- Push on stack ((string= string "(") @@ -1459,8 +1492,7 @@ (message (concat "! " error)))))) (defun TeX-warning (string) - "Display a warning for STRING. -Return nil if we gave a report." + "Display a warning for STRING." (let* ((error (concat "** " string)) @@ -1474,8 +1506,7 @@ "`\\(\\w+\\)'")) ;; Get error-line (warning) - (line (progn - (re-search-backward line-string) + (line (when (re-search-backward line-string nil t) (string-to-int (TeX-match-buffer 1)))) (line-end (if bad-box (string-to-int (TeX-match-buffer 2)) line)) @@ -1497,9 +1528,7 @@ (error-point (point)) ;; Now find the error word. - (string (progn - (re-search-backward word-string - context-start t) + (string (when (re-search-backward word-string context-start t) (TeX-match-buffer 1))) ;; We might use these in another file. @@ -1511,29 +1540,27 @@ (setq TeX-error-point (point)) ;; Go back to TeX-buffer - (if TeX-debug-bad-boxes - (let ((runbuf (current-buffer)) - (master (with-current-buffer - TeX-command-buffer - (expand-file-name (TeX-master-file))))) - (run-hooks 'TeX-translate-location-hook) - (find-file-other-window file) - (setq TeX-master master) - ;; Find line and string - (goto-line (+ offset line)) - (beginning-of-line 0) - (let ((start (point))) - (goto-line (+ offset line-end)) - (end-of-line) - (search-backward string start t) - (search-forward string nil t)) - ;; Display help - (if TeX-display-help - (TeX-help-error error (if bad-box context (concat "\n" context)) - runbuf) - (message (concat "! " error))) - nil) - t))) + (let ((runbuf (current-buffer)) + (master (with-current-buffer + TeX-command-buffer + (expand-file-name (TeX-master-file))))) + (run-hooks 'TeX-translate-location-hook) + (find-file-other-window file) + (setq TeX-master master) + ;; Find line and string + (when line + (goto-line (+ offset line)) + (beginning-of-line 0) + (let ((start (point))) + (goto-line (+ offset line-end)) + (end-of-line) + (search-backward string start t) + (search-forward string nil t))) + ;; Display help + (if TeX-display-help + (TeX-help-error error (if bad-box context (concat "\n" context)) + runbuf) + (message (concat "! " error)))))) ;;; - Help Index: tex.el =================================================================== RCS file: /cvsroot/auctex/auctex/tex.el,v retrieving revision 5.542 diff -u -r5.542 tex.el --- tex.el 5 Nov 2005 09:27:37 -0000 5.542 +++ tex.el 5 Nov 2005 12:49:30 -0000 @@ -787,7 +787,12 @@ :type 'boolean) (defcustom TeX-debug-bad-boxes nil - "*Non-nil means also find overfull/underfull boxes warnings with \\[TeX-next-error]." + "Non-nil means also find overfull/underfull box warnings with \\[TeX-next-error]." + :group 'TeX-output + :type 'boolean) + +(defcustom TeX-debug-warnings nil + "Non-nil means also find LaTeX or package warnings with \\[TeX-next-error]." :group 'TeX-output :type 'boolean)