aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2011-01-31 12:09:42 -0500
committerStefan Monnier2011-01-31 12:09:42 -0500
commit9e11271c559360ab8df313aebdba1df067e4db9f (patch)
tree4f41b187ee5f2fbb8995da48bbdbf310d1a61932
parent038714abef7035381fd6b45fba98abbe86bc4400 (diff)
downloademacs-9e11271c559360ab8df313aebdba1df067e4db9f.tar.gz
emacs-9e11271c559360ab8df313aebdba1df067e4db9f.zip
* lisp/progmodes/compile.el (compilation--flush-directory-cache):
New function, extracted from compilation--remove-properties. (compilation--remove-properties, compilation--parse-region): Use it. (compilation--previous-directory): Handle one more case. (compilation-enable-debug-messages): Remove. (compilation-parse-errors, compilation--flush-parse): Just remove the left over debug messages.
-rw-r--r--lisp/ChangeLog23
-rw-r--r--lisp/progmodes/compile.el88
2 files changed, 65 insertions, 46 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 462d57745c5..584bf71c744 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12011-01-31 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * progmodes/compile.el (compilation--flush-directory-cache):
4 New function, extracted from compilation--remove-properties.
5 (compilation--remove-properties, compilation--parse-region): Use it.
6 (compilation--previous-directory): Handle one more case.
7 (compilation-enable-debug-messages): Remove.
8 (compilation-parse-errors, compilation--flush-parse): Just remove the
9 left over debug messages.
10
12011-01-31 Sam Steingold <sds@gnu.org> 112011-01-31 Sam Steingold <sds@gnu.org>
2 12
3 * progmodes/compile.el (compilation-enable-debug-messages): 13 * progmodes/compile.el (compilation-enable-debug-messages):
@@ -5,7 +15,6 @@
5 2011-01-28T22:12:05Z!monnier@iro.umontreal.ca optional. 15 2011-01-28T22:12:05Z!monnier@iro.umontreal.ca optional.
6 (compilation-parse-errors, compilation--flush-parse): Use it. 16 (compilation-parse-errors, compilation--flush-parse): Use it.
7 17
8
92011-01-31 Deniz Dogan <deniz.a.m.dogan@gmail.com> 182011-01-31 Deniz Dogan <deniz.a.m.dogan@gmail.com>
10 19
11 * net/rcirc.el: Clean log filenames (Bug#7933). 20 * net/rcirc.el: Clean log filenames (Bug#7933).
@@ -14,8 +23,8 @@
14 23
152011-01-30 Jan Djärv <jan.h.d@swipnet.se> 242011-01-30 Jan Djärv <jan.h.d@swipnet.se>
16 25
17 * mail/emacsbug.el (report-emacs-bug-insert-to-mailer): Check 26 * mail/emacsbug.el (report-emacs-bug-insert-to-mailer):
18 report-emacs-bug-can-use-osx-open and use that if t. 27 Check report-emacs-bug-can-use-osx-open and use that if t.
19 (report-emacs-bug-can-use-osx-open): New function. 28 (report-emacs-bug-can-use-osx-open): New function.
20 (report-emacs-bug): Rename can-xdg-email to can-insert-mail. 29 (report-emacs-bug): Rename can-xdg-email to can-insert-mail.
21 Check report-emacs-bug-can-use-osx-open also for can-insert-mail. 30 Check report-emacs-bug-can-use-osx-open also for can-insert-mail.
@@ -38,8 +47,8 @@
38 47
392011-01-29 Daiki Ueno <ueno@unixuser.org> 482011-01-29 Daiki Ueno <ueno@unixuser.org>
40 49
41 * epg.el (epg--status-KEYEXPIRED, epg--status-KEYREVOKED): Don't 50 * epg.el (epg--status-KEYEXPIRED, epg--status-KEYREVOKED):
42 presume KEYEXPIRED and KEYREVOKED to be a fatal error status 51 Don't presume KEYEXPIRED and KEYREVOKED to be a fatal error status
43 (Bug#7931). 52 (Bug#7931).
44 53
452011-01-29 Stefan Monnier <monnier@iro.umontreal.ca> 542011-01-29 Stefan Monnier <monnier@iro.umontreal.ca>
@@ -205,8 +214,8 @@
205 214
2062011-01-27 Sam Steingold <sds@gnu.org> 2152011-01-27 Sam Steingold <sds@gnu.org>
207 216
208 * midnight.el (clean-buffer-list-kill-never-buffer-names): Remove 217 * midnight.el (clean-buffer-list-kill-never-buffer-names):
209 "*server*" which is never created by emacs server. 218 Remove "*server*" which is never created by emacs server.
210 219
2112011-01-27 Deniz Dogan <deniz.a.m.dogan@gmail.com> 2202011-01-27 Deniz Dogan <deniz.a.m.dogan@gmail.com>
212 221
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 8bc0f221beb..f1a5801ea1a 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -732,9 +732,6 @@ info, are considered errors."
732 :group 'compilation 732 :group 'compilation
733 :version "22.1") 733 :version "22.1")
734 734
735(defvar compilation-enable-debug-messages nil
736 "Enable debug messages while parsing the compilation buffer.")
737
738(defun compilation-set-skip-threshold (level) 735(defun compilation-set-skip-threshold (level)
739 "Switch the `compilation-skip-threshold' level." 736 "Switch the `compilation-skip-threshold' level."
740 (interactive 737 (interactive
@@ -837,38 +834,61 @@ from a different message."
837 (:conc-name compilation--message->)) 834 (:conc-name compilation--message->))
838 loc type end-loc) 835 loc type end-loc)
839 836
840(defvar compilation--previous-directory-cache nil) 837(defvar compilation--previous-directory-cache nil
838 "A pair (POS . RES) caching the result of previous directory search.
839Basically, this pair says that calling
840 (previous-single-property-change POS 'compilation-directory)
841returned RES, i.e. there is no change of `compilation-directory' between
842POS and RES.")
841(make-variable-buffer-local 'compilation--previous-directory-cache) 843(make-variable-buffer-local 'compilation--previous-directory-cache)
844
845(defun compilation--flush-directory-cache (start end)
846 (cond
847 ((or (not compilation--previous-directory-cache)
848 (<= (car compilation--previous-directory-cache) start)))
849 ((or (not (cdr compilation--previous-directory-cache))
850 (<= (cdr compilation--previous-directory-cache) start))
851 (set-marker (car compilation--previous-directory-cache) start))
852 (t (setq compilation--previous-directory-cache nil))))
853
842(defun compilation--previous-directory (pos) 854(defun compilation--previous-directory (pos)
843 "Like (previous-single-property-change POS 'compilation-directory), but faster." 855 "Like (previous-single-property-change POS 'compilation-directory), but faster."
844 ;; This avoids an N² behavior when there's no/few compilation-directory 856 ;; This avoids an N² behavior when there's no/few compilation-directory
845 ;; entries, in which case each call to previous-single-property-change 857 ;; entries, in which case each call to previous-single-property-change
846 ;; ends up having to walk very far back to find the last change. 858 ;; ends up having to walk very far back to find the last change.
847 (let* ((cache (and compilation--previous-directory-cache 859 (if (and compilation--previous-directory-cache
848 (<= (car compilation--previous-directory-cache) pos) 860 (< pos (car compilation--previous-directory-cache))
849 (car compilation--previous-directory-cache))) 861 (or (null (cdr compilation--previous-directory-cache)
850 (prev 862 (< (cdr compilation--previous-directory-cache) pos))))
851 (previous-single-property-change 863 ;; No need to call previous-single-property-change.
852 pos 'compilation-directory nil cache))) 864 (cdr compilation--previous-directory-cache)
853 (cond 865
854 ((null cache) 866 (let* ((cache (and compilation--previous-directory-cache
855 (setq compilation--previous-directory-cache 867 (<= (car compilation--previous-directory-cache) pos)
856 (cons (copy-marker pos) (copy-marker prev))) 868 (car compilation--previous-directory-cache)))
857 prev) 869 (prev
858 ((eq prev cache) 870 (previous-single-property-change
859 (if cache 871 pos 'compilation-directory nil cache)))
860 (set-marker (car compilation--previous-directory-cache) pos) 872 (cond
873 ((null cache)
861 (setq compilation--previous-directory-cache 874 (setq compilation--previous-directory-cache
862 (cons (copy-marker pos) nil))) 875 (cons (copy-marker pos) (copy-marker prev)))
863 (cdr compilation--previous-directory-cache)) 876 prev)
864 (t 877 ((eq prev cache)
865 (if cache 878 (if cache
866 (progn
867 (set-marker (car compilation--previous-directory-cache) pos) 879 (set-marker (car compilation--previous-directory-cache) pos)
868 (setcdr compilation--previous-directory-cache (copy-marker prev))) 880 (setq compilation--previous-directory-cache
869 (setq compilation--previous-directory-cache 881 (cons (copy-marker pos) nil)))
870 (cons (copy-marker pos) (copy-marker prev)))) 882 (cdr compilation--previous-directory-cache))
871 prev)))) 883 (t
884 (if cache
885 (progn
886 (set-marker (car compilation--previous-directory-cache) pos)
887 (setcdr compilation--previous-directory-cache
888 (copy-marker prev)))
889 (setq compilation--previous-directory-cache
890 (cons (copy-marker pos) (copy-marker prev))))
891 prev)))))
872 892
873;; Internal function for calculating the text properties of a directory 893;; Internal function for calculating the text properties of a directory
874;; change message. The compilation-directory property is important, because it 894;; change message. The compilation-directory property is important, because it
@@ -1099,14 +1119,6 @@ FMTS is a list of format specs for transforming the file name.
1099 1119
1100(defun compilation--remove-properties (&optional start end) 1120(defun compilation--remove-properties (&optional start end)
1101 (with-silent-modifications 1121 (with-silent-modifications
1102 (cond
1103 ((or (not compilation--previous-directory-cache)
1104 (<= (car compilation--previous-directory-cache) start)))
1105 ((or (not (cdr compilation--previous-directory-cache))
1106 (<= (cdr compilation--previous-directory-cache) start))
1107 (set-marker (car compilation--previous-directory-cache) start))
1108 (t (setq compilation--previous-directory-cache nil)))
1109
1110 ;; When compile.el used font-lock directly, we could just remove all 1122 ;; When compile.el used font-lock directly, we could just remove all
1111 ;; our text-properties in one go, but now that we manually place 1123 ;; our text-properties in one go, but now that we manually place
1112 ;; font-lock-face, we have to be careful to only remove the font-lock-face 1124 ;; font-lock-face, we have to be careful to only remove the font-lock-face
@@ -1118,6 +1130,7 @@ FMTS is a list of format specs for transforming the file name.
1118 (let (next) 1130 (let (next)
1119 (unless start (setq start (point-min))) 1131 (unless start (setq start (point-min)))
1120 (unless end (setq end (point-max))) 1132 (unless end (setq end (point-max)))
1133 (compilation--flush-directory-cache start end)
1121 (while 1134 (while
1122 (progn 1135 (progn
1123 (setq next (or (next-single-property-change 1136 (setq next (or (next-single-property-change
@@ -1155,6 +1168,7 @@ FMTS is a list of format specs for transforming the file name.
1155 (goto-char start) 1168 (goto-char start)
1156 (while (re-search-forward (car compilation-directory-matcher) 1169 (while (re-search-forward (car compilation-directory-matcher)
1157 end t) 1170 end t)
1171 (compilation--flush-directory-cache (match-beginning 0) (match-end 0))
1158 (when compilation-debug 1172 (when compilation-debug
1159 (font-lock-append-text-property 1173 (font-lock-append-text-property
1160 (match-beginning 0) (match-end 0) 1174 (match-beginning 0) (match-end 0)
@@ -1172,8 +1186,6 @@ FMTS is a list of format specs for transforming the file name.
1172 "Parse errors between START and END. 1186 "Parse errors between START and END.
1173The errors recognized are the ones specified in RULES which default 1187The errors recognized are the ones specified in RULES which default
1174to `compilation-error-regexp-alist' if RULES is nil." 1188to `compilation-error-regexp-alist' if RULES is nil."
1175 (when compilation-enable-debug-messages
1176 (message "compilation-parse-errors: %S %S" start end))
1177 (dolist (item (or rules compilation-error-regexp-alist)) 1189 (dolist (item (or rules compilation-error-regexp-alist))
1178 (if (symbolp item) 1190 (if (symbolp item)
1179 (setq item (cdr (assq item 1191 (setq item (cdr (assq item
@@ -1302,8 +1314,6 @@ to `compilation-error-regexp-alist' if RULES is nil."
1302 1314
1303(defun compilation--flush-parse (start end) 1315(defun compilation--flush-parse (start end)
1304 "Mark the region between START and END for re-parsing." 1316 "Mark the region between START and END for re-parsing."
1305 (when compilation-enable-debug-messages
1306 (message "compilation--flush-parse: %S %S" start end))
1307 (if (markerp compilation--parsed) 1317 (if (markerp compilation--parsed)
1308 (move-marker compilation--parsed (min start compilation--parsed)))) 1318 (move-marker compilation--parsed (min start compilation--parsed))))
1309 1319