From: Lars Magne Ingebrigtsen Date: Sat, 2 Jul 2011 22:55:41 +0000 (+0200) Subject: * progmodes/flymake.el (flymake-mode): If the buffer isn't X-Git-Tag: emacs-pretest-24.0.90~104^2~152^2~228 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=83319045a48fbe15d9223056435c72ee5172bc2b;p=emacs.git * progmodes/flymake.el (flymake-mode): If the buffer isn't associated with a file, refuse to run instead of erroring out (bug#6084). --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ed3ae3623c8..2955592d43b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2011-07-02 Lars Magne Ingebrigtsen + * progmodes/flymake.el (flymake-mode): If the buffer isn't + associated with a file, refuse to run instead of erroring out + (bug#6084). + * textmodes/fill.el (fill-region): Remove the "Ordinarily" from the doc string, since it appears that using `fill-column' always controls the width (bug#7845). diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 249c2b57b71..1c138f053d3 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1339,8 +1339,12 @@ With arg, turn Flymake mode on if and only if arg is positive." ;; Turning the mode ON. (flymake-mode - (if (not (flymake-can-syntax-check-file buffer-file-name)) - (flymake-log 2 "flymake cannot check syntax in buffer %s" (buffer-name)) + (cond + ((not buffer-file-name) + (message "Flymake unable to run without a buffer file name")) + ((not (flymake-can-syntax-check-file buffer-file-name)) + (flymake-log 2 "flymake cannot check syntax in buffer %s" (buffer-name))) + (t (add-hook 'after-change-functions 'flymake-after-change-function nil t) (add-hook 'after-save-hook 'flymake-after-save-hook nil t) (add-hook 'kill-buffer-hook 'flymake-kill-buffer-hook nil t) @@ -1352,7 +1356,7 @@ With arg, turn Flymake mode on if and only if arg is positive." (run-at-time nil 1 'flymake-on-timer-event (current-buffer))) (when flymake-start-syntax-check-on-find-file - (flymake-start-syntax-check)))) + (flymake-start-syntax-check))))) ;; Turning the mode OFF. (t