diff options
| author | Roland McGrath | 1992-07-27 19:54:35 +0000 |
|---|---|---|
| committer | Roland McGrath | 1992-07-27 19:54:35 +0000 |
| commit | b2bb6ec8ff2bac312f40ab228465ba13e85ee541 (patch) | |
| tree | 28c047c94d41f74cec92193a1591a9f703774080 | |
| parent | 6218e8c63270746ab5819acff47b7312c5cb0067 (diff) | |
| download | emacs-b2bb6ec8ff2bac312f40ab228465ba13e85ee541.tar.gz emacs-b2bb6ec8ff2bac312f40ab228465ba13e85ee541.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/progmodes/compile.el | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 613aa6667da..b1f7fa0683e 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -50,7 +50,8 @@ error messages should be reparsed the next time the list of errors is wanted.") | |||
| 50 | "Value of `compilation-error-list' after errors were parsed.") | 50 | "Value of `compilation-error-list' after errors were parsed.") |
| 51 | 51 | ||
| 52 | (defvar compilation-parse-errors-function 'compilation-parse-errors | 52 | (defvar compilation-parse-errors-function 'compilation-parse-errors |
| 53 | "Function to call (with no args) to parse error messages from a compilation. | 53 | "Function to call to parse error messages from a compilation. |
| 54 | It takes one arg: if non-nil, don't bother parsing past that location. | ||
| 54 | It should read in the source files which have errors and set | 55 | It should read in the source files which have errors and set |
| 55 | `compilation-error-list' to a list with an element for each error message | 56 | `compilation-error-list' to a list with an element for each error message |
| 56 | found. See that variable for more info.") | 57 | found. See that variable for more info.") |
| @@ -384,7 +385,7 @@ Runs `compilation-mode-hook' with `run-hooks' (which see)." | |||
| 384 | 385 | ||
| 385 | ;; Parse any new errors in the compilation buffer, | 386 | ;; Parse any new errors in the compilation buffer, |
| 386 | ;; or reparse from the beginning if the user has asked for that. | 387 | ;; or reparse from the beginning if the user has asked for that. |
| 387 | (defun compile-reinitialize-errors (argp) | 388 | (defun compile-reinitialize-errors (argp &optional limit-search) |
| 388 | (save-excursion | 389 | (save-excursion |
| 389 | (set-buffer compilation-last-buffer) | 390 | (set-buffer compilation-last-buffer) |
| 390 | ;; If we are out of errors, or if user says "reparse", | 391 | ;; If we are out of errors, or if user says "reparse", |
| @@ -400,7 +401,7 @@ Runs `compilation-mode-hook' with `run-hooks' (which see)." | |||
| 400 | (switch-to-buffer compilation-last-buffer) | 401 | (switch-to-buffer compilation-last-buffer) |
| 401 | (set-buffer-modified-p nil) | 402 | (set-buffer-modified-p nil) |
| 402 | (let ((at-start (= compilation-parsing-end 1))) | 403 | (let ((at-start (= compilation-parsing-end 1))) |
| 403 | (funcall compilation-parse-errors-function) | 404 | (funcall compilation-parse-errors-function limit-search) |
| 404 | ;; Remember the entire list for compilation-forget-errors. | 405 | ;; Remember the entire list for compilation-forget-errors. |
| 405 | ;; If this is an incremental parse, append to previous list. | 406 | ;; If this is an incremental parse, append to previous list. |
| 406 | (if at-start | 407 | (if at-start |
| @@ -411,13 +412,13 @@ Runs `compilation-mode-hook' with `run-hooks' (which see)." | |||
| 411 | (defun compile-goto-error (&optional argp) | 412 | (defun compile-goto-error (&optional argp) |
| 412 | "Visit the source for the error message point is on. | 413 | "Visit the source for the error message point is on. |
| 413 | Use this command in a compilation log buffer. | 414 | Use this command in a compilation log buffer. |
| 414 | C-u as a prefix arg means to reparse the buffer's error messages first; | 415 | \\[universal-argument] as a prefix arg means to reparse the buffer's error messages first; |
| 415 | other kinds of prefix arguments are ignored." | 416 | other kinds of prefix arguments are ignored." |
| 416 | (interactive "P") | 417 | (interactive "P") |
| 417 | (or (compilation-buffer-p (current-buffer)) | 418 | (or (compilation-buffer-p (current-buffer)) |
| 418 | (error "Not in a compilation buffer.")) | 419 | (error "Not in a compilation buffer.")) |
| 419 | (setq compilation-last-buffer (current-buffer)) | 420 | (setq compilation-last-buffer (current-buffer)) |
| 420 | (compile-reinitialize-errors argp) | 421 | (compile-reinitialize-errors argp (point)) |
| 421 | (save-excursion | 422 | (save-excursion |
| 422 | (beginning-of-line) | 423 | (beginning-of-line) |
| 423 | ;; Move compilation-error-list to the elt of | 424 | ;; Move compilation-error-list to the elt of |
| @@ -687,14 +688,15 @@ See variables `compilation-parse-errors-function' and | |||
| 687 | (setq groupings (1+ groupings)))))))) | 688 | (setq groupings (1+ groupings)))))))) |
| 688 | groupings)) | 689 | groupings)) |
| 689 | 690 | ||
| 690 | (defun compilation-parse-errors () | 691 | (defun compilation-parse-errors (limit-search) |
| 691 | "Parse the current buffer as grep, cc or lint error messages. | 692 | "Parse the current buffer as grep, cc or lint error messages. |
| 692 | See variable `compilation-parse-errors-function' for the interface it uses." | 693 | See variable `compilation-parse-errors-function' for the interface it uses." |
| 693 | (setq compilation-error-list nil) | 694 | (setq compilation-error-list nil) |
| 694 | (message "Parsing error messages...") | 695 | (message "Parsing error messages...") |
| 695 | (let (text-buffer | 696 | (let (text-buffer |
| 696 | regexp enter-group leave-group error-group | 697 | regexp enter-group leave-group error-group |
| 697 | alist subexpr error-regexp-groups) | 698 | alist subexpr error-regexp-groups |
| 699 | (found-desired nil)) | ||
| 698 | 700 | ||
| 699 | ;; Don't reparse messages already seen at last parse. | 701 | ;; Don't reparse messages already seen at last parse. |
| 700 | (goto-char compilation-parsing-end) | 702 | (goto-char compilation-parsing-end) |
| @@ -739,7 +741,11 @@ See variable `compilation-parse-errors-function' for the interface it uses." | |||
| 739 | (setq subexpr (+ subexpr 1 (count-regexp-groupings (car (car alist))))) | 741 | (setq subexpr (+ subexpr 1 (count-regexp-groupings (car (car alist))))) |
| 740 | (setq alist (cdr alist))) | 742 | (setq alist (cdr alist))) |
| 741 | 743 | ||
| 742 | (while (re-search-forward regexp nil t) | 744 | (while (and (re-search-forward regexp nil t) |
| 745 | ;; We don't just pass LIMIT-SEARCH to re-search-forward | ||
| 746 | ;; because we want to find matches containing LIMIT-SEARCH | ||
| 747 | ;; but which extend past it. | ||
| 748 | (not found-desired)) | ||
| 743 | ;; Figure out which constituent regexp matched. | 749 | ;; Figure out which constituent regexp matched. |
| 744 | (cond ((match-beginning enter-group) | 750 | (cond ((match-beginning enter-group) |
| 745 | ;; The match was the enter-directory regexp. | 751 | ;; The match was the enter-directory regexp. |
| @@ -807,9 +813,18 @@ See variable `compilation-parse-errors-function' for the interface it uses." | |||
| 807 | (cons filename linenum)) | 813 | (cons filename linenum)) |
| 808 | compilation-error-list))))) | 814 | compilation-error-list))))) |
| 809 | (t | 815 | (t |
| 810 | (error "Impossible regexp match!")))) | 816 | (error "Impossible regexp match!"))) |
| 811 | (setq compilation-parsing-end (point-max))) | 817 | (and limit-search (>= (point) limit-search) |
| 812 | (message "Parsing error messages...done") | 818 | ;; The user wanted a specific error, and we're past it. |
| 819 | (setq found-desired t))) | ||
| 820 | (if desired-found | ||
| 821 | (progn | ||
| 822 | (setq compilation-parsing-end (point)) | ||
| 823 | (message "Desired error message found.")) | ||
| 824 | ;; Set to point-max, not point, so we don't perpetually | ||
| 825 | ;; parse the last bit of text when it isn't an error message. | ||
| 826 | (setq compilation-parsing-end (point-max)) | ||
| 827 | (message "Parsing error messages...done"))) | ||
| 813 | (setq compilation-error-list (nreverse compilation-error-list))) | 828 | (setq compilation-error-list (nreverse compilation-error-list))) |
| 814 | 829 | ||
| 815 | (define-key ctl-x-map "`" 'next-error) | 830 | (define-key ctl-x-map "`" 'next-error) |