diff lisp/progmodes/compile.el @ 54761:8fd08fa510b6

(compilation-mode-font-lock-keywords): Redo one more thing that I didn't notice Daniel had undone.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 08 Apr 2004 22:15:11 +0000
parents bdc00a83ecd1
children 1e00569924bf
line wrap: on
line diff
--- a/lisp/progmodes/compile.el	Thu Apr 08 21:02:04 2004 +0000
+++ b/lisp/progmodes/compile.el	Thu Apr 08 22:15:11 2004 +0000
@@ -650,72 +650,76 @@
 
 (defun compilation-mode-font-lock-keywords ()
   "Return expressions to highlight in Compilation mode."
-  (nconc
-   ;; make directory tracking
-   (if compilation-directory-matcher
-       `((,(car compilation-directory-matcher)
-	  ,@(mapcar (lambda (elt)
-		      `(,(car elt)
-			(compilation-directory-properties
-			 ,(car elt) ,(cdr elt))
-			t))
-		    (cdr compilation-directory-matcher)))))
+  (if compilation-parse-errors-function
+      ;; An old package!  Try the compatibility code.
+      '((compilation-compat-parse-errors))
+    (append
+     ;; make directory tracking
+     (if compilation-directory-matcher
+	 `((,(car compilation-directory-matcher)
+	    ,@(mapcar (lambda (elt)
+			`(,(car elt)
+			  (compilation-directory-properties
+			   ,(car elt) ,(cdr elt))
+			  t))
+		      (cdr compilation-directory-matcher)))))
 
-   ;; Compiler warning/error lines.
-   (mapcar (lambda (item)
-	     (if (symbolp item)
-		 (setq item (cdr (assq item
-				       compilation-error-regexp-alist-alist))))
-	     (let ((file (nth 1 item))
-		   (line (nth 2 item))
-		   (col (nth 3 item))
-		   (type (nth 4 item))
-		   end-line end-col fmt)
-	       (if (consp file) (setq fmt (cdr file)	  file (car file)))
-	       (if (consp line) (setq end-line (cdr line) line (car line)))
-	       (if (consp col)	(setq end-col (cdr col)	  col (car col)))
+     ;; Compiler warning/error lines.
+     (mapcar
+      (lambda (item)
+	(if (symbolp item)
+	    (setq item (cdr (assq item
+				  compilation-error-regexp-alist-alist))))
+	(let ((file (nth 1 item))
+	      (line (nth 2 item))
+	      (col (nth 3 item))
+	      (type (nth 4 item))
+	      end-line end-col fmt)
+	  (if (consp file) (setq fmt (cdr file)	  file (car file)))
+	  (if (consp line) (setq end-line (cdr line) line (car line)))
+	  (if (consp col)	(setq end-col (cdr col)	  col (car col)))
 	  
-	       (if (symbolp line)
-		   ;; The old compile.el had here an undocumented hook that
-		   ;; allowed `line' to be a function that computed the actual
-		   ;; error location.  Let's do our best.
-		   `(,(car item)
-		     (0 (compilation-compat-error-properties
-			 (funcall ',line (list* (match-string ,file)
-						default-directory
-						',(nthcdr 4 item))
-				  ,(if col `(match-string ,col)))))
-		     (,file compilation-error-face t))
+	  (if (symbolp line)
+	      ;; The old compile.el had here an undocumented hook that
+	      ;; allowed `line' to be a function that computed the actual
+	      ;; error location.  Let's do our best.
+	      `(,(car item)
+		(0 (compilation-compat-error-properties
+		    (funcall ',line (list* (match-string ,file)
+					   default-directory
+					   ',(nthcdr 4 item))
+			     ,(if col `(match-string ,col)))))
+		(,file compilation-error-face t))
 		    
-		 `(,(nth 0 item)
+	    `(,(nth 0 item)
 
-		   ,@(when (integerp file)
-		       `((,file ,(if (consp type)
-				     `(compilation-face ',type)
-				   (aref [compilation-info-face
-					  compilation-warning-face
-					  compilation-error-face]
-					 (or type 2))))))
+	      ,@(when (integerp file)
+		  `((,file ,(if (consp type)
+				`(compilation-face ',type)
+			      (aref [compilation-info-face
+				     compilation-warning-face
+				     compilation-error-face]
+				    (or type 2))))))
 
-		   ,@(when line
-		       `((,line compilation-line-face nil t)))
-		   ,@(when end-line
-		       `((,end-line compilation-line-face nil t)))
+	      ,@(when line
+		  `((,line compilation-line-face nil t)))
+	      ,@(when end-line
+		  `((,end-line compilation-line-face nil t)))
 
-		   ,@(when col
-		       `((,col compilation-column-face nil t)))
-		   ,@(when end-col
-		       `((,end-col compilation-column-face nil t)))
+	      ,@(when col
+		  `((,col compilation-column-face nil t)))
+	      ,@(when end-col
+		  `((,end-col compilation-column-face nil t)))
 
-		   ,@(nthcdr 6 item)
-		   (,(or (nth 5 item) 0)
-		    (compilation-error-properties ',file ,line ,end-line
-						  ,col ,end-col ',(or type 2)
-						  ',fmt)
-		    append)))))		; for compilation-message-face
-	   compilation-error-regexp-alist)
+	      ,@(nthcdr 6 item)
+	      (,(or (nth 5 item) 0)
+	       (compilation-error-properties ',file ,line ,end-line
+					     ,col ,end-col ',(or type 2)
+					     ',fmt)
+	       append)))))		; for compilation-message-face
+      compilation-error-regexp-alist)
 
-   compilation-mode-font-lock-keywords))
+     compilation-mode-font-lock-keywords)))
 
 
 ;;;###autoload