Subject: bug#16928: 24.3.50; file _flymake not deleted on remote hosts

From: Michael Albinus <[email-masked]>
Date: Tue, 04 Mar 2014 14:14:14 +0100

Leo Liu <[email-masked]> writes:

> 1. emacs -q
> 2. (add-hook 'find-file-hook 'flymake-find-file-hook)
> 3. make sure the php executable is available
> 4. save https://github.com/drupal/drupal/raw/7.x/update.php in a remote
>    host
> 5. open it in emacs
>
> And I see update_flymake.php not being deleted (cleaned up). So it seems
> at the time flymake-simple-cleanup was called, (file-exists-p
> "/host:/path/to/update_flymake.php") returned false.

Yes, I could reproduce it. The problem is, that flymake starts an
asynchronous process. It's sentinel calls then flymake-simple-cleanup,
which fires file-exists-p to an unpredictable time.

After serving flymake-find-file-hook, find-file has continued with the
other functions in find-file-hook. When the file-exists-p call from the
sentinel happened, Tramp was busy with requests from
vc-find-file-hook. And since Tramp is designed to work sequentially, it
couldn't serve promptly :-(

As temporary workaround, you could try

(add-hook 'find-file-hook 'flymake-find-file-hook 'append)

I will check, whether Tramp could be enabled to handle such asynchronous
calls. 

> Leo

Best regards, Michael.