Emacs, flymake and autotest: the fix

Posted on December 10, 2007

I sure do love my autotest but I have been having problems due to how it interacts with emacs.

Emacs rails mode uses flymake to do syntax checking while you type and to do this it creates a file called buffer_name_flymake.rb in the current directory. When autotest detects this file, it starts to run it but by that time emacs has closed and deleted it already which causes autotest to crash.

The only solution I could find online was to set exceptions of the Autotest instance so that it will match the flymake file, but autotest only prunes directories and therefore this does not work.

My solution was to add one line to the find_files method in gems/ZenTest-3.6.1/lib/autotest.rb after line 292 that makes it always ignore flymake files:

289       ...
290       next if test ?d, f
291       next if f =~ /(swp|~|rej|orig)$/        # temporary/patch files
292       next if f =~ /\/\.?#/                     # Emacs autosave/cvs merge files
293       next if f =~ /_flymake\.\w+$/      # Emacs flymake files
294       ...

Download the entire patched file

I have submitted a patch with this fix so hopefully the ZenTest people will include it in the next release.
Comments
  1. sockmonkDecember 31, 2007 @ 05:44 PM
    Thanks! I applied the patch manually last night, and have been using it all morning, works like a charm. Hope the zentest people include it in the next release.
Post a comment
Comment