247 |
(previous-error arg) |
(previous-error arg) |
248 |
(error "Jumping to previous error not supported"))) |
(error "Jumping to previous error not supported"))) |
249 |
|
|
|
(defun TeX-toggle-debug-boxes () |
|
|
"Toggle if the debugger should display \"bad boxes\" too." |
|
|
(interactive) |
|
|
(cond (TeX-debug-bad-boxes |
|
|
(setq TeX-debug-bad-boxes nil)) |
|
|
(t |
|
|
(setq TeX-debug-bad-boxes t))) |
|
|
(message (concat "TeX-debug-bad-boxes: " (cond (TeX-debug-bad-boxes "on") |
|
|
(t "off"))))) |
|
|
|
|
250 |
;;; Command Query |
;;; Command Query |
251 |
|
|
252 |
(defun TeX-command (name file &optional override-confirm) |
(defun TeX-command (name file &optional override-confirm) |
878 |
(setq TeX-command-next TeX-command-Show) |
(setq TeX-command-next TeX-command-Show) |
879 |
nil)) |
nil)) |
880 |
|
|
881 |
|
(defun TeX-LaTeX-sentinel-has-warnings () |
882 |
|
"Return non-nil, if the output buffer contains warnings. |
883 |
|
Warnings can be indicated by LaTeX or packages." |
884 |
|
(save-excursion |
885 |
|
(goto-char (point-min)) |
886 |
|
(re-search-forward |
887 |
|
"^\\(LaTeX [A-Za-z]*\\|Package [A-Za-z]+ \\)Warning:" nil t))) |
888 |
|
|
889 |
|
(defun TeX-LaTeX-sentinel-has-bad-boxes () |
890 |
|
"Return non-nil, if LaTeX output indicates overfull or underfull boxes." |
891 |
|
(save-excursion |
892 |
|
(goto-char (point-min)) |
893 |
|
(re-search-forward "^\\(Ov\\|Und\\)erfull \\\\" nil t))) |
894 |
|
|
895 |
;; should go into latex.el? --pg |
;; should go into latex.el? --pg |
896 |
(defun TeX-LaTeX-sentinel (process name) |
(defun TeX-LaTeX-sentinel (process name) |
897 |
"Cleanup TeX output buffer after running LaTeX." |
"Cleanup TeX output buffer after running LaTeX." |
929 |
(setq TeX-command-next TeX-command-Show)) |
(setq TeX-command-next TeX-command-Show)) |
930 |
((re-search-forward |
((re-search-forward |
931 |
"^\\(\\*\\* \\)?J?I?p?\\(La\\|Sli\\)TeX\\(2e\\)? \\(Version\\|ver\\.\\|<[0-9/]*>\\)" nil t) |
"^\\(\\*\\* \\)?J?I?p?\\(La\\|Sli\\)TeX\\(2e\\)? \\(Version\\|ver\\.\\|<[0-9/]*>\\)" nil t) |
932 |
(message (concat name ": successfully formatted " |
(let* ((warnings (and TeX-debug-warnings |
933 |
(TeX-current-pages))) |
(TeX-LaTeX-sentinel-has-warnings))) |
934 |
|
(bad-boxes (and TeX-debug-bad-boxes |
935 |
|
(TeX-LaTeX-sentinel-has-bad-boxes))) |
936 |
|
(add-info (when (or warnings bad-boxes) |
937 |
|
(concat " (with " |
938 |
|
(when warnings "warnings") |
939 |
|
(when (and warnings bad-boxes) " and ") |
940 |
|
(when bad-boxes "bad boxes") |
941 |
|
")")))) |
942 |
|
(message (concat name ": successfully formatted " |
943 |
|
(TeX-current-pages) add-info))) |
944 |
(setq TeX-command-next TeX-command-Show)) |
(setq TeX-command-next TeX-command-Show)) |
945 |
(t |
(t |
946 |
(message (concat name ": problems after " |
(message (concat name ": problems after " |
1358 |
"Goto next error. Pop to OLD buffer if no more errors are found." |
"Goto next error. Pop to OLD buffer if no more errors are found." |
1359 |
(while |
(while |
1360 |
(progn |
(progn |
1361 |
(re-search-forward (concat "\\(" |
(re-search-forward |
1362 |
"^! \\|" |
(concat "\\(" |
1363 |
"(\\|" |
"^! \\|" |
1364 |
")\\|" |
"(\\|" |
1365 |
"\\'\\|" |
")\\|" |
1366 |
"!offset([---0-9]*)\\|" |
"\\'\\|" |
1367 |
"!name([^)]*)\\|" |
"!offset([---0-9]*)\\|" |
1368 |
"^.*erfull \\\\.*[0-9]*--[0-9]*\\|" |
"!name([^)]*)\\|" |
1369 |
"^LaTeX Warning: .*[0-9]+\\.$" |
(when TeX-debug-bad-boxes |
1370 |
"\\)")) |
"^.*erfull \\\\.*[0-9]*--[0-9]*") |
1371 |
|
(when (and TeX-debug-bad-boxes TeX-debug-warnings) "\\|") |
1372 |
|
(when TeX-debug-warnings |
1373 |
|
"^\\(LaTeX [A-Za-z]*\\|Package [A-Za-z]+ \\)Warning:.*") |
1374 |
|
"\\)")) |
1375 |
(let ((string (TeX-match-buffer 1))) |
(let ((string (TeX-match-buffer 1))) |
1376 |
|
|
1377 |
(cond (;; TeX error |
(cond (;; TeX error |
1380 |
nil) |
nil) |
1381 |
|
|
1382 |
;; LaTeX warning |
;; LaTeX warning |
1383 |
((string-match (concat "\\(" |
((string-match |
1384 |
"^.*erfull \\\\.*[0-9]*--[0-9]*\\|" |
(concat |
1385 |
"^LaTeX Warning: .*[0-9]+\\.$" |
"\\(" |
1386 |
"\\)") |
"^.*erfull \\\\.*[0-9]*--[0-9]*\\|" |
1387 |
|
;; XXX: Add full support for multi-line warnings like |
1388 |
string) |
;; Package hyperref Warning: Token not allowed in a PDFDocEncoded string, |
1389 |
(TeX-warning string)) |
;; (hyperref) removing `math shift' on input line 1453. |
1390 |
|
"^\\(LaTeX [A-Za-z]*\\|Package [A-Za-z]+ \\)Warning:.*" |
1391 |
|
"\\)") |
1392 |
|
string) |
1393 |
|
(TeX-warning string) |
1394 |
|
nil) |
1395 |
|
|
1396 |
;; New file -- Push on stack |
;; New file -- Push on stack |
1397 |
((string= string "(") |
((string= string "(") |
1482 |
(message (concat "! " error)))))) |
(message (concat "! " error)))))) |
1483 |
|
|
1484 |
(defun TeX-warning (string) |
(defun TeX-warning (string) |
1485 |
"Display a warning for STRING. |
"Display a warning for STRING." |
|
Return nil if we gave a report." |
|
1486 |
|
|
1487 |
(let* ((error (concat "** " string)) |
(let* ((error (concat "** " string)) |
1488 |
|
|
1496 |
"`\\(\\w+\\)'")) |
"`\\(\\w+\\)'")) |
1497 |
|
|
1498 |
;; Get error-line (warning) |
;; Get error-line (warning) |
1499 |
(line (progn |
(line (when (re-search-backward line-string nil t) |
|
(re-search-backward line-string) |
|
1500 |
(string-to-int (TeX-match-buffer 1)))) |
(string-to-int (TeX-match-buffer 1)))) |
1501 |
(line-end (if bad-box (string-to-int (TeX-match-buffer 2)) |
(line-end (if bad-box (string-to-int (TeX-match-buffer 2)) |
1502 |
line)) |
line)) |
1518 |
(error-point (point)) |
(error-point (point)) |
1519 |
|
|
1520 |
;; Now find the error word. |
;; Now find the error word. |
1521 |
(string (progn |
(string (when (re-search-backward word-string context-start t) |
|
(re-search-backward word-string |
|
|
context-start t) |
|
1522 |
(TeX-match-buffer 1))) |
(TeX-match-buffer 1))) |
1523 |
|
|
1524 |
;; We might use these in another file. |
;; We might use these in another file. |
1530 |
(setq TeX-error-point (point)) |
(setq TeX-error-point (point)) |
1531 |
|
|
1532 |
;; Go back to TeX-buffer |
;; Go back to TeX-buffer |
1533 |
(if TeX-debug-bad-boxes |
(let ((runbuf (current-buffer)) |
1534 |
(let ((runbuf (current-buffer)) |
(master (with-current-buffer |
1535 |
(master (with-current-buffer |
TeX-command-buffer |
1536 |
TeX-command-buffer |
(expand-file-name (TeX-master-file))))) |
1537 |
(expand-file-name (TeX-master-file))))) |
(run-hooks 'TeX-translate-location-hook) |
1538 |
(run-hooks 'TeX-translate-location-hook) |
(find-file-other-window file) |
1539 |
(find-file-other-window file) |
(setq TeX-master master) |
1540 |
(setq TeX-master master) |
;; Find line and string |
1541 |
;; Find line and string |
(when line |
1542 |
(goto-line (+ offset line)) |
(goto-line (+ offset line)) |
1543 |
(beginning-of-line 0) |
(beginning-of-line 0) |
1544 |
(let ((start (point))) |
(let ((start (point))) |
1545 |
(goto-line (+ offset line-end)) |
(goto-line (+ offset line-end)) |
1546 |
(end-of-line) |
(end-of-line) |
1547 |
(search-backward string start t) |
(search-backward string start t) |
1548 |
(search-forward string nil t)) |
(search-forward string nil t))) |
1549 |
;; Display help |
;; Display help |
1550 |
(if TeX-display-help |
(if TeX-display-help |
1551 |
(TeX-help-error error (if bad-box context (concat "\n" context)) |
(TeX-help-error error (if bad-box context (concat "\n" context)) |
1552 |
runbuf) |
runbuf) |
1553 |
(message (concat "! " error))) |
(message (concat "! " error)))))) |
|
nil) |
|
|
t))) |
|
1554 |
|
|
1555 |
;;; - Help |
;;; - Help |
1556 |
|
|