Open jokem59 opened 7 months ago
I had the same issue. Walking through the code, my issue turned out to be due to TMUX
, TERM
, and SSH_TTY
env vars returning as nil
from the call to (getenv "<ENVVAR>" (selected-frame))
. Dropping the (selected-frame)
bit makes things work again:
diff --git a/clipetty.el b/clipetty.el
index cb24eec..fc609a3 100644
--- a/clipetty.el
+++ b/clipetty.el
@@ -137,9 +137,9 @@ Optionally base64 encode it first if you specify non-nil for ENCODE."
(defun clipetty--emit (string)
"Emit STRING, optionally wrapped in a DCS, to an appropriate tty."
- (let ((tmux (getenv "TMUX" (selected-frame)))
- (term (getenv "TERM" (selected-frame)))
- (ssh-tty (getenv "SSH_TTY" (selected-frame))))
+ (let ((tmux (getenv "TMUX"))
+ (term (getenv "TERM"))
+ (ssh-tty (getenv "SSH_TTY")))
(if (<= (length string) clipetty--max-cut)
(write-region
(clipetty--dcs-wrap string tmux term ssh-tty)
I don't think this is a general solution that can be submitted as a PR since respecting the environment of each frame seems reasonable. But it is at least a temporary workaround. I'm not sure why that getenv
is failing when targeting a specific frame. And I'm not sure why it works outside of tmux.
I could not get it to work in a tmux session. I ssh into my ubuntu machine from my mac, start tmux session and run emacs (spacemacs). (getenv "TMUX" (selected-frame) returns me a valid value - /tmp/tmux-361936330/default,49641,0.
It works outside of tmux
tmux version - 3.4 spacemacs version - 0.999.0@29.3 iterm2 mac terminal
Describe the bug When I SSH onto my Amazon Linux instance. If I open terminal emacs WITHOUT a tmux session,
clipetty-kill-ring-save
works as intended and sends the region to my system clipboard.From that same SSH session, if I launch tmux and open terminal emacs,
clipetty-kill-ring-save
does not send anything to the system clipboard. I don't see anything in the*Messages*
buffer that indicates any error.toggle-debug-on-error
also doesn't trip anything.This was working prior and I'm unsure what changed (no changes to tmux/emacs configs recently).
To Reproduce From Ubuntu 20.04 ssh to an Amazon Linux 2 instance. Launch tmux from this ssh session and launch emacs. Attempt
clipetty-kill-ring-save
and observe the contents are not present in the system clipboard.Expected behavior I expect the region
clipetty-kill-ring-save
is called on to be available on the system clipboard.System Info (please complete the following information):
Additional context N/A