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: Thu, 2 Apr 2015 10:49:09 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1427973010 27252 80.91.229.3 (2 Apr 2015 11:10:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Apr 2015 11:10:10 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Apr 02 13:10:05 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 1Ydd0e-0008Ux-CR for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Apr 2015 13:10:04 +0200 Original-Received: from localhost ([::1]:57566 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ydd0d-0004nH-Fe for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Apr 2015 07:10:03 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-2.dfn.de!news.dfn.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 58 Injection-Date: Thu, 2 Apr 2015 10:49:09 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="41011b4e1cc1db0934cb6284c650a604"; logging-data="21969"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//xoal+QOZqi6IGRZxbsquoLKhjtH/Vt0=" User-Agent: slrn/0.9.9p1 (Linux) Cancel-Lock: sha1:TkSlarXQceM19uzMqYhTeCFsuhc= Original-Xref: usenet.stanford.edu gnu.emacs.help:211225 X-Mailman-Approved-At: Thu, 02 Apr 2015 07:09:52 -0400 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:103507 Archived-At: On 2015-03-30, Tim Johnson wrote: > With emacs 24 on linux ubuntu 14.04 > > Gui emacs translates all numeric keypad keys except the backspace as > distinct from the equivalent on the main keyboard. > > Example : kp-up vs. up > > Unfortunately, my preference is emacs -nw from the terminal, which > in this case is gnome-terminal. emacs -nw only translates > kp-(divide, multiply, minus, plus and enter). > > Is there a way to read the other keys with "kp-" as in gui emacs? > Yes. (I currently rely on this ability for some of my workflow as I use the EDT keypad layout when editing in emacs.) You need a decent terminal emulator which supports DEC keyboard escape sequences correctly and can go into application keypad mode. For me, xterm with a script[*] I picked up from comp.os.vms a decade or so qualifies as does the pterm component of PuTTY. In both cases, I am running the keyboard permanently in application keypad mode, rather than messing around with going in and out of application keypad mode when entering/exiting emacs. This may not be suitable for you and you may choose to do the switching yourself as required. You then have two choices: 1) You can look at a version of tpu-edt.el from early emacs 22.x or before which shows how to turn the incoming escape sequences into something can be processed within your emacs code. 2) Sometime after this, tpu-edt.el was rewritten to drop the direct processing of escape sequences (and utterly breaking character cell support in the process; I've only just discovered this after switching to a newer LTS version of Linux and I've just notified the tpu-edt.el author). However, even in this broken version, 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. If so, have a look at a current version of tpu-edt.el and you might be able to see something which you can use; this would appear to be an easier approach than directly processing escape sequences in your case. Simon. [*] There's a script on http://invisible-island.net/xterm/xterm.faq.html which might help you get started if you choose this approach; you want one which maps Num Lock to PF1; these specific scripts I have not tested however. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world