mawww / kakoune

mawww's experiment for a better code editor
http://kakoune.org
The Unlicense
9.97k stars 714 forks source link

X11 repl only works for some termcmds #1795

Open atpotts opened 6 years ago

atpotts commented 6 years ago

Hi,

Firstly - apologies if I have got the wrong end of the stick - I have only recently discovered Kakoune and am still getting my head around the approach to configuration.

I am currently experiminting considering using kakoune as my main editor. However, I have not had any success in launching repl windows from x11-repl.kak (calling x11-repl from an unconfigured install of kakoune from nixpkgs-unstable launches correctly with urxvt and bash, but the window title is not set, and x11-send-text fails silently).

As far is I can tell, the current version assumes it is able able to set the window title by appending '-t kak_repl_window' to the termcmd. This works correctly with termite, where this option disables dynamic title updates, but not with urxvt or xterm, which use '-T' instead, and permit the title to be ovrewritten by the repl process. (I have not tested other terminals).

I have found an approach that seems to work for my own configuration: I have modified x11-repl.kak to store the processID of the launched terminal in an option, using this to search for the correct window. This has the advantage of permitting per-buffer or per-window repls, but I haven't been able to configure it use setsid - although the terminals do nonetheless seem to survive the termination of all kakoune processes regardless.

mawww commented 6 years ago

Hello,

Using the title to find the repl terminal is quite a big limitation of x11-repl, unfortunately using the pid is not going to be much more robust, as some emulators, such as rxvt-unicode, have a daemon mode where all windows are managed by a server process, and launching a new terminal just tells that server process to create a new window (so the launched process is not tied with the actual window).

An alternative approach would be to change the actual command we launch in that terminal so that it gathers the WINDOWID env var and communicate it back so that the repl window is correctly identified.