Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running pyflakes remotely with flymake and tramp in emacs?

I'm trying to use flymake to run pyflakes, as suggested here

This works fine for local files, and almost works with remote files with a bit of tweaking, but I'm left with a problem where flymake/pyflakes 'modifies' the buffer when it runs (although nothing actually seems to change), which renders it a bit useless in practice (e.g. saving a file runs flymake which immediately modifies the buffer again).

Here's what I did to almost get it working:

  1. Installed pyflakes on the remote box.
  2. Customized my tramp-remote-process-environment variable so that pyflakes could be found in its PATH
  3. Used a variant of the code from the wiki link above. Obviously I excluded the check that disables it for remote buffers. Also, the (when (load "flymake" t) ...) construct didn't seem to work as I expected, but I'm not too worried about that.
  4. Re-defined (for test purposes -- advice should be fine if this can be made to work) the flymake-start-syntax-check-process function so that it uses start-file-process (which works with tramp) instead of start-process (which does not).

The change in #4 does not appear to cause any issues when processing a local file, but although this now enables flymake to run the remote pyflakes for the remote files (errors are highlighted as expected), in this instance the buffer is 'modified' whenever flymake runs.

I'm guessing that start-file-process, for remote processes, results in some additional return value/data that does not occur for local processes.

Does anyone have any insight/advice?

  • Emacs 23.1 and 23.2 on Ubuntu
  • Python 2.4.6
  • Pyflakes 0.4.0 (via easy_install)
like image 531
phils Avatar asked Jun 30 '10 00:06

phils


1 Answers

You need to tell flymake to create it's copy of the buffer somewhere locally, I prefer using the $TMP directory since this also allows me to use tramp on files in directories I don't have write permissions to.

You may want to checkout my fork of flymake-python since it does all this.

like image 114
Ross Patterson Avatar answered Sep 23 '22 02:09

Ross Patterson