added hook to prevent flymake from crashing if it has not write permission

This commit is contained in:
syl20bnr 2013-01-15 09:27:45 -05:00
parent 1bb4512ac9
commit 297793404c

View file

@ -39,3 +39,15 @@ The CMDLINE should be something like:
(flymake-mode))))
)
)
;; from http://www.emacswiki.org/emacs/FlyMake
(defun safer-flymake-find-file-hook ()
"Don't barf if we can't open this flymake file"
(let ((flymake-filename
(flymake-create-temp-inplace (buffer-file-name) "flymake")))
(if (file-writable-p flymake-filename)
(flymake-find-file-hook)
(message
(format
"Couldn't enable flymake; permission denied on %s" flymake-filename)))))
(add-hook 'find-file-hook 'safer-flymake-find-file-hook)