Frage

Ich versuche flymake zu verwenden Pyflakes zu laufen, wie vorgeschlagen hier

Dies funktioniert gut für lokale Dateien und funktioniert fast mit Remote-Dateien mit einem bisschen Zwicken, aber ich bin mit einem Problem nach links, wo flymake / Pyflakes ‚modifiziert‘ der Puffer, wenn es läuft (obwohl nichts scheint tatsächlich zu ändern) , die es ein bisschen in der Praxis nutzlos macht (zB eine Datei ausgeführt flymake Speichern, die sofort den Puffer wieder modifiziert).

Hier ist, was ich tat, um fast bekommen es funktioniert:

  1. Installierte Pyflakes auf der Remote-Box.
  2. Customized meine tramp-remote-process-environment variabel, so dass Pyflakes in seinem Weg gefunden werden
  3. verwendet, um eine Variante des Codes aus dem Wiki-Link oben. Offensichtlich ausgeschlossen ich die Prüfung, die es für Remote-Puffer deaktiviert. Außerdem hat das (when (load "flymake" t) ...) Konstrukt nicht zur Arbeit erscheinen, wie ich erwartet habe, aber ich bin nicht allzu besorgt darüber.
  4. Re-Definition (für Testzwecke - Beratung sollte in Ordnung sein, wenn diese an der Arbeit gemacht werden können), um die flymake-start-syntax-check-process Funktion, so dass es verwendet start-file-process (die mit tramp arbeitet) statt start-process (was nicht)

Die Änderung in # 4 scheint keine Probleme zu verursachen, wenn eine lokale Datei Verarbeitung, aber obwohl dies ermöglicht nun flymake das Remote-Pyflakes für die Remote-Dateien ausgeführt wird (Fehler hervorgehoben werden wie erwartet), in diesem Fall ist der Puffer 'geändert', wenn flymake läuft.

Ich vermute, dass start-file-process, für Remote-Prozesse, Ergebnisse in einigem zusätzlichen Rückgabewert / Daten, die nicht für lokale Prozesse auftreten.

Hat jemand irgendwelche Erkenntnisse / Rat?

  • Emacs 23.1 und 23.2 auf Ubuntu
  • Python 2.4.6
  • Pyflakes 0.4.0 (via easy_install)
War es hilfreich?

Lösung

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.

Andere Tipps

I have this fixed in my fork of Flymake (https://github.com/illusori/emacs-flymake).

It will either run the syntax check on the remote machine via Tramp, without the buffer-modification issue you're seeing; or you can set flymake-run-in-place to nil and it will run the syntax check on the local machine, just like flymake on a regular non-Tramp buffer.

Since it's fixed at the Flymake level, this fix works for all languages and syntax checks rather than just pyflakes.

If you're interested in details of why it's happening, basically when the Tramp handler for start-file-process kicks in, it dumps the login message for the connection onto the end of the current buffer before any output filter can be attached to the process.

Usually this manifests as people seeing the contents of /etc/issue appear at the end of their file along with "You have mail." and so on.

In your case it may be that the login message is empty or just a new-line, so you're not seeing any text being added, even though it's setting the buffer as being modified.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top