all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Page Up/Down Issues With Emacs in Terminal
@ 2016-07-05 20:57 Brandeis King
  2016-07-05 21:44 ` Emanuel Berg
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Brandeis King @ 2016-07-05 20:57 UTC (permalink / raw
  To: help-gnu-emacs

Hi,

When I launch emacs in a (zsh) terminal with the no window system option, pressing the keys "page-up" and "page-down" results in emacs writing "5~" and "6~" respectively to the buffer and then changing to the previous/next buffer depending on which button is pressed. 

How can I configure emacs and/or the (zsh) terminal to scroll the page when page up/down is pressed as emacs does in a non-terminal instance? Thanks.

Best,
Brandeis


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Page Up/Down Issues With Emacs in Terminal
  2016-07-05 20:57 Page Up/Down Issues With Emacs in Terminal Brandeis King
@ 2016-07-05 21:44 ` Emanuel Berg
  2016-07-06  2:14   ` Brandeis King
  2016-07-05 21:48 ` Emanuel Berg
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Emanuel Berg @ 2016-07-05 21:44 UTC (permalink / raw
  To: help-gnu-emacs

Brandeis King <brandeis.a.king@gmail.com>
writes:

> When I launch emacs in a (zsh) terminal with
> the no window system option, pressing the
> keys "page-up" and "page-down" results in
> emacs writing "5~" and "6~" respectively to
> the buffer and then changing to the
> previous/next buffer depending on which
> button is pressed.
>
> How can I configure emacs and/or the (zsh)
> terminal to scroll the page when page up/down
> is pressed as emacs does in a non-terminal
> instance? Thanks.

This sounds like an issue with your terminal
emulator rather than the "command interpreter"
which is zsh - so are you using xterm, urxvt,
something like that?

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 56 Blogomatic articles -                   


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Page Up/Down Issues With Emacs in Terminal
  2016-07-05 20:57 Page Up/Down Issues With Emacs in Terminal Brandeis King
  2016-07-05 21:44 ` Emanuel Berg
@ 2016-07-05 21:48 ` Emanuel Berg
  2016-07-05 22:23 ` Dmitry Alexandrov
       [not found] ` <mailman.627.1467757409.26859.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 14+ messages in thread
From: Emanuel Berg @ 2016-07-05 21:48 UTC (permalink / raw
  To: help-gnu-emacs

Brandeis King <brandeis.a.king@gmail.com>
writes:

> When I launch emacs in a (zsh) terminal with
> the no window system option, pressing the
> keys "page-up" and "page-down" results in
> emacs writing "5~" and "6~" respectively to
> the buffer and then changing to the
> previous/next buffer depending on which
> button is pressed.
>
> How can I configure emacs and/or the (zsh)
> terminal to scroll the page when page up/down
> is pressed as emacs does in a non-terminal
> instance? Thanks.

Look, I don't use Emacs in X, and I NEVER use
the PageUp/PageDown keys - actually I didn't
know they existed until now! Ahem...

Nonetheless, with xterm as the terminal
emulator, zsh as the command interpreter or
shell, with tmux there as well, and Emacs 24
invoked with -Q, those buttons behaved
like expected!

I mean, like I think them to expect to
behave... eh, nevermind.

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 56 Blogomatic articles -                   


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Page Up/Down Issues With Emacs in Terminal
  2016-07-05 20:57 Page Up/Down Issues With Emacs in Terminal Brandeis King
  2016-07-05 21:44 ` Emanuel Berg
  2016-07-05 21:48 ` Emanuel Berg
@ 2016-07-05 22:23 ` Dmitry Alexandrov
       [not found] ` <mailman.627.1467757409.26859.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 14+ messages in thread
From: Dmitry Alexandrov @ 2016-07-05 22:23 UTC (permalink / raw
  To: Brandeis King; +Cc: help-gnu-emacs

Brandeis King <brandeis.a.king@gmail.com> writes:

> When I launch emacs in a (zsh) terminal with the no window system
> option,

What is ‘(zsh) terminal’?  I only know that there is a free Bourne
compatible shell named ‘zsh’.  Examples of terminals are: VT-100, Linux®
Console, FreeBSD Console.

$ echo "$TERM"

> pressing the keys "page-up" and "page-down" results in emacs
> writing "5~" and "6~" respectively to the buffer and then changing to
> the previous/next buffer depending on which button is pressed.
>
> How can I configure emacs and/or the (zsh) terminal to scroll the page
> when page up/down is pressed as emacs does in a non-terminal instance?
> Thanks.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Page Up/Down Issues With Emacs in Terminal
       [not found] ` <mailman.627.1467757409.26859.help-gnu-emacs@gnu.org>
@ 2016-07-05 22:39   ` Emanuel Berg
  2016-07-05 22:56     ` Dmitry Alexandrov
       [not found]     ` <mailman.629.1467759414.26859.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 14+ messages in thread
From: Emanuel Berg @ 2016-07-05 22:39 UTC (permalink / raw
  To: help-gnu-emacs

Dmitry Alexandrov <321942@gmail.com> writes:

> What is ‘(zsh) terminal’? I only know that
> there is a free Bourne compatible shell named
> ‘zsh’. Examples of terminals are: VT-100,
> Linux® Console, FreeBSD Console.

C'mon, don't be patronizing - it is a common
and natural mix-up.

VT100: introduced in 1978 by DEC. It has been
emulated ever since tho.

The OP is not using the Linux VTs because those
keys don't even work there!

> $ echo "$TERM"

Here, TERM can be a false friend. For example,
I run tmux so it says "screen" in the Linux VTs
as well as in xterm!

It is better to just think "what program am
I using?"

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 56 Blogomatic articles -                   


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Page Up/Down Issues With Emacs in Terminal
  2016-07-05 22:39   ` Emanuel Berg
@ 2016-07-05 22:56     ` Dmitry Alexandrov
       [not found]     ` <mailman.629.1467759414.26859.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 14+ messages in thread
From: Dmitry Alexandrov @ 2016-07-05 22:56 UTC (permalink / raw
  To: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

> Dmitry Alexandrov <321942@gmail.com> writes:
>
>> What is ‘(zsh) terminal’? I only know that
>> there is a free Bourne compatible shell named
>> ‘zsh’. Examples of terminals are: VT-100,
>> Linux® Console, FreeBSD Console.
>
> C'mon, don't be patronizing - it is a common
> and natural mix-up.
>
> VT100: introduced in 1978 by DEC. It has been
> emulated ever since tho.
>
> The OP is not using the Linux VTs because those
> keys don't even work there!

They do.  Even more: they work as expected in a modern GNU Emacs that is
running on Linux® Console (I’ve just tested it on Debian GNU/Linux
Jessie).

>> $ echo "$TERM"
>
> Here, TERM can be a false friend. For example,
> I run tmux so it says "screen" in the Linux VTs
> as well as in xterm!
>
> It is better to just think "what program am
> I using?"

Why the false friend?  If OP is using some terminal multiplexer that’s
exactly what we have to know.  That is the most probable cause,
actually, since: a) I strongly guess, he is using Linux® Console;
b) PgUp / PgDn should work out of a box there.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Page Up/Down Issues With Emacs in Terminal
       [not found]     ` <mailman.629.1467759414.26859.help-gnu-emacs@gnu.org>
@ 2016-07-06  1:52       ` Emanuel Berg
  0 siblings, 0 replies; 14+ messages in thread
From: Emanuel Berg @ 2016-07-06  1:52 UTC (permalink / raw
  To: help-gnu-emacs

Dmitry Alexandrov <321942@gmail.com> writes:

> They do. Even more: they work as expected in
> a modern GNU Emacs that is running on Linux®
> Console (I’ve just tested it on Debian
> GNU/Linux Jessie).

Is the Linux "R" Console something I haven't
heard of or is it the old Linux virtual
terminals (VTs), i.e. the ttys (teletypewriters)
you get for example after

    $ sudo chvt 1 # or 2 etc.

?

Because here the keys do work in the console
(verify this with showkey(1)) but in Emacs they
don't - however one can get them as described
in this tutorial [1] to assign them Emacs
defuns - tho why anyone would want to use those
keys beats me...

> Why the false friend? If OP is using some
> terminal multiplexer that’s exactly what we
> have to know. That is the most probable
> cause, actually, since: a) I strongly guess,
> he is using Linux® Console; b) PgUp / PgDn
> should work out of a box there.

It is a false friend because it gives the same
answer in X as in the Linux VTs if tmux is used
in both places, however setting up the
terminal and in particular the keys are not
the same despite TERM being the same...

[1] http://user.it.uu.se/~embe8573/tty-emacs-keys.txt

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 56 Blogomatic articles -                   


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Page Up/Down Issues With Emacs in Terminal
  2016-07-05 21:44 ` Emanuel Berg
@ 2016-07-06  2:14   ` Brandeis King
  2016-07-06  2:59     ` Emanuel Berg
                       ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Brandeis King @ 2016-07-06  2:14 UTC (permalink / raw
  To: help-gnu-emacs

On Tuesday, July 5, 2016 at 5:44:03 PM UTC-4, Emanuel Berg wrote:
> This sounds like an issue with your terminal
> emulator rather than the "command interpreter"
> which is zsh - so are you using xterm, urxvt,
> something like that?

To clarify, I'm experiencing this issue with xterm and gnome-terminal, both with and without tmux. And yes, I'm using z-shell. 

@Emanuel: Thanks for the suggestion of using "-Q". Unfortunately, however, even with this option the original issue persists. 

@Dmitry: By '(zsh) terminal' I meant a terminal running zsh. Since the issue occurred in both xterm and gnome-terminal, I thought the root issue was independent of the terminal, and hence did not specify.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Page Up/Down Issues With Emacs in Terminal
  2016-07-06  2:14   ` Brandeis King
@ 2016-07-06  2:59     ` Emanuel Berg
  2016-07-06  7:37     ` Yuri Khan
       [not found]     ` <mailman.639.1467790653.26859.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 14+ messages in thread
From: Emanuel Berg @ 2016-07-06  2:59 UTC (permalink / raw
  To: help-gnu-emacs

Brandeis King <brandeis.a.king@gmail.com>
writes:

> @Emanuel: Thanks for the suggestion of using
> "-Q". Unfortunately, however, even with this
> option the original issue persists.

Try xev(1) and see if there are events at all!

> @Dmitry: By '(zsh) terminal' I meant
> a terminal running zsh. Since the issue
> occurred in both xterm and gnome-terminal,
> I thought the root issue was independent of
> the terminal, and hence did not specify.

It is a good idea to isolate/minimize the
problem. See if you have any keys set up at the
zsh, tmux, xterm or otherwise X level (e.g.,
xbindkeys) that might interfere.

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 56 Blogomatic articles -                   


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Page Up/Down Issues With Emacs in Terminal
  2016-07-06  2:14   ` Brandeis King
  2016-07-06  2:59     ` Emanuel Berg
@ 2016-07-06  7:37     ` Yuri Khan
       [not found]     ` <mailman.639.1467790653.26859.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 14+ messages in thread
From: Yuri Khan @ 2016-07-06  7:37 UTC (permalink / raw
  To: Brandeis King; +Cc: help-gnu-emacs@gnu.org

On Wed, Jul 6, 2016 at 8:14 AM, Brandeis King <brandeis.a.king@gmail.com> wrote:

> To clarify, I'm experiencing this issue with xterm and gnome-terminal, both with and without tmux. And yes, I'm using z-shell.

When you press Page Down in xterm or gnome-terminal, it generates four
characters: ESC [ 6 ~. Upon receiving this sequence, Emacs should
translate it back to a [next] key vector.

In order for this to happen, Emacs has to know you’re using an
xterm-compatible terminal. It does that by looking at your TERM
variable.

Your symptoms suggest that the value of the TERM environment variable
does not match your terminal type.

To debug the problem further, you need to list, for each distinct case:

* the complete stack of terminal emulators;
* what the value of TERM is at each layer of that stack.

The shell you are using is mostly irrelevant; the only thing it will
affect is whether and how you set the TERM variable.


For xterm and gnome-terminal, the expected result is:

    $ echo $TERM
    xterm

or a variation thereof (e.g. xterm-256color).

When you use tmux with xterm or gnome-terminal, TERM should be "xterm"
(or xterm-*) before you start tmux, and "screen" (or screen-*) within
tmux.

(Newer systems, e.g. Ubuntu 16.04, also support a separate "tmux" (and
tmux-*) terminal type. As far as I can tell, Emacs does not yet have
such support.)



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Page Up/Down Issues With Emacs in Terminal
       [not found]     ` <mailman.639.1467790653.26859.help-gnu-emacs@gnu.org>
@ 2016-07-06 14:28       ` Emanuel Berg
  2016-07-06 15:27         ` Yuri Khan
       [not found]         ` <mailman.670.1467818895.26859.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 14+ messages in thread
From: Emanuel Berg @ 2016-07-06 14:28 UTC (permalink / raw
  To: help-gnu-emacs

Yuri Khan <yuri.v.khan@gmail.com> writes:

> For xterm and gnome-terminal, the expected
> result is:
>
>     $ echo $TERM xterm
>
> or a variation thereof (e.g. xterm-256color).
>
> When you use tmux with xterm or gnome-terminal,
> TERM should be "xterm" (or xterm-*) before you
> start tmux, and "screen" (or screen-*)
> within tmux.

Good idea, however if the OP has broken the
buttons by having a wierd TERM, it'll sure be
interesting to know what that is because I just
now tried

    $ TERM=x emacs -Q

with x being "linux", "vt100", "xterm" and
"screen" without quotes, and equally without
being able to break the PageUp and PageDown
buttons. (The colors and fonts changed tho.)

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 56 Blogomatic articles -                   


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Page Up/Down Issues With Emacs in Terminal
  2016-07-06 14:28       ` Emanuel Berg
@ 2016-07-06 15:27         ` Yuri Khan
       [not found]         ` <mailman.670.1467818895.26859.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 14+ messages in thread
From: Yuri Khan @ 2016-07-06 15:27 UTC (permalink / raw
  To: Emanuel Berg; +Cc: help-gnu-emacs@gnu.org

On Wed, Jul 6, 2016 at 8:28 PM, Emanuel Berg <embe8573@student.uu.se> wrote:

> Good idea, however if the OP has broken the
> buttons by having a wierd TERM, it'll sure be
> interesting to know what that is because I just
> now tried
>
>     $ TERM=x emacs -Q
>
> with x being "linux", "vt100", "xterm" and
> "screen" without quotes, and equally without
> being able to break the PageUp and PageDown
> buttons. (The colors and fonts changed tho.)

Neither could I. Moreover, when I start "TERM=tmux emacs -Q -nw", the
variable input-decode-map still contains a sequence for ESC [ 5 ~. I
presumed it were added by xterm.el and that by setting a TERM which
Emacs doesn’t know about would prevent that, but it seems at least one
of those assumptions is false.

@Brandeis: Please also show us what you get when you press Ctrl+V PgUp
at the zsh prompt, and what you have in the input-decode-map variable
in emacs -Q -nw.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Page Up/Down Issues With Emacs in Terminal
       [not found]         ` <mailman.670.1467818895.26859.help-gnu-emacs@gnu.org>
@ 2016-07-06 19:40           ` Brandeis King
  2016-07-07  4:47             ` Yuri Khan
  0 siblings, 1 reply; 14+ messages in thread
From: Brandeis King @ 2016-07-06 19:40 UTC (permalink / raw
  To: help-gnu-emacs

On Wednesday, July 6, 2016 at 11:28:18 AM UTC-4, Yuri Khan wrote:
> Neither could I. Moreover, when I start "TERM=tmux emacs -Q -nw", the
> variable input-decode-map still contains a sequence for ESC [ 5 ~. I
> presumed it were added by xterm.el and that by setting a TERM which
> Emacs doesn’t know about would prevent that, but it seems at least one
> of those assumptions is false.
> 
> @Brandeis: Please also show us what you get when you press Ctrl+V PgUp
> at the zsh prompt, and what you have in the input-decode-map variable
> in emacs -Q -nw.

I tried "emacs -Q -nw" again today, and the page up/down buttons do work as expected. 

In answer to previously asked questions, term is "screen-256color" -- this is set in my Xresources file -- Ctrl+V PgUp prints ^[[5~  

Input-Decode Map variable holds:
Value: (keymap
 (27 keymap
     (79 keymap
	 (83 .
	     [f4])
	 (82 .
	     [f3])
	 (81 .
	     [f2])
	 (80 .
	     [f1])
	 (66 .
	     [down])
	 (67 .
	     [right])
	 (65 .
	     [up])
	 (68 .
	     [left]))
     (91 keymap
	 (53 keymap
	     (126 .
		  [prior]))
	 (54 keymap
	     (126 .
		  [next]))
	 (90 .
	     [backtab])
	 (51 keymap
	     (126 .
		  [deletechar]))
	 (50 keymap
	     (52 keymap
		 (126 .
		      [f12]))
	     (51 keymap
		 (126 .
		      [f11]))
	     (49 keymap
		 (126 .
		      [f10]))
	     (48 keymap
		 (126 .
		      [f9]))
	     (126 .
		  [insertchar]))
	 (52 keymap
	     (126 .
		  [end]))
	 (49 keymap
	     (57 keymap
		 (126 .
		      [f8]))
	     (56 keymap
		 (126 .
		      [f7]))
	     (55 keymap
		 (126 .
		      [f6]))
	     (53 keymap
		 (126 .
		      [f5]))
	     (126 .
		  [home])))))



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Page Up/Down Issues With Emacs in Terminal
  2016-07-06 19:40           ` Brandeis King
@ 2016-07-07  4:47             ` Yuri Khan
  0 siblings, 0 replies; 14+ messages in thread
From: Yuri Khan @ 2016-07-07  4:47 UTC (permalink / raw
  To: Brandeis King; +Cc: help-gnu-emacs@gnu.org

On Thu, Jul 7, 2016 at 1:40 AM, Brandeis King <brandeis.a.king@gmail.com> wrote:

> I tried "emacs -Q -nw" again today, and the page up/down buttons do work as expected.

So then the problem is in most probably in your init file.

> In answer to previously asked questions, term is "screen-256color" -- this is set in my Xresources file

That’s a bad idea. You are lying to tmux that its underlying terminal
is screen-like, while it is in fact xterm-like. Additionally, other
programs, if you run them outside tmux, will misbehave.

Normally, tmux sets the TERM variable for processes running within its
session. It uses "screen" by default, but you can control it with this
line in your .tmux.conf:

   set -g default-terminal "screen-256color"

> Input-Decode Map variable holds:
> Value: (keymap
>  (27 keymap
[…]
>      (91 keymap
>          (53 keymap
>              (126 .
>                   [prior]))
>          (54 keymap
>              (126 .
>                   [next]))

These are the decoding sequences for Page Up and Page Down. When you
start Emacs with your customizations, you can look for these. If they
are not there, find what deletes them.

Also, see if you are binding M-[ or ESC [ to anything. If you do, many
function keys, including Page Up and Page Down, will probably stop
working.



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-07-07  4:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-05 20:57 Page Up/Down Issues With Emacs in Terminal Brandeis King
2016-07-05 21:44 ` Emanuel Berg
2016-07-06  2:14   ` Brandeis King
2016-07-06  2:59     ` Emanuel Berg
2016-07-06  7:37     ` Yuri Khan
     [not found]     ` <mailman.639.1467790653.26859.help-gnu-emacs@gnu.org>
2016-07-06 14:28       ` Emanuel Berg
2016-07-06 15:27         ` Yuri Khan
     [not found]         ` <mailman.670.1467818895.26859.help-gnu-emacs@gnu.org>
2016-07-06 19:40           ` Brandeis King
2016-07-07  4:47             ` Yuri Khan
2016-07-05 21:48 ` Emanuel Berg
2016-07-05 22:23 ` Dmitry Alexandrov
     [not found] ` <mailman.627.1467757409.26859.help-gnu-emacs@gnu.org>
2016-07-05 22:39   ` Emanuel Berg
2016-07-05 22:56     ` Dmitry Alexandrov
     [not found]     ` <mailman.629.1467759414.26859.help-gnu-emacs@gnu.org>
2016-07-06  1:52       ` Emanuel Berg

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.