C-c propagation kills the fifos
Opened this issue · 2 comments
Hello, first, very awesome plugin, I love it, I was using it the other day and I noticed that doing C-c removes the temp fifos, breaking communications, I am usually running some make commands that I cancel with C-c so they somehow become mutually exlucisve in some cases, the thing is, is there a way to re-stablish the connection? will the state set on global be lost? I understand this is somehow a kakoune thing in itself, and I also suffer it in my gpt plugin.
mmm, just saw that if I set decl -hidden bool pk_running false
to false again after doing C-c, I can use pykak again, but sadly I loss the global state..., I can work it out persisting some things to a file, don't know if it makes sense to implement some resiliency on pykak side or if is a thing that should be better handled by kakoune.
Hi, I just forked your project to test some ideas to improve resiliency, as right now, there is not much of a way for a plugin to recover in case someone presses C-c: https://github.com/eko234/pykak
there is an example of a simple plugin that keeps working after C-c:
decl str ocurstate
def ocur -override %{ py %{
import json
sels = sorted(valq('selections'))
for sel in sels:
if sel in counts:
counts[sel] += 1
else:
counts[sel] = 1
k('set global ocurstate ' + quote(json.dumps(counts)))
}}
def showocur -override %{ py %{
import json
keval('echo '+ quote(json.dumps(counts)))
}}
def initocurpy %{
py %{
global counts, signaling
counts = {}
signaling = False
}
}
def loadocurstate %{
py %{
import json
global counts
state = opt('ocurstate')
if state is None or state == '':
counts = {}
else:
counts = json.loads(state)
}
}
hook global User pk_recover %{
initocurpy
loadocurstate
}