Created
August 7, 2011 22:09
-
-
Save jimeh/1130849 to your computer and use it in GitHub Desktop.
FlyMakeElisp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; | |
| ;;; FlyMake Lisp | |
| ;; | |
| ;; from: http://www.emacswiki.org/emacs/FlymakeElisp | |
| ;; | |
| (defun flymake-elisp-init () | |
| (unless (string-match "^ " (buffer-name)) | |
| (let* ((temp-file (flymake-init-create-temp-buffer-copy | |
| 'flymake-create-temp-inplace)) | |
| (local-file (file-relative-name | |
| temp-file | |
| (file-name-directory buffer-file-name)))) | |
| (list | |
| (expand-file-name invocation-name invocation-directory) | |
| (list | |
| "-Q" "--batch" "--eval" | |
| (prin1-to-string | |
| (quote | |
| (dolist (file command-line-args-left) | |
| (with-temp-buffer | |
| (insert-file-contents file) | |
| (condition-case data | |
| (scan-sexps (point-min) (point-max)) | |
| (scan-error | |
| (goto-char(nth 2 data)) | |
| (princ (format "%s:%s: error: Unmatched bracket or quote\n" | |
| file (line-number-at-pos))))))) | |
| ) | |
| ) | |
| local-file))))) | |
| (push '("\\.el$" flymake-elisp-init) flymake-allowed-file-name-masks) | |
| (add-hook 'emacs-lisp-mode-hook | |
| ;; workaround for (eq buffer-file-name nil) | |
| (function (lambda () (if buffer-file-name (flymake-mode))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment