All pastes #795450 Raw Edit

Miscellany

public text v1 · immutable
#795450 ·published 2007-11-24 03:31 UTC
rendered paste body
;;easy default mode loading
(defun my-flymake-init (get-cmdline-func)
  "Call a simple compile on a single file in a temp directory"
  (flymake-simple-make-init-impl
   'flymake-create-temp-with-folder-structure nil nil
   (file-name-nondirectory buffer-file-name)
   get-cmdline-func))

(defun my-flymake-add-file-type (file-extension get-cmdline-func pattern-list)
  "add a file type with a corresponding flymake function to flymake" 
  (push '((concat ".+\\." file-extension "$")
        (lambda () "my-flymake-init closure" (my-flymake-init get-cmdline-func))
        flymake-simple-java-cleanup)
	  flymake-allowed-file-name-masks)
   (mapc (lambda (pattern) (push pattern flymake-allowed-file-name-masks)) pattern-list))

(my-flymake-add-file-type "php" 'flymake-get-php-cmdline 
                          '(("^\\(.*\\):\\([0-9]+\\):\\(.*\\)$" 1 2 2 3)))


;; instead of 


(defun flymake-php-init ()
(flymake-simple-make-init-impl
   'flymake-create-temp-with-folder-structure nil nil
   (file-name-nondirectory buffer-file-name)
   'flymake-get-php-cmdline))
(defun flymake-get-php-cmdline (source base-dir)
  (list "php"
		(list "-f" (concat sys-emacs-share-directory "helpers/flymake-php.php") source base-dir)))
    
(push '(".+\\.php$" flymake-php-init flymake-simple-java-cleanup)
	  flymake-allowed-file-name-masks)
(push
 '("^\\(.*\\):\\([0-9]+\\):\\(.*\\)$"
   1 2 2 3) flymake-err-line-patterns)