danr / kakoune-easymotion

kakoune plugin for navigating like the easymotion vim mode
The Unlicense
53 stars 13 forks source link

Kakoune hangs on easymotion when `python` is aliased to `python2` #10

Open Crote opened 6 years ago

Crote commented 6 years ago

When trying to use easymotion, it causes kakoune to hang, making it unresponsible to any user input and requiring a sigterm. As it turns out, easymotion tries to run the created script by calling python, which on Fedora 27 (and probably quite a few other systems) defaults to Python 2.7. This fails due to a syntax error.

According to PEP 394, this is the correct version to execute. Could the python executable used be changed to python3 to solve this, or would this create issues for other systems, thus requiring some kind of version checking?

danr commented 6 years ago

Ok, try now!

Sorry that you had to SIGTERM, I changed that, now Ctrl+C will get you back to kakoune in case of such a bug.

Crote commented 6 years ago

Looks good to me!

ejmr commented 6 years ago

The plugin still hangs for me. I am guessing the problem for @Crote is that in the line...

(python $file) > /dev/null 2>&1  </dev/null &

...the invocation of python was using Python 2 and not Python 3. On my system, by default python also points to Python 2.7. However, even if I manually change the line above to explicitly invoke Python 3, i.e. python3 or even more specifically python3.6, the plugin still hangs and I have to SIGTERM the entire thing.

I have tried fixing this myself but the Kak script using /bin/sh code to piece together Python code is just... Whatever, I don't want to be rude; I am just frustrated that I can no longer use what I considered an very useful plugin, and that this plugin lacks a single comment explaining its mechanics compounds that frustration immensely. So please let me know if I could provide any additional info to make this workable again.

For what it's worth, I used git-bisect to figure out that c726103765037b08e35df5b69413c0b02fc03304 is the last commit for which the plugin works as intended (although for that commit I do have to first change the face EasyMotion... declarations to face global EasyMotion...).

ejmr commented 6 years ago

@danr

Is there anything you can recommend to help me debug this? I would be more than happy to write the necessary patch(es), but I do not understand why the plugin continues to hang on my system. Please let me know if there is any additional info I can provide that would be useful. And of course anything info you have that would nudge me in the direction of a fix would be greatly appreciated. I really would like to be using this plugin again, heh.

danr commented 6 years ago

Hi,

Two fifos are opened and a python process is started listening to $pyfifo. It is communicated with the tee here:

https://github.com/danr/kakoune-easymotion/blob/master/easymotion.kak#L24

Kakoune now waits for a reply on another fifo here using cat:

https://github.com/danr/kakoune-easymotion/blob/master/easymotion.kak#L24

The python process runs the function which returns a string of kakoune commands which is written to this $kakfifo here:

https://github.com/danr/kakoune-easymotion/blob/master/easymotion.kak#L16

You can try disabling these to debug and you can also run set buffer debug shell|commands to get some output in the *debug* buffer (although it won't be of much help if the kakoune process hangs.)

ejmr commented 6 years ago

@danr Thank you for the information. I am working on a series of patches to submit for fixing the issue.

ejmr commented 6 years ago

@danr Out of curiosity, which version of Kakoune are you using? I've had to make a couple of changes simple to address incompatibility bugs created by how Kakoune has changed between now and when this plugin was written.

danr commented 6 years ago

I'm apparently 229 commits behind: https://github.com/danr/kakoune

ejmr commented 6 years ago

Thank you. That could prove to be useful for debugging.