changeset 103841:bb5ce7283e84

(compilation-mode-font-lock-keywords): Omake sometimes indents the errors it prints, so allow all regexps to start with spaces.
author Sam Steingold <sds@gnu.org>
date Fri, 10 Jul 2009 18:23:49 +0000
parents a9bb4a9d0ebd
children df7083898baf
files lisp/ChangeLog lisp/progmodes/compile.el
diffstat 2 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Jul 10 17:07:36 2009 +0000
+++ b/lisp/ChangeLog	Fri Jul 10 18:23:49 2009 +0000
@@ -1,3 +1,9 @@
+2009-07-10  Sam Steingold  <sds@gnu.org>
+
+	* progmodes/compile.el (compilation-mode-font-lock-keywords):
+	Omake sometimes indents the errors it prints, so allow all
+	regexps to start with spaces.
+
 2009-07-10  Eli Zaretskii  <eliz@gnu.org>
 
 	* cus-edit.el (customize-changed-options-previous-release): Bump
--- a/lisp/progmodes/compile.el	Fri Jul 10 17:07:36 2009 +0000
+++ b/lisp/progmodes/compile.el	Fri Jul 10 18:23:49 2009 +0000
@@ -975,7 +975,17 @@
 	      (line (nth 2 item))
 	      (col (nth 3 item))
 	      (type (nth 4 item))
+              (pat (car item))
 	      end-line end-col fmt)
+          ;; omake reports some error indented, so skip the indentation.
+          ;; another solution is to modify (some?) regexps in
+          ;; `compilation-error-regexp-alist'.
+          ;; note that omake usage is not limited to ocaml and C (for stubs).
+          (unless (string-match (concat "^" (regexp-quote "^ *")) pat)
+            (setq pat (concat "^ *"
+                              (if (= ?^ (aref pat 0))
+                                  (substring pat 1)
+                                  pat))))
 	  (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)))
@@ -984,7 +994,7 @@
 	      ;; 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)
+	      `(,pat
 		(0 (save-match-data
 		     (compilation-compat-error-properties
 		      (funcall ',line (cons (match-string ,file)
@@ -996,7 +1006,7 @@
 	    (unless (or (null (nth 5 item)) (integerp (nth 5 item)))
 	      (error "HYPERLINK should be an integer: %s" (nth 5 item)))
 
-	    `(,(nth 0 item)
+	    `(,pat
 
 	      ,@(when (integerp file)
 		  `((,file ,(if (consp type)