changeset 57847:4bac9c04ed9e

2004-11-2 Pavel Kobiakov <pk_at_work@yahoo.com> * progmodes/flymake.el (flymake-err-line-patterns): Use `flymake-reformat-err-line-patterns-from-compile-el' to convert `compilation-error-regexp-alist-alist' to internal Flymake format. * progmodes/flymake.el: eliminated byte-compiler warnings.
author Masatake YAMATO <jet@gyve.org>
date Mon, 01 Nov 2004 17:42:31 +0000
parents 9c46b040f3d5
children 28443b8e3b48
files lisp/ChangeLog lisp/progmodes/flymake.el
diffstat 2 files changed, 46 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Nov 01 15:02:09 2004 +0000
+++ b/lisp/ChangeLog	Mon Nov 01 17:42:31 2004 +0000
@@ -1,3 +1,11 @@
+2004-11-2  Pavel Kobiakov <pk_at_work@yahoo.com>
+	
+	* progmodes/flymake.el (flymake-err-line-patterns): Use 
+	`flymake-reformat-err-line-patterns-from-compile-el' to convert
+	`compilation-error-regexp-alist-alist' to internal Flymake format.
+	
+	* progmodes/flymake.el: eliminated byte-compiler warnings.
+
 2004-11-01  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* mouse.el (mouse-yank-at-click, mouse-yank-secondary):
--- a/lisp/progmodes/flymake.el	Mon Nov 01 15:02:09 2004 +0000
+++ b/lisp/progmodes/flymake.el	Mon Nov 01 17:42:31 2004 +0000
@@ -56,7 +56,7 @@
 (defun flymake-makehash(&optional test)
     (cond
 	((equal flymake-emacs 'xemacs)  (if test (make-hash-table :test test) (make-hash-table)))
-	(t                              (makehash test))
+	(t                              (makehash test))	
     )
 )
 
@@ -370,8 +370,8 @@
     (let* ((init-f  (nth 0 (flymake-get-file-name-mode-and-masks file-name))))
 	;(flymake-log 0 "calling %s" init-f)
 	;(funcall init-f (current-buffer))
+	  init-f
     )
-    (nth 0 (flymake-get-file-name-mode-and-masks file-name))
 )
 
 (defun flymake-get-cleanup-function(file-name)
@@ -846,7 +846,7 @@
 			 (set-buffer source-buffer)
 
 			 (flymake-parse-residual source-buffer)
-			 (flymake-post-syntax-check source-buffer)
+			 (flymake-post-syntax-check source-buffer exit-status command)
 			 (flymake-set-buffer-is-running source-buffer nil)
 		   )
 		)
@@ -863,7 +863,7 @@
    )
 )
 
-(defun flymake-post-syntax-check(source-buffer)
+(defun flymake-post-syntax-check(source-buffer exit-status command)
     ""
    (flymake-set-buffer-err-info source-buffer (flymake-get-buffer-new-err-info source-buffer))
    (flymake-set-buffer-new-err-info source-buffer nil)
@@ -1220,7 +1220,33 @@
     )
 )
 
-(eval-when-compile (require 'compile))
+(defun flymake-reformat-err-line-patterns-from-compile-el(original-list)
+    "grab error line patterns from original list in compile.el format, convert to flymake internal format"
+	(let* ((converted-list '()))
+	(mapcar
+	    (lambda (item)
+			(setq item (cdr item))
+			(let ((regexp (nth 0 item))
+				  (file (nth 1 item))
+				  (line (nth 2 item))
+				  (col (nth 3 item))
+				  end-line)
+			  (if (consp file)	(setq file (car file)))
+			  (if (consp line)	(setq end-line (cdr line) line (car line)))
+			  (if (consp col)	(setq col (car col)))
+
+			  (when (not (functionp line))
+				  (setq converted-list (cons (list regexp file line col) converted-list))
+			  )
+		   )
+		)
+		original-list
+	)
+	converted-list
+   )
+)
+
+(require 'compile)
 (defvar flymake-err-line-patterns  ; regexp file-idx line-idx col-idx (optional) text-idx(optional), match-end to end of string is error text
     (append
      '(
@@ -1243,9 +1269,9 @@
 	   (" *\\(\\[javac\\]\\)? *\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[ \t\n]*\\(.+\\)"
 	2 4 nil 5)
       )
-     ;; compilation-error-regexp-alist)
-     (mapcar (lambda (x) (cdr x)) compilation-error-regexp-alist-alist)) 
-    "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx)"
+	 ;; compilation-error-regexp-alist)
+     (flymake-reformat-err-line-patterns-from-compile-el compilation-error-regexp-alist-alist)) 
+    "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx). Use flymake-reformat-err-line-patterns-from-compile-el to add patterns from compile.el"
 )
 ;(defcustom flymake-err-line-patterns
 ;  '(
@@ -1452,7 +1478,7 @@
 	    (let* ((dir (nth idx include-dirs)))
 		(setq full-file-name  (concat dir "/" rel-file-name))
 		(when (file-exists-p full-file-name)
-		    (setq done t)
+		    (setq found t)
 		)
 	    )
 	    (setq idx (1+ idx))
@@ -1574,7 +1600,7 @@
 		process
 	    )
 	    (error
-		(let ((err-str (format "Failed to launch syntax check process '%s' with args %s: %s"
+		(let* ((err-str (format "Failed to launch syntax check process '%s' with args %s: %s"
 			     cmd args (error-message-string err)))
 		      (source-file-name (buffer-file-name buffer))
 		      (cleanup-f        (flymake-get-cleanup-function source-file-name)))
@@ -1905,7 +1931,8 @@
 (defun flymake-mode(&optional arg)
     "toggle flymake-mode"
     (interactive)
-    (let ((old-flymake-mode flymake-mode))
+    (let ((old-flymake-mode flymake-mode)
+		  (turn-on nil))
 
 	(setq turn-on
 	    (if (null arg)