Not working with emacs daemon
Hi,
Thanks for this great package. It works so far for me in emacs GUI and emacs -nw.
However, it doesn't work when used with emacs daemon and emacsclient -t.
When I run (kkp-status), it simply returns KKP supported in this terminal. KKP not active in this terminal.
Is there a way to make it work with emacs daemon?
I see a commit was added but in the meantime this worked in a pinch:
(use-package kkp
:ensure t
:config
(add-hook 'server-after-make-frame-hook
(lambda ()
(kkp-enable-in-terminal)))
(global-kkp-mode +1))
Hi @DCsunset could you verify the patch in branch fix-issue-17-daemon-mode fixes your problem? I never had the problem with emacsclient so I wasn't able to reproduce your problem, but judging from the other command hooking into server-after-make-frame might be the correct solution.
I regret to announce that I don't think my code snippet actually works. It seems to work when a new frame is created in addition to a running one (I tested it by creating a new tab in kitty), but not when, e.g., an ssh connection breaks and I have to reconnect. I'm not sure what the functional difference between these things is, though, or why it's not working.
Hi @benotn, unfortunately it still doesn't work for me. kkp-status still shows the same message. I even tried running (kkp-enable-for-client-frame (selected-frame)) directly but it kkp-status still shows the same message.
Besides, there's a bug in the hook. If I run emacsclient -t the second time, the client crashes immediately because it calls kkp-enable-for-client-frame with 0 argument.
I see a commit was added but in the meantime this worked in a pinch:
(use-package kkp :ensure t :config (add-hook 'server-after-make-frame-hook (lambda () (kkp-enable-in-terminal))) (global-kkp-mode +1))
I tried your config and it doesn't work for me even I run emacscilent for the first time (I assume that should create a new frame)
@DCsunset could you maybe describe your setup so I can reproduce the bug? which terminal application and version, and the steps to start the emacs-daemon and the emacs client, even if they might be very simple and straightforward.
Sure. The setup is relatively simple:
- Terminal: Ghostty 1.1.3
- Start the daemon:
emacs --daemon=test(testis the name of the socket to prevent conflict with other daemons) - Run the client:
emacsclient -t -s test