From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Espen Newsgroups: gmane.emacs.help Subject: Re: translating numpad keys in linux terminal Date: Thu, 02 Apr 2015 23:38:18 -0400 Organization: A noiseless patient Spider Message-ID: References: <87k2xu5doo.fsf@debian.uxu> <87iodeujdh.fsf@debian.uxu> <874moyugoz.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1428032434 9693 80.91.229.3 (3 Apr 2015 03:40:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 3 Apr 2015 03:40:34 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 03 05:40:28 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YdsSw-0001EH-6u for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Apr 2015 05:40:18 +0200 Original-Received: from localhost ([::1]:60812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdsSv-0007yk-EX for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Apr 2015 23:40:17 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 77 Injection-Info: mx02.eternal-september.org; posting-host="ad871ce417d1fb2ea3c87e49e48c0ae1"; logging-data="19775"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bU94+XtgO8L6xD0NGFPZrAOsvGDB6b1I=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:CfCA87+xR3yfVXsoJqKV3ctZBSI= Original-Xref: usenet.stanford.edu gnu.emacs.help:211244 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103526 Archived-At: Tim Johnson writes: > * Emanuel Berg [150402 17:49]: >> Dan Espen 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 -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: XTerm*VT100.translations:#override\n\ ShiftKP_9: scroll-back(1, page)\n\ ShiftKP_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: NoneKP_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