From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Simon Clubley Newsgroups: gmane.emacs.help Subject: Re: translating numpad keys in linux terminal Date: Fri, 3 Apr 2015 13:35:06 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <87k2xu5doo.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1428068424 24636 80.91.229.3 (3 Apr 2015 13:40:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 3 Apr 2015 13:40:24 +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 15:40:24 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 1Ye1pc-0006bB-5X for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Apr 2015 15:40:20 +0200 Original-Received: from localhost ([::1]:34188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ye1pb-0007zm-AR for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Apr 2015 09:40:19 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!feeds.phibee-telecom.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 61 Injection-Date: Fri, 3 Apr 2015 13:35:06 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="e8e016ba08adbcea049ce8081eb0079d"; logging-data="2161"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/midq0VwStwCy14HB+aBhtfhXVBmKLMKI=" User-Agent: slrn/0.9.8.1 (VMS/Multinet) Cancel-Lock: sha1:kOl/uMFG/ZLjkaynTE40vwiImAE= Original-Xref: usenet.stanford.edu gnu.emacs.help:211246 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:103528 Archived-At: On 2015-04-02, Emanuel Berg wrote: > Simon Clubley > writes: > >> ... tpu-edt.el ... when TERM is set to vt200, the >> keypad keys other than PF1-PF4 still work when in >> application keypad mode, so this might be enough for >> you. ... > > What? :) > I promise you that explanation would make perfect sense to someone with a DEC background who had actually used the physical terminals the various emulators emulate (with various degrees of accuracy). :-) > Please explain in more detail what to do step by step. > Other postings have covered most of this. However, a bit of background on DEC terminals because I can see why you might be confused by what I said. On a DEC terminal, the top row of the keypad sends out escape sequences when the keys on that row are pressed. The keys are known as PF1 (which is the Num Lock position on a PC keyboard) through PF4 (the minus key). PF1 is also known as the Gold key in the DEC world and you can see it described as such in tpu-edt.el. The rest of the keypad can operate in one of two modes, a numeric keypad mode and an application keypad mode. You can switch the terminal between these two modes by sending escape sequences to the terminal from a program. In numeric mode, pressing (say) the 5 key, sends a 5. In application keypad mode, pressing a key sends a specific and unique escape sequence. Applications in the DEC world (such as editors) use this to determine the user pressed a key on the keypad instead of on the main keyboard. > If I set TERM to vt200 ('TERM=vt200 emacs -nw' in > xterm), my colors are broken. Tho I am able to > (require 'tpu-edt) that doesn't do anything to change > the keys reported by `describe-key' what I can see. > > But yes, X and xterm should be enough because as said, > xev do reports different keys when run from xterm. > As someone else mentioned, the different keycodes are required, but not sufficient. When emacs is in character cell mode (emacs -nw) the only thing it can see are the escape sequences coming from the terminal emulator; it has no knowledge of what is going on at X11 level. Either the terminal emulator already knows it needs to send these escape sequences in response to a key press or it needs to be configured to do so via some keycode to escape sequence mapping. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world