本文介绍了在emacs中用flymake和tramp远程运行pyflakes?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用flymake运行pyflakes,建议



这适用于本地文件,几乎可以与远程文件一起进行调整,但是我有一个问题,其中flymake / pyflakes'修改缓冲区运行时(尽管没有什么实际上似乎改变了),这使得它在实践中有点无用(例如保存一个文件运行flymake,它会立即修改缓冲区)。



/ p>


  1. 在遥控器上安装了pyflakes。

  2. 定制我的 tramp-remote-process-environment 变量,以便在其PATH中找到pyflakes

  3. 使用变体的代码从上面的wiki链接。显然,我排除了禁用远程缓冲区的检查。此外,(when(加载flymaket)...)构造似乎没有像我预期的那样工作,但我不太在意。

  4. 重新定义(出于测试目的 - 如果可以使用,建议应该是正常的) flymake-start-syntax-check-process code>函数,以便它使用 start-file-process (使用流行语)而不是 start-process (不是)。

#4中的更改在处理本地文件时似乎不会引起任何问题,但是虽然这样做可以使flymake运行远程文件的远程pyflakes(错误按预期方式突出显示),但是在这种情况下,每当flymake运行时,缓冲区都会被修改。



我猜,对于远程进程来说,$ code> start-file-process 会导致本地进程不会发生一些额外的返回值/数据。



有没有人有任何见解/建议?




  • Emacs ubuntu上的23.1和23.2

  • Python 2.4.6

  • Pyflakes 0.4.0(通过easy_install)


解决方案

您需要告诉flymake 本地,我更喜欢使用 $ TMP 目录,因为这个允许我在目录中的文件上使用tramp,我没有写入权限。 / p>

您可能想要检查我的叉子,因为这样做。


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)

解决方案

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.

这篇关于在emacs中用flymake和tramp远程运行pyflakes?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-12 00:47