("`\\(\\(\\S +?\\)\\(?::\\([0-9]+\\)\\)?\\)'" nil nil
(2 compilation-info-face)
(3 compilation-line-face nil t)
- (1 (compilation-error-properties 2 3 nil nil nil 2 nil)
+ (1 (compilation-error-properties 2 3 nil nil nil 0 nil)
append)))
(mips-1
(if (or noconfirm (yes-or-no-p (format "Restart compilation? ")))
(apply 'compilation-start compilation-arguments))))
+;; This points to the location from where the next error will be found.
+;; The global commands next/previous/first-error... as well as
+;; (mouse-)goto-error use this.
+(defvar compilation-current-error nil)
+
;; A function name can't be a hook, must be something with a value.
(defconst compilation-turn-on-font-lock 'turn-on-font-lock)
(defun compilation-setup (&optional minor)
"Prepare the buffer for the compilation parsing commands to work."
+ (make-local-variable 'compilation-current-error)
(make-local-variable 'compilation-error-screen-columns)
(setq compilation-last-buffer (current-buffer))
(if minor
;; count this message only if none of the above are true
(setq n (,1+ n)))))
-(defun compilation-next-error (n &optional different-file)
+(defun compilation-next-error (n &optional different-file pt)
"Move point to the next error in the compilation buffer.
Prefix arg N says how many error messages to move forwards (or
backwards, if negative).
(interactive "p")
(or (compilation-buffer-p (current-buffer))
(error "Not in a compilation buffer"))
+ (or pt (setq pt (point)))
(setq compilation-last-buffer (current-buffer))
- (let* ((pt (point))
- (msg (get-text-property pt 'message))
- (loc (car msg))
- last)
+ (let* ((msg (get-text-property pt 'message))
+ (loc (car msg))
+ last)
(if (zerop n)
(unless (or msg ; find message near here
(setq msg (get-text-property (max (1- pt) 1) 'message)))
(setq msg (get-text-property pt 'message))
(setq pt (point)))))
(setq last (nth 2 (car msg)))
- ;; These loops search only either forwards or backwards
- (compilation-loop > next-single-property-change 1-
- (if (get-buffer-process (current-buffer))
- "No more %ss yet"
- "Moved past last %s"))
- (compilation-loop < previous-single-property-change 1+
- "Moved back before first %s"))
+ (if (>= n 0)
+ (compilation-loop > next-single-property-change 1-
+ (if (get-buffer-process (current-buffer))
+ "No more %ss yet"
+ "Moved past last %s"))
+ ;; don't move "back" to message at or before point
+ (setq pt (previous-single-property-change pt 'message))
+ (compilation-loop < previous-single-property-change 1+
+ "Moved back before first %s")))
(goto-char pt)
(or msg
(error "No %s here" compilation-error))))
(mouse-set-point event)
(if (get-text-property (point) 'directory)
(dired-other-window (car (get-text-property (point) 'directory)))
+ (setq compilation-current-error (point))
(next-error 0)))
(defun compile-goto-error ()
(if (get-text-property (point) 'directory)
(dired-other-window (car (get-text-property (point) 'directory)))
(push-mark)
+ (setq compilation-current-error (point))
(next-error 0)))
;; Return a compilation buffer.
(set-buffer (setq compilation-last-buffer (compilation-find-buffer)))
(let* ((columns compilation-error-screen-columns) ; buffer's local value
(last 1)
- (loc (compilation-next-error (or n 1)))
+ (loc (compilation-next-error (or n 1) nil
+ (or compilation-current-error (point-min))))
(end-loc (nth 2 loc))
(marker (point-marker)))
- (setq loc (car loc))
+ (setq compilation-current-error (point-marker)
+ loc (car loc))
;; If loc contains no marker, no error in that file has been visited. If
;; the marker is invalid the buffer has been killed. So, recalculate all
;; markers for that file.
This operates on the output from the \\[compile] command."
(interactive "p")
(set-buffer (setq compilation-last-buffer (compilation-find-buffer)))
- (goto-char (point-min))
+ (setq compilation-current-error (point-min))
(next-error n))
-(defvar compilation-skip-to-next-location nil
+(defvar compilation-skip-to-next-location t
"*If non-nil, skip multiple error messages for the same source location.")
(defcustom compilation-skip-threshold 1