[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs and screen

From: Peter Keller
Subject: Re: emacs and screen
Date: Thu, 7 Apr 2011 19:55:01 +0000 (UTC)
User-agent: tin/1.9.5-20091224 ("Lochruan") (UNIX) (Linux/2.6.32-30-generic (i686))

Richard Riley <address@hidden> wrote:
> Peter Keller <address@hidden> writes:
>> Hello,
>> Using emacs 22.3.1 with screen version 4.00.03jw4 (FAU) 2-May-06 on a
>> debian squeeze box, I have run into a problem.
>> When running emacs -nw, not in a screen session, C-x C-<left/right>
>> rotates me between buffers. When running in screen, only C-x
>> <left/right> will rotate me between buffers. Having to lift up on the
>> control key to use the arrows is *very* annoying when rapidly moving
>> between buffers.
>> How can I fix this problem so under screen the C-x C-<left/right>
>> key combination works again? I have looked into both manuals, but
>> emacs should see the right key use, and screen doesn't make mention
>> that it messes about with C-x (well, without the escape sequence
>> being infront if it at any rate.)
>> Thank you.
> When going through a "minimalist" phase a year ago, I too used emacs -nw
> in screen and/or tmux.

I'm not so much in a minimalist phase as someone I hack with likes
to pair program over an emacs -nw session in a screen on a machine
to which are are both ssh'd.

> It's all down to termcaps and TERM setting and how emacs uses them.

So, the quick and dirty problem (after debugging for a while) is that
screen, by default sets the TERM env var in shells inside of screen to
"screen". Emacs gets upset at this.

If you start screen like 'screen -T xterm', then the TERM variable
for all shells created in the screen is 'xterm' and emacs functions
properly with respect to C-x C-<left/right>. This makes me very happy.

I tried setting 'term xterm' in the .screenrc, but it didn't seem to
work, so a bash alias of "alias screen='screen -T xterm'" is sufficient
for me.

> I can only say : impossibly complicated and oodles of hackish
> workarounds exists that require a lifetime of study to even begin to
> understand.

Yeah, having lived in unix all my life, that is shockingly true.
Unix terminals are like the field of Chemistry. All full of exceptions,
but that's the way the world is. You just memorize it.

> I went back to emacs on X and haven't looked back ;)

I use emacs on X in most or all other contexts. Sometimes an emacs
-nw is pretty useful though...

> On a more serious note, I sometimes uses emacs -nw still over ssh in a
> screen but frequently key combos fail - most noticeably any Fn keys and
> arrow keys,

Maybe my solution will help you, a lot of other stuff just started
working once I told screen what term it should provide to the shells
started in it.

Thank all of you for the help in this thread. My problem is now solved.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]