2011-07-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
+ * 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).
;; 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)
(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