[Top][All Lists]

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

Re: translating numpad keys in linux terminal

From: Dan Espen
Subject: Re: translating numpad keys in linux terminal
Date: Thu, 02 Apr 2015 23:38:18 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Tim Johnson <address@hidden> writes:

> * Emanuel Berg <address@hidden> [150402 17:49]:
>> Dan Espen <address@hidden> writes:
>> >> Perhaps someone in this list that is familiar with
>> >> just exactly what the '-nw' option does can
>> >> enlighten us?
>> >
>> > From the docs:
>> >
>> > Don't communicate directly with the window system,
>> > disregarding the DISPLAY environment variable even
>> > if it is set. This means that Emacs uses the
>> > terminal from which it was launched for all its
>> > display and input.
>> >
>> > The terminal gets and sends X Events.
>> >
>> > Emacs gets and sends _characters_ to and from
>> > the terminal.
>> >
>> > Sometimes Emacs may get signals from the terminal,
>> > like when the terminal is resized.
>> >
>> > Emacs in a terminal does not see X Events.
>> >
>> > So, your issue is what does the terminal send to Emacs
>> > when you hit a KP key,
>> >
>> > Terminals like rxvt and xterm give you
>> > complete control.
>> >
>> > gnome-terminal, sorry, I don't use it.
>> Case closed.
>   Indeed. 
>   My workstation is a Mac Mini. To recap, I get unique translations
>   of numeric keypad input to 'emacs' running from iTerm2.
>   I didn't get the same uniqueness when I booted the same machine
>   into ubuntu 14.04 and ran 'emacs -nw' from gnome-terminal.
>   The terminal emulator controls what emacs gets when it is in
>   terminal - this from the good people who responded to my
>   inquiries.
>   As has been pointed out, rxvt _does_ translate numeric keypad
>   uniquely (unlink gnome-terminal). By starting rxvt in my setup and
>   then invoking emacs -nw and then running <help>-c, I can see that
>   M-O sequences are being generated (that is Alt-Shift-(the capital
>   letter "O")).

The man pages describes more.
This is from an xresource file for XTerm:

        Shift<Key>KP_9: scroll-back(1, page)\n\
        Shift<Key>KP_3: scroll-forw(1, page)

The "translations" resource lets you specify
the X event and the corresponding action for that event.

So, if I wanted the un-shifted KP_9 key to
do something special I could specify:

        None<Key>KP_9:  string("Hi Mom!") \n\

The first part is the X event, the second part is the action
as described in the man page.

I'm guessing gnome-terminal has something equivalent
but perhaps not as flexible.

Dan Espen

reply via email to

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