comparison lisp/progmodes/compile.el @ 1846:19c13118ba0c

(compilation-forget-errors): Just set compilation-directory-stack to nil; no need to loop through it. (next-error): For a non-numeric prefix arg, pass nil for compile-reinitialize-errors's FIND-AT-LEAST arg. (next-error): When getting marker for error source location, be sure to examine buffer local value of compilation-old-error-list before switching to source file buffer.
author Roland McGrath <roland@gnu.org>
date Mon, 08 Feb 1993 20:46:10 +0000
parents d1a56482a2af
children 2c7997f249eb
comparison
equal deleted inserted replaced
1845:aeb1a834481b 1846:19c13118ba0c
630 630
631 See variables `compilation-parse-errors-function' and 631 See variables `compilation-parse-errors-function' and
632 \`compilation-error-regexp-alist' for customization ideas." 632 \`compilation-error-regexp-alist' for customization ideas."
633 (interactive "P") 633 (interactive "P")
634 (setq compilation-last-buffer (compilation-find-buffer)) 634 (setq compilation-last-buffer (compilation-find-buffer))
635 (compile-reinitialize-errors argp nil (1- (prefix-numeric-value argp))) 635 (compile-reinitialize-errors argp nil
636 ;; We want to pass a number here only if
637 ;; we got a numeric prefix arg, not just C-u.
638 (and (not (consp argp))
639 (1- (prefix-numeric-value argp))))
636 ;; Make ARGP nil if the prefix arg was just C-u, 640 ;; Make ARGP nil if the prefix arg was just C-u,
637 ;; since that means to reparse the errors, which the 641 ;; since that means to reparse the errors, which the
638 ;; compile-reinitialize-errors call just did. 642 ;; compile-reinitialize-errors call just did.
639 ;; Now we are only interested in a numeric prefix arg. 643 ;; Now we are only interested in a numeric prefix arg.
640 (if (consp argp) 644 (if (consp argp)
686 (setcdr (car next-errors) nil))) 690 (setcdr (car next-errors) nil)))
687 (setq next-errors (cdr next-errors))) 691 (setq next-errors (cdr next-errors)))
688 ;; Look for the next error. 692 ;; Look for the next error.
689 t) 693 t)
690 ;; We found the file. Get a marker for this error. 694 ;; We found the file. Get a marker for this error.
691 (set-buffer buffer) 695 ;; compilation-old-error-list is a buffer-local
692 (save-excursion 696 ;; variable, so we must be careful to extract its value
693 (save-restriction 697 ;; before switching to the source file buffer.
694 (widen) 698 (let ((errors compilation-old-error-list)
695 (let ((errors compilation-old-error-list) 699 (last-line (cdr (cdr next-error))))
696 (last-line (cdr (cdr next-error)))) 700 (set-buffer buffer)
701 (save-excursion
702 (save-restriction
703 (widen)
697 (goto-line last-line) 704 (goto-line last-line)
698 (beginning-of-line) 705 (beginning-of-line)
699 (setcdr next-error (point-marker)) 706 (setcdr next-error (point-marker))
700 ;; Make all the other error messages referring 707 ;; Make all the other error messages referring
701 ;; to the same file have markers into the buffer. 708 ;; to the same file have markers into the buffer.
791 (let ((next-error (car compilation-old-error-list))) 798 (let ((next-error (car compilation-old-error-list)))
792 (set-marker (car next-error) nil) 799 (set-marker (car next-error) nil)
793 (if (markerp (cdr next-error)) 800 (if (markerp (cdr next-error))
794 (set-marker (cdr next-error) nil))) 801 (set-marker (cdr next-error) nil)))
795 (setq compilation-old-error-list (cdr compilation-old-error-list))) 802 (setq compilation-old-error-list (cdr compilation-old-error-list)))
796 (setq compilation-error-list nil) 803 (setq compilation-error-list nil
797 (while (cdr compilation-directory-stack) 804 compilation-directory-stack nil))
798 (setq compilation-directory-stack (cdr compilation-directory-stack))))
799 805
800 806
801 (defun count-regexp-groupings (regexp) 807 (defun count-regexp-groupings (regexp)
802 "Return the number of \\( ... \\) groupings in REGEXP (a string)." 808 "Return the number of \\( ... \\) groupings in REGEXP (a string)."
803 (let ((groupings 0) 809 (let ((groupings 0)