I keep many screen session running in the backgroud, which I access with
M-x eshell-command "screen -r <myscreen>". Before I kill the
*screen* buffer, I have to detach the session with
C-a d. It would be nice to have that integrated into
kill-buffer-hook, but I don't know how because the
*screen* buffer is read-only, so
insert doesn't work.
My non-working idea is:
(add-hook `term-mode-hook (add-hook 'kill-buffer-hook (insert (kbd "C-a d"))))
What's the proper elisp command to send control-sequence inputs to a terminal via a hook?