comparison lisp/progmodes/compile.el @ 25426:a08bfd064439

(compilation-parsing-end,compilation-setup) (compilation-filter, compilation-forget-errors) (compilation-parse-errors): Use a marker instead of an integer for `compilation-parsing-end'.
author Richard M. Stallman <rms@gnu.org>
date Sun, 29 Aug 1999 19:07:33 +0000
parents dcb1db1b1105
children 3141f8df24cc
comparison
equal deleted inserted replaced
25425:f85f374e5395 25426:a08bfd064439
1 ;;; compile.el --- run compiler as inferior of Emacs, parse error messages. 1 ;;; compile.el --- run compiler as inferior of Emacs, parse error messages.
2 2
3 ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. 3 ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
4 4
5 ;; Author: Roland McGrath <roland@prep.ai.mit.edu> 5 ;; Author: Roland McGrath <roland@gnu.org>
6 ;; Maintainer: FSF 6 ;; Maintainer: FSF
7 ;; Keywords: tools, processes 7 ;; Keywords: tools, processes
8 8
9 ;; This file is part of GNU Emacs. 9 ;; This file is part of GNU Emacs.
10 10
130 (or (assq 'compilation-in-progress minor-mode-alist) 130 (or (assq 'compilation-in-progress minor-mode-alist)
131 (setq minor-mode-alist (cons '(compilation-in-progress " Compiling") 131 (setq minor-mode-alist (cons '(compilation-in-progress " Compiling")
132 minor-mode-alist))) 132 minor-mode-alist)))
133 133
134 (defvar compilation-parsing-end nil 134 (defvar compilation-parsing-end nil
135 "Position of end of buffer when last error messages were parsed.") 135 "Marker position of end of buffer when last error messages were parsed.")
136 136
137 (defvar compilation-error-message "No more errors" 137 (defvar compilation-error-message "No more errors"
138 "Message to print when no more matches are found.") 138 "Message to print when no more matches are found.")
139 139
140 (defvar compilation-arguments nil 140 (defvar compilation-arguments nil
944 (defun compilation-setup () 944 (defun compilation-setup ()
945 ;; Make the buffer's mode line show process state. 945 ;; Make the buffer's mode line show process state.
946 (setq mode-line-process '(":%s")) 946 (setq mode-line-process '(":%s"))
947 (set (make-local-variable 'compilation-error-list) nil) 947 (set (make-local-variable 'compilation-error-list) nil)
948 (set (make-local-variable 'compilation-old-error-list) nil) 948 (set (make-local-variable 'compilation-old-error-list) nil)
949 (set (make-local-variable 'compilation-parsing-end) 1) 949 (set (make-local-variable 'compilation-parsing-end) (copy-marker 1))
950 (set (make-local-variable 'compilation-directory-stack) 950 (set (make-local-variable 'compilation-directory-stack)
951 (list default-directory)) 951 (list default-directory))
952 (setq compilation-last-buffer (current-buffer))) 952 (setq compilation-last-buffer (current-buffer)))
953 953
954 (defvar compilation-shell-minor-mode nil 954 (defvar compilation-shell-minor-mode nil
1078 "Process filter for compilation buffers. 1078 "Process filter for compilation buffers.
1079 Just inserts the text, but uses `insert-before-markers'." 1079 Just inserts the text, but uses `insert-before-markers'."
1080 (if (buffer-name (process-buffer proc)) 1080 (if (buffer-name (process-buffer proc))
1081 (save-excursion 1081 (save-excursion
1082 (set-buffer (process-buffer proc)) 1082 (set-buffer (process-buffer proc))
1083 (let ((buffer-read-only nil)) 1083 (let ((buffer-read-only nil)
1084 (end (marker-position compilation-parsing-end)))
1084 (save-excursion 1085 (save-excursion
1085 (goto-char (process-mark proc)) 1086 (goto-char (process-mark proc))
1086 (insert-before-markers string) 1087 (insert-before-markers string)
1088 (set-marker compilation-parsing-end end) ;don't move it
1087 (run-hooks 'compilation-filter-hook) 1089 (run-hooks 'compilation-filter-hook)
1088 (set-marker (process-mark proc) (point))))))) 1090 ;; this seems redundant since we insert-before-marks -stefan
1091 ;;(set-marker (process-mark proc) (point))
1092 )))))
1089 1093
1090 ;; Return the cdr of compilation-old-error-list for the error containing point. 1094 ;; Return the cdr of compilation-old-error-list for the error containing point.
1091 (defun compile-error-at-point () 1095 (defun compile-error-at-point ()
1092 (compile-reinitialize-errors nil (point)) 1096 (compile-reinitialize-errors nil (point))
1093 (let ((errors compilation-old-error-list)) 1097 (let ((errors compilation-old-error-list))
1677 (set-marker (car next-error) nil) 1681 (set-marker (car next-error) nil)
1678 (if (markerp (cdr next-error)) 1682 (if (markerp (cdr next-error))
1679 (set-marker (cdr next-error) nil))) 1683 (set-marker (cdr next-error) nil)))
1680 (setq compilation-old-error-list (cdr compilation-old-error-list))) 1684 (setq compilation-old-error-list (cdr compilation-old-error-list)))
1681 (setq compilation-error-list nil 1685 (setq compilation-error-list nil
1682 compilation-directory-stack (list default-directory) 1686 compilation-directory-stack (list default-directory))
1683 compilation-parsing-end 1) 1687 (set-marker compilation-parsing-end 1)
1684 ;; Remove the highlighting added by compile-reinitialize-errors: 1688 ;; Remove the highlighting added by compile-reinitialize-errors:
1685 (let ((inhibit-read-only t) 1689 (let ((inhibit-read-only t)
1686 (buffer-undo-list t) 1690 (buffer-undo-list t)
1687 deactivate-mark) 1691 deactivate-mark)
1688 (remove-text-properties (point-min) (point-max) '(mouse-face highlight))) 1692 (remove-text-properties (point-min) (point-max) '(mouse-face highlight)))
1939 (/ (* 100.0 (point)) (point-max))) 1943 (/ (* 100.0 (point)) (point-max)))
1940 )) 1944 ))
1941 1945
1942 (forward-line 1))) ; End of while loop. Look at next line. 1946 (forward-line 1))) ; End of while loop. Look at next line.
1943 1947
1944 (setq compilation-parsing-end (point)) 1948 (set-marker compilation-parsing-end (point))
1945 (setq compilation-error-list (nreverse compilation-error-list)) 1949 (setq compilation-error-list (nreverse compilation-error-list))
1946 ;;; (message "Parsing error messages...done. %d found. %.0f%% of buffer seen." 1950 ;;; (message "Parsing error messages...done. %d found. %.0f%% of buffer seen."
1947 ;;; compilation-num-errors-found 1951 ;;; compilation-num-errors-found
1948 ;;; (/ (* 100.0 (point)) (point-max))) 1952 ;;; (/ (* 100.0 (point)) (point-max)))
1949 (message "Parsing error messages...done."))) 1953 (message "Parsing error messages...done.")))