/[auctex]/auctex/tex-buf.el
ViewVC logotype

Diff of /auctex/tex-buf.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.239 by jalar, Thu Oct 13 11:02:27 2005 UTC revision 1.240 by angeli, Sat Nov 12 09:37:36 2005 UTC
# Line 247  Prefix by C-u to start from the beginnin Line 247  Prefix by C-u to start from the beginnin
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)
# Line 888  Return nil ifs no errors were found." Line 878  Return nil ifs no errors were found."
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."
# Line 925  Return nil ifs no errors were found." Line 929  Return nil ifs no errors were found."
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 "
# Line 1344  You might want to examine and modify the Line 1358  You might want to examine and modify the
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
# Line 1362  You might want to examine and modify the Line 1380  You might want to examine and modify the
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 "(")
# Line 1459  You might want to examine and modify the Line 1482  You might want to examine and modify the
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    
# Line 1474  Return nil if we gave a report." Line 1496  Return nil if we gave a report."
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))
# Line 1497  Return nil if we gave a report." Line 1518  Return nil if we gave a report."
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.
# Line 1511  Return nil if we gave a report." Line 1530  Return nil if we gave a report."
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    

Legend:
Removed from v.1.239  
changed lines
  Added in v.1.240

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26