spudlyo / clipetty

Manipulate the system (clip)board with (e)macs from a (tty)
GNU General Public License v3.0
167 stars 13 forks source link

[BUG] GNU screen not detected properly #13

Closed codemac closed 4 years ago

codemac commented 4 years ago

Describe the bug Currently, when (getenv "TERM") is called in clipetty.el, it will only ever return "dumb" due to how emacs is implemented.

To Reproduce Run emacs -nw, call (getenv "TERM"), see the word dumb. This means clipetty does not correctly detect gnu screen, and does not emit the wrapped string correctly.

Expected behavior Detect screen correctly.

System Info (please complete the following information):

Additional context I'm not sure the best place to put it, but you should be using:

(getenv-internal "TERM" initial-environment)

To detect if you're running under screen.

spudlyo commented 4 years ago

Hi there,

I'm a bit confused by this bug, because Clipetty doesn't call (getenv "TERM") but rather (getenv "TERM" (selected-frame)) which does indeed return the correct environment variable for me under 26.3. Does that return dumb for you?

In the short term, until we figure this out, there is a variable you can customize called clipetty-screen-regexp which by default is set to ^screen, but you can set it to whatever works for you as a workaround.

spudlyo commented 4 years ago

Haven't heard back from @codemac, I assume this is resolved.

joeforan76 commented 3 years ago

@spudlyo I'm also having this problem.

My environment

Terminal program: iterm2
Emacs version: 27.1
Host OS: centos 7.7.1908 (via ssh). However emacs itself is running inside a ubuntu 20:04 docker container.

Calling (getenv "TERM" (selected-frame)) inside emacs gives "dumb" However if I call as @codemac suggested (getenv-internal "TERM" initial-environment) I get "screen-256color"

I tried setting clipetty-screen-regexp to ^dumb just to see if that would help but unfortunately I still cannot copy to the clipboard. I normally run emacs inside tmux. I tried running it outside tmux to see if that was the issue but that also didn't make a difference.

joeforan76 commented 3 years ago

Calling (getenv "TERM" (selected-frame)) inside emacs gives "dumb"

This doesn't seem to be the problem after all, rather it appears to be docker. I tried my setup on another server to which I have sudo access and can therefore install emacs without running it inside docker. Executing the above still gives "dumb" but clipetty works as expected, I am able to copy from emacs to my local clipboard.