All pastes #796136 Raw Edit

Elisp macro tests

public text v1 · immutable
#796136 ·published 2007-11-24 20:17 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))

(defmacro make-test-lambda (arg)
  `(lambda () (my-flymake-init ,arg)))


(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 "$")
			  (make-test-lambda get-cmdline-func)
		  'flymake-simple-java-cleanup)
		flymake-allowed-file-name-masks)
  (mapc (lambda (pattern) (push pattern flymake-allowed-file-name-masks)) pattern-list))


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