All pastes #795475 Raw Edit

Something

public text v1 · immutable
#795475 ·published 2007-11-24 04:10 UTC
rendered paste body
(require 'flymake)

;;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 (list (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))


;;;;;;;
;specialised

(defun flymake-get-php-cmdline (source base-dir)
  (list "php"
		(list (concat sys-emacs-share-directory "helpers/flymake-php.php") source base-dir)))

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