unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* 2 fixes for compile.el
@ 2002-11-16 17:27 Daniel Pfeiffer
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Pfeiffer @ 2002-11-16 17:27 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1764 bytes --]

Hi,

Sorry, this time it's definite.  My post yesterday had some glitches, and while debugging them I corrected and slimmed down quite a few of the regexps.  Now I match all of the messages provided as examples except for the "horrible fc" and BSD lint 2 (both of which didn't work before either) and BSD lint 3, which still matches way too much.

While doing this it struck me that compile is a horrible cludge from prehistorical times.  Now that font lock can trivially set arbitrary properties -- and does it much better than the stop & go approach of compile!!! --, it would be best to let it do the whole parsing.

next-error and the like would then only have to scan the buffer for fileinfo text properties left for it by font lock.  I guess this would make the library a third smaller and more efficient too.

best regards
Daniel

---------------

Two more things:

- the word warning now gets found case insensitively in my new diff

- font-lock in CVS has for quite a few versions contained the line

,(+ ,c-type-names-depth 2))

which understandably causes an error for me in c-mode.  But even taking away the comma leaves the var undefined :-( (in 1.199 which is the latest that might have worked with 21.2)

---------------

Hi,

this fixes 2 things:

- warnings and errors didn't get distinguished which finally got insupportable with strict gcc 3.2

- compile buffers are hypertext but didn't have mouse hightlight

Note that the latter uses font-lock's facename as property list, which was documented in 21.2 (as delivered by SuSE 8.1), but only works when getting a newer font-lock and syntax from CVS.

coralament / best Grötens / liebe Grüße / best regards / elkorajn salutojn
Daniel Pfeiffer

-- 
 -- http://dapfy.bei.t-online.de/sawfish/
  --


[-- Attachment #2: ChangeLog --]
[-- Type: application/octet-stream, Size: 503 bytes --]

2002-11-16  Daniel Pfeiffer  <occitan@esperanto.org>

	* compile.el (font-lock-compile-error-face,
	font-lock-compile-warning-face): new faces
	* compile.el (compile-error-or-warning-face): new fun
	* compile.el (compilation-mode-font-lock-keywords): add previous
	* compile.el (compilation-non-error-initials): new var
	* compile.el (compilation-error-regexp-alist): added TYPE-IDX
	before FORMATS, all work except HPUX fc & 4.3BSD lint pass 2/3
	* compile.el (compilation-parse-errors): strip TYPE-IDX

[-- Attachment #3: compile.el.diff --]
[-- Type: application/octet-stream, Size: 9289 bytes --]

222a223,227
> (defvar compilation-non-error-initials '(?w ?W ?i)
>   "These initial letters indicate a warning rather than an error.
> They are compared to the first letter matched by TYPE-IDX in
> `compilation-error-regexp-alist', if TYPE-IDX was given.")
> 
227,229c232
<     ;; 4.3BSD grep, cc, lint pass 1:
<     ;; 	/usr/src/foo/foo.c(8): warning: w may be used before set
<     ;; or GNU utilities:
---
>     ;; GNU utilities:
231,232d233
<     ;; or HP-UX 7.0 fc:
<     ;; 	foo.f          :16    some horrible error message
246,247c247,248
< \\([a-zA-Z]?:?[^:( \t\n]*[^:( \t\n0-9][^:( \t\n]*\\)[:(][ \t]*\\([0-9]+\\)\
< \\([) \t]\\|:\\(\\([0-9]+:\\)\\|[0-9]*[^:0-9]\\)\\)" 2 3 6)
---
> \\([a-zA-Z]?:?[^:( \t\n]*[^:( \t\n0-9][^:( \t\n]*\\):[ \t]*\\([0-9]+\\)\
> \\([) \t]\\|:\\(\\([0-9]+\\):\\|[0-9]*[^:0-9]\\)\\) *\\(warning\\|W:\\)?" 2 3 6 7)
252,255d252
<     ("\\([a-zA-Z][-a-zA-Z._0-9]+\\): ?\
< \\([0-9]+\\)\\.\\([0-9]+\\)\
< -\\([0-9]+\\)\\.\\([0-9]+\\)\
< :" 1 2 3) ;; When ending points are supported, add line = 4 and col = 5.
257,265d253
<     ("\\([a-zA-Z][-a-zA-Z._0-9]+\\): ?\
< \\([0-9]+\\)\\.\\([0-9]+\\)\
< -\\([0-9]+\\)\
< :" 1 2 3) ;; When ending points are supported, add line = 2 and col = 4.
<     ;;  foo.c:8-45.3: error message
<     ("\\([a-zA-Z][-a-zA-Z._0-9]+\\): ?\
< \\([0-9]+\\)\
< -\\([0-9]+\\)\\.\\([0-9]+\\)\
< :" 1 2 nil) ;; When ending points are supported, add line = 2 and col = 4.
267,269c255
<     ("\\([a-zA-Z][-a-zA-Z._0-9]+\\): ?\
< \\([0-9]+\\)\\.\\([0-9]+\\)\
< :" 1 2 3)
---
>     ;;  foo.c:8-45.3: error message
272,274c258,273
< \\([0-9]+\\)\
< -\\([0-9]+\\)\
< :" 1 2 nil);; When ending points are supported, add line = 3.
---
> \\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?\
> \\(-\\([0-9]+\\)\\)?\\(\\.\\([0-9]+\\)\\)?\
> :" 1 2 4)
> 
>     ;; 4.3BSD grep, cc, lint pass 1:
>     ;; 	/usr/src/foo/foo.c(8): warning: w may be used before set
>     ;; or IBM C/C++ Tools 2.01:
>     ;;  foo.c(2:0) : informational EDC0804: Function foo is not referenced.
>     ;;  foo.c(3:8) : warning EDC0833: Implicit return statement encountered.
>     ;;  foo.c(5:5) : error EDC0350: Syntax error.
>     ("\\([^( \n\t]+\\)(\\([0-9]+\\)\\(:\\([0-9]+\\)\\)?) *: \\([iwe]\\)?" 1 2 4 5)
> 
>     ;; The first monster rule matched this, but wrongly
>     ;; HP-UX 7.0 fc:
>     ;; 	foo.f          :16    some horrible error message
> 
286c285
< : \\(error\\|warning\\) C[0-9]+:" 1 3)
---
> : \\(error\\|warning\\) C[0-9]+:" 1 3 nil 4)
295c294
<  \\([0-9]+\\)\\([) \t]\\|:[^0-9\n]\\)" 4 5)
---
>  \\([0-9]+\\)\\([) \t]\\|:[^0-9\n]\\)" 4 5 nil 1)
301c300,301
<     ("^==[0-9]+==[^(]+\(([^:]+):([0-9]+)" 1 2)
---
>     ;; (too bad he tried Perl regexps, which emacs doesn't understand :-)
>     ("==[0-9]+==[^(]+(\\([^:]+\\):\\([0-9]+\\))" 1 2)
305,306c305,306
<     (".*[ \t:]\\([a-zA-Z]?:?[^:( \t\n]+\\)[:(](+[ \t]*\\([0-9]+\\))[:) \t]*$"
<      1 2)
---
>     ;; this doesn't match the above message
>     ;;(".*[ \t:]\\([a-zA-Z]?:?[^:( \t\n]+\\)[:(](+[ \t]*\\([0-9]+\\))[:) \t]*$" 1 2)
313c313,314
<     (".*([ \t]*\\([a-zA-Z]?:?[^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\))" 1 2)
---
>     ;; and this still does:
>     ;;(".*([ \t]*\\([a-zA-Z]?:?[^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\))" 1 2)
325c326
<     ("\\(cfe\\|fort\\): [^:\n]*: \\([^ \n]*\\), line \\([0-9]+\\):" 2 3)
---
>     ("\\(cfe\\|fort\\): \\([^:\n]*\\): \\([^ \n]*\\), line \\([0-9]+\\):" 3 4 nil 2)
333c334
< of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2)
---
> of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil 1)
346c347
< \\([0-9]+\\)\\([\(.]\\([0-9]+\\)\)?\\)?[:., (-]" 1 2 4)
---
> \\([0-9]+\\)\\(\\([\(.]\\|pos \\)\\([0-9]+\\)\)?\\)?[:;., (-][^a-zA-Z]*(?\\(W)\\|warning\\)?" 1 2 5 6)
350,351d350
<    ("^File \"\\([^,\" \n\t]+\\)\", line \\([0-9]+\\)," 1 2)
< 
354c353
<    ("^File \"\\([^,\" \n\t]+\\)\", lines? \\([0-9]+\\)[-0-9]*, characters? \\([0-9]+\\)" 1 2 3)
---
>     ("File \"\\([^,\" \n\t]+\\)\", lines? \\([0-9]+\\)\\([-0-9]*, characters? \\([0-9]+\\)\\)?" 1 2 4)
360c359
<     ("[a-z0-9/]+: \\([eE]rror\\|[wW]arning\\): \\([^,\" \n\t]+\\)[,:] \\(line \\)?\\([0-9]+\\):" 2 4)
---
>     ("[a-z0-9/]+: \\([eE]rror\\|[wW]arning\\): \\([^,\" \n\t]+\\)[,:] \\(line \\)?\\([0-9]+\\):" 2 4 nil 1)
380c379
<     ("[EW], \\([^(\n]*\\)(\\([0-9]+\\),[ \t]*\\([0-9]+\\)" 1 2 3)
---
>     ("\\([EW]\\), \\([^(\n]*\\)(\\([0-9]+\\),[ \t]*\\([0-9]+\\)" 2 3 4 1)
391,396d389
<     ;; IBM C/C++ Tools 2.01:
<     ;;  foo.c(2:0) : informational EDC0804: Function foo is not referenced.
<     ;;  foo.c(3:8) : warning EDC0833: Implicit return statement encountered.
<     ;;  foo.c(5:5) : error EDC0350: Syntax error.
<     ("\\([^( \n\t]+\\)(\\([0-9]+\\):\\([0-9]+\\)) : " 1 2 3)
< 
400c393
<     ("\"\\(.*\\)\",\\([0-9]+\\)\\s-+\\(Error\\|Warning\\)\\[[0-9]+\\]:" 1 2)
---
>     ("\"\\(.*\\)\",\\([0-9]+\\)\\s-+\\(Error\\|Warning\\)\\[[0-9]+\\]:" 1 2 nil 3)
423,424c416
<     (".*: ERROR File = \\(.+\\), Line = \\([0-9]+\\)" 1 2)
<     (".*: WARNING File = \\(.+\\), Line = \\([0-9]+\\)" 1 2)
---
>     (".*: \\(ERROR\\|WARNING\\) File = \\(.+\\), Line = \\([0-9]+\\)" 2 3 nil 1)
434,435d425
<     ("Error:.*\n.* line \\([0-9]+\\) char \\([0-9]+\\) of file://\\(.+\\)"
<      3 1 2)
438,439c428,429
<     ("Warning:.*\n.* line \\([0-9]+\\) char \\([0-9]+\\) of file://\\(.+\\)"
<      3 1 2)
---
>     ("\\(Error\\|Warning\\):.*\n.* line \\([0-9]+\\) char \\([0-9]+\\) of file://\\(.+\\)"
>      4 2 3 1)
443c433
< Each elt has the form (REGEXP FILE-IDX LINE-IDX [COLUMN-IDX FILE-FORMAT...])
---
> Each elt has the form (REGEXP FILE-IDX LINE-IDX [COLUMN-IDX TYPE-IDX FILE-FORMAT...])
446a437
> If TYPE-IDX is given, compare TYPE-IDX'th subexpression with `compilation-non-error-initials'.
597a589,620
> (defface font-lock-compile-error-face
>   '((((type tty) (class color)) (:foreground "red"))
>     (((class color) (background light)) (:foreground "Red" :weight bold))
>     (((class color) (background dark)) (:foreground "Pink" :weight bold))
>     (t (:inverse-video t :weight bold)))
>   "Font Lock mode face used to highlight compiler errors."
>   :group 'font-lock-highlighting-faces)
> 
> (defface font-lock-compile-warning-face
>   '((((type tty) (class color)) (:foreground "cyan" :weight bold))
>     (((class color) (background light)) (:foreground "Purple" :weight bold))
>     (((class color) (background dark)) (:foreground "Cyan" :weight bold))
>     (t (:weight bold)))
>   "Font Lock mode face used to highlight compiler warnings."
>   :group 'font-lock-highlighting-faces)
> 
> (defun compile-error-or-warning-face (type)
>   "Choose face for whether we're highlighting an error or warning."
>   `(face ,(if type
> 	      (if (and (setq type (match-string type))
> 		       (> (length type) 0)
> 		       (memq (aref type 0) compilation-non-error-initials))
> 		  'font-lock-compile-warning-face
> 		'font-lock-compile-error-face)
> 	    (save-match-data
> 	      (save-excursion
> 		(beginning-of-line)
> 		(if (let ((case-fold-search t)) (looking-at ".*warning"))
> 		    'font-lock-compile-warning-face
> 		  'font-lock-compile-error-face))))
>     mouse-face highlight))
> 
600,629c623,648
<   (nconc
<    ;;
<    ;; Compiler warning/error lines.
<    (mapcar (function
< 	    (lambda (item)
< 	      ;; Prepend "^", adjusting FILE-IDX and LINE-IDX accordingly.
< 	      (let ((file-idx (nth 1 item))
< 		    (line-idx (nth 2 item))
< 		    (col-idx (nth 3 item))
< 		    keyword)
< 		(when (numberp col-idx)
< 		  (setq keyword
< 			(cons (list (1+ col-idx) 'font-lock-type-face nil t)
< 			      keyword)))
< 		(when (numberp line-idx)
< 		  (setq keyword
< 			(cons (list (1+ line-idx) 'font-lock-variable-name-face)
< 			      keyword)))
< 		(when (numberp file-idx)
< 		  (setq keyword
< 			(cons (list (1+ file-idx) 'font-lock-warning-face)
< 			      keyword)))
< 		(cons (concat "^\\(" (nth 0 item) "\\)") keyword))))
< 	   compilation-error-regexp-alist)
<    (list
<     ;;
<     ;; Compiler output lines.  Recognize `make[n]:' lines too.
<     '("^\\([A-Za-z_0-9/\.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:"
<       (1 font-lock-function-name-face) (3 font-lock-comment-face nil t)))
<    ))
---
>   `(;; Compiler warning/error lines.
>     ,@(mapcar (lambda (item)
> 		(let ((file-idx (nth 1 item))
> 		      (line-idx (nth 2 item))
> 		      (col-idx (nth 3 item))
> 		      (type-idx (nth 4 item))
> 		      keyword)
> 		  (when (numberp col-idx)
> 		    (setq keyword
> 			  `((,(1+ col-idx) font-lock-type-face nil t))))
> 		  (when (numberp line-idx)
> 		    (setq keyword
> 			  `((,(1+ line-idx) font-lock-variable-name-face)
> 			    ,@keyword)))
> 		  (when (numberp file-idx)
> 		    (setq keyword
> 			  `((,(1+ file-idx)
> 			     (compile-error-or-warning-face ,(if (numberp type-idx)
> 								 (1+ type-idx))))
> 			    ,@keyword)))
> 		  ;; Prepend "^", adjusting FILE-IDX and LINE-IDX accordingly.
> 		  (cons (concat "^\\(" (nth 0 item) "\\)") keyword)))
> 	      compilation-error-regexp-alist)
>       ;; Compiler output lines.  Recognize `make[n]:' lines too.
>       ("^\\([A-Za-z_0-9/\.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:"
>        (1 font-lock-function-name-face) (3 font-lock-comment-face nil t))))
2162c2181
< 			  (cons filename (cons default-directory (cdr alist))))
---
> 			  (cons filename (cons default-directory (cddr alist))))

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 2 fixes for compile.el
@ 2002-11-16 21:12 Daniel Pfeiffer
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Pfeiffer @ 2002-11-16 21:12 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 525 bytes --]

Hi,

this fixes 2 things:

- warnings and errors didn't get distinguished which finally got insupportable with strict gcc 3.2

- compile buffers are hypertext but didn't have mouse hightlight

Note that the latter uses font-lock's facename as property list, which was documented in 21.2 (as delivered by SuSE 8.1), but only works when getting a newer font-lock and syntax from CVS.

coralament / best Grötens / liebe Grüße / best regards / elkorajn salutojn
Daniel Pfeiffer

-- 
 -- http://dapfy.bei.t-online.de/sawfish/
  --

[-- Attachment #2: compile.el.diff --]
[-- Type: application/octet-stream, Size: 4279 bytes --]

--- compile.el.CVS	2002-11-16 12:59:25.000000000 +0100
+++ compile.el	2002-11-16 21:33:51.000000000 +0100
@@ -283,7 +283,7 @@
     ;; but they are valid now; so I made it more strict about the error
     ;; message that follows.
     ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \
-: \\(error\\|warning\\) C[0-9]+:" 1 3)
+: \\(error\\|warning\\) C[0-9]+:" 1 3 nil 4)
 
     ;; Borland C++, C++Builder:
     ;;  Error ping.c 15: Unable to open include file 'sys/types.h'
@@ -292,7 +292,7 @@
     ;;  Warning W1022 ping.c 68: Call to function 'func' with no prototype
     ("\\(Error\\|Warning\\) \\(\\([FEW][0-9]+\\) \\)?\
 \\([a-zA-Z]?:?[^:( \t\n]+\\)\
- \\([0-9]+\\)\\([) \t]\\|:[^0-9\n]\\)" 4 5)
+ \\([0-9]+\\)\\([) \t]\\|:[^0-9\n]\\)" 4 5 nil 1)
 
     ;; Valgrind (memory debugger for x86 GNU/Linux):
     ;;  ==1332==    at 0x8008621: main (vtest.c:180)
@@ -357,7 +357,7 @@
     ;;	ccom: Error: foo.c, line 2: syntax error
     ;; DEC AXP OSF/1 cc
     ;;  /usr/lib/cmplrs/cc/cfe: Error: foo.c: 1: blah blah
-    ("[a-z0-9/]+: \\([eE]rror\\|[wW]arning\\): \\([^,\" \n\t]+\\)[,:] \\(line \\)?\\([0-9]+\\):" 2 4)
+    ("[a-z0-9/]+: \\([eE]rror\\|[wW]arning\\): \\([^,\" \n\t]+\\)[,:] \\(line \\)?\\([0-9]+\\):" 2 4 nil 1)
 
     ;; IBM AIX PS/2 C version 1.1:
     ;;	****** Error number 140 in line 8 of file errors.c ******
@@ -397,7 +397,7 @@
     ;; IAR Systems C Compiler:
     ;;  "foo.c",3  Error[32]: Error message
     ;;  "foo.c",3  Warning[32]: Error message
-    ("\"\\(.*\\)\",\\([0-9]+\\)\\s-+\\(Error\\|Warning\\)\\[[0-9]+\\]:" 1 2)
+    ("\"\\(.*\\)\",\\([0-9]+\\)\\s-+\\(Error\\|Warning\\)\\[[0-9]+\\]:" 1 2 nil 3)
 
     ;; Sun ada (VADS, Solaris):
     ;;  /home3/xdhar/rcds_rc/main.a, line 361, char 6:syntax error: "," inserted
@@ -420,8 +420,7 @@
 
     ;; SGI IRIX MipsPro 7.3 compilers:
     ;; cc-1070 cc: ERROR File = linkl.c, Line = 38
-    (".*: ERROR File = \\(.+\\), Line = \\([0-9]+\\)" 1 2)
-    (".*: WARNING File = \\(.+\\), Line = \\([0-9]+\\)" 1 2)
+    (".*: \\(ERROR\\|WARNING\\) File = \\(.+\\), Line = \\([0-9]+\\)" 2 3 nil 1)
 
     ;; Sun F90 error messages:
     ;; cf90-113 f90comp: ERROR NSE, File = Hoved.f90, Line = 16, Column = 3
@@ -595,6 +594,37 @@
 (defvar grep-history nil)
 (defvar grep-find-history nil)
 
+(defface font-lock-compile-error-face
+  '((((type tty) (class color)) (:foreground "red"))
+    (((class color) (background light)) (:foreground "Red" :weight bold))
+    (((class color) (background dark)) (:foreground "Pink" :weight bold))
+    (t (:inverse-video t :weight bold)))
+  "Font Lock mode face used to highlight compiler errors."
+  :group 'font-lock-highlighting-faces)
+
+(defface font-lock-compile-warning-face
+  '((((type tty) (class color)) (:foreground "cyan" :weight bold))
+    (((class color) (background light)) (:foreground "Purple" :weight bold))
+    (((class color) (background dark)) (:foreground "Cyan" :weight bold))
+    (t (:weight bold)))
+  "Font Lock mode face used to highlight compiler warnings."
+  :group 'font-lock-highlighting-faces)
+
+(defun compile-error-or-warning-face (idx)
+  "Choose face for whether we're highlighting an error or warning."
+  (list 'face
+	(if (> idx 0)
+	    (if (string= (downcase (match-string (1+ idx))) "error")
+		'font-lock-compile-error-face
+	      'font-lock-compile-warning-face)
+	  (save-match-data
+	    (save-excursion
+	      (beginning-of-line)
+	      (if (looking-at ".*warning")
+		  'font-lock-compile-warning-face
+		'font-lock-compile-error-face))))
+	'mouse-face 'highlight))
+
 (defun compilation-mode-font-lock-keywords ()
   "Return expressions to highlight in Compilation mode."
   (nconc
@@ -606,6 +636,7 @@
 	      (let ((file-idx (nth 1 item))
 		    (line-idx (nth 2 item))
 		    (col-idx (nth 3 item))
+		    (type-idx (nth 4 item))
 		    keyword)
 		(when (numberp col-idx)
 		  (setq keyword
@@ -617,8 +648,11 @@
 			      keyword)))
 		(when (numberp file-idx)
 		  (setq keyword
-			(cons (list (1+ file-idx) 'font-lock-warning-face)
-			      keyword)))
+			`((,(1+ file-idx)
+			   (compile-error-or-warning-face ,(if (numberp type-idx)
+							       type-idx
+							     0)))
+			  ,@keyword)))
 		(cons (concat "^\\(" (nth 0 item) "\\)") keyword))))
 	   compilation-error-regexp-alist)
    (list

[-- Attachment #3: ChangeLog --]
[-- Type: application/octet-stream, Size: 265 bytes --]

2002-11-16  Daniel Pfeiffer  <occitan@esperanto.org>

	* compile.el (font-lock-compile-error-face,
	font-lock-compile-warning-face): new faces
	* compile.el (compile-error-or-warning-face): new fun
	* compile.el (compilation-mode-font-lock-keywords): add previous


^ permalink raw reply	[flat|nested] 3+ messages in thread

* 2 fixes for compile.el
@ 2002-11-16 21:51 Daniel Pfeiffer
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Pfeiffer @ 2002-11-16 21:51 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 908 bytes --]

Two more things:

- the word warning now gets found case insensitively in my new diff

- font-lock in CVS has for quite a few versions contained the line

,(+ ,c-type-names-depth 2))

which understandably causes an error for me in c-mode.  But even taking away the comma leaves the var undefined :-( (in 1.199 which is the latest that might have worked with 21.2)

---------------

Hi,

this fixes 2 things:

- warnings and errors didn't get distinguished which finally got insupportable with strict gcc 3.2

- compile buffers are hypertext but didn't have mouse hightlight

Note that the latter uses font-lock's facename as property list, which was documented in 21.2 (as delivered by SuSE 8.1), but only works when getting a newer font-lock and syntax from CVS.

coralament / best Grötens / liebe Grüße / best regards / elkorajn salutojn
Daniel Pfeiffer

-- 
 -- http://dapfy.bei.t-online.de/sawfish/
  --

[-- Attachment #2: ChangeLog --]
[-- Type: application/octet-stream, Size: 265 bytes --]

2002-11-16  Daniel Pfeiffer  <occitan@esperanto.org>

	* compile.el (font-lock-compile-error-face,
	font-lock-compile-warning-face): new faces
	* compile.el (compile-error-or-warning-face): new fun
	* compile.el (compilation-mode-font-lock-keywords): add previous


[-- Attachment #3: compile.el.diff --]
[-- Type: application/octet-stream, Size: 4308 bytes --]

--- compile.el.CVS	2002-11-16 12:59:25.000000000 +0100
+++ compile.el	2002-11-16 22:30:56.000000000 +0100
@@ -283,7 +283,7 @@
     ;; but they are valid now; so I made it more strict about the error
     ;; message that follows.
     ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \
-: \\(error\\|warning\\) C[0-9]+:" 1 3)
+: \\(error\\|warning\\) C[0-9]+:" 1 3 nil 4)
 
     ;; Borland C++, C++Builder:
     ;;  Error ping.c 15: Unable to open include file 'sys/types.h'
@@ -292,7 +292,7 @@
     ;;  Warning W1022 ping.c 68: Call to function 'func' with no prototype
     ("\\(Error\\|Warning\\) \\(\\([FEW][0-9]+\\) \\)?\
 \\([a-zA-Z]?:?[^:( \t\n]+\\)\
- \\([0-9]+\\)\\([) \t]\\|:[^0-9\n]\\)" 4 5)
+ \\([0-9]+\\)\\([) \t]\\|:[^0-9\n]\\)" 4 5 nil 1)
 
     ;; Valgrind (memory debugger for x86 GNU/Linux):
     ;;  ==1332==    at 0x8008621: main (vtest.c:180)
@@ -357,7 +357,7 @@
     ;;	ccom: Error: foo.c, line 2: syntax error
     ;; DEC AXP OSF/1 cc
     ;;  /usr/lib/cmplrs/cc/cfe: Error: foo.c: 1: blah blah
-    ("[a-z0-9/]+: \\([eE]rror\\|[wW]arning\\): \\([^,\" \n\t]+\\)[,:] \\(line \\)?\\([0-9]+\\):" 2 4)
+    ("[a-z0-9/]+: \\([eE]rror\\|[wW]arning\\): \\([^,\" \n\t]+\\)[,:] \\(line \\)?\\([0-9]+\\):" 2 4 nil 1)
 
     ;; IBM AIX PS/2 C version 1.1:
     ;;	****** Error number 140 in line 8 of file errors.c ******
@@ -397,7 +397,7 @@
     ;; IAR Systems C Compiler:
     ;;  "foo.c",3  Error[32]: Error message
     ;;  "foo.c",3  Warning[32]: Error message
-    ("\"\\(.*\\)\",\\([0-9]+\\)\\s-+\\(Error\\|Warning\\)\\[[0-9]+\\]:" 1 2)
+    ("\"\\(.*\\)\",\\([0-9]+\\)\\s-+\\(Error\\|Warning\\)\\[[0-9]+\\]:" 1 2 nil 3)
 
     ;; Sun ada (VADS, Solaris):
     ;;  /home3/xdhar/rcds_rc/main.a, line 361, char 6:syntax error: "," inserted
@@ -420,8 +420,7 @@
 
     ;; SGI IRIX MipsPro 7.3 compilers:
     ;; cc-1070 cc: ERROR File = linkl.c, Line = 38
-    (".*: ERROR File = \\(.+\\), Line = \\([0-9]+\\)" 1 2)
-    (".*: WARNING File = \\(.+\\), Line = \\([0-9]+\\)" 1 2)
+    (".*: \\(ERROR\\|WARNING\\) File = \\(.+\\), Line = \\([0-9]+\\)" 2 3 nil 1)
 
     ;; Sun F90 error messages:
     ;; cf90-113 f90comp: ERROR NSE, File = Hoved.f90, Line = 16, Column = 3
@@ -595,6 +594,37 @@
 (defvar grep-history nil)
 (defvar grep-find-history nil)
 
+(defface font-lock-compile-error-face
+  '((((type tty) (class color)) (:foreground "red"))
+    (((class color) (background light)) (:foreground "Red" :weight bold))
+    (((class color) (background dark)) (:foreground "Pink" :weight bold))
+    (t (:inverse-video t :weight bold)))
+  "Font Lock mode face used to highlight compiler errors."
+  :group 'font-lock-highlighting-faces)
+
+(defface font-lock-compile-warning-face
+  '((((type tty) (class color)) (:foreground "cyan" :weight bold))
+    (((class color) (background light)) (:foreground "Purple" :weight bold))
+    (((class color) (background dark)) (:foreground "Cyan" :weight bold))
+    (t (:weight bold)))
+  "Font Lock mode face used to highlight compiler warnings."
+  :group 'font-lock-highlighting-faces)
+
+(defun compile-error-or-warning-face (idx)
+  "Choose face for whether we're highlighting an error or warning."
+  (list 'face
+	(if (> idx 0)
+	    (if (string= (downcase (match-string (1+ idx))) "error")
+		'font-lock-compile-error-face
+	      'font-lock-compile-warning-face)
+	  (save-match-data
+	    (save-excursion
+	      (beginning-of-line)
+	      (if (let ((case-fold-search t)) (looking-at ".*warning"))
+		  'font-lock-compile-warning-face
+		'font-lock-compile-error-face))))
+	'mouse-face 'highlight))
+
 (defun compilation-mode-font-lock-keywords ()
   "Return expressions to highlight in Compilation mode."
   (nconc
@@ -606,6 +636,7 @@
 	      (let ((file-idx (nth 1 item))
 		    (line-idx (nth 2 item))
 		    (col-idx (nth 3 item))
+		    (type-idx (nth 4 item))
 		    keyword)
 		(when (numberp col-idx)
 		  (setq keyword
@@ -617,8 +648,11 @@
 			      keyword)))
 		(when (numberp file-idx)
 		  (setq keyword
-			(cons (list (1+ file-idx) 'font-lock-warning-face)
-			      keyword)))
+			`((,(1+ file-idx)
+			   (compile-error-or-warning-face ,(if (numberp type-idx)
+							       type-idx
+							     0)))
+			  ,@keyword)))
 		(cons (concat "^\\(" (nth 0 item) "\\)") keyword))))
 	   compilation-error-regexp-alist)
    (list

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-11-16 21:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-16 21:12 2 fixes for compile.el Daniel Pfeiffer
  -- strict thread matches above, loose matches on Subject: below --
2002-11-16 21:51 Daniel Pfeiffer
2002-11-16 17:27 Daniel Pfeiffer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).