🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #2121

Re: Remapping DEL key on a SUN4

#2121
From: Matthew J Brown
Date: Sun, 10 Jan 1993 13:35
63 lines
3044 bytes
In article <1ifcu5INNmn5@agate.berkeley.edu> pedro@eerc.berkeley.edu (Peter Clark) writes:
> Hi all,

> I am using emacs 18.58 on a SUN 4 (Sparc 1) with a type 4 keyboard.

> I would like to remap the DEL key on the keypad from delete-backward-char
> to delete-char.  I have tried in my .emacs
> (global-set-key "DEL" 'delete-char)
> (global-set-key "\DEL" 'delete-char)
> etc. to no avail.

> I did notice that I could do a 
> M-x local-set-key DEL delete-char
> while running emacs and this worked OK.

> I've looked in the FAQ, I've tried everything, please help explain this!!!

> Thanks for all hints and pointers!

I assume you mean the "."/DEL key on the keypad, and you're running
EMACS under X. From what you write I assume that this keycode is
mapped to the keysym "Delete" at the moment, to do the same as the
normal "Delete" key.

What you're going to have to do, is to modify the X keymapping of this
key with 'xmodmap'. Now, Emacs can understand both normal ASCII keys,
and function keys, for which an escape sequence is sent to the rest of
EMACS. EMACS does not understand 'symbol' keys (at least, I haven't
found out how), so, to get EMACS to distinguish this key, you're going
to have to map it to a function key. Choose a function key which is
not mapped - X function keys range between F1 and F36. Map this to the
keycode generated by the keypad 'del' key - this is 57 on a sun type
5, I believe it is the same on a type 4. You can use 'xev' to find
out.

Type the following at a UNIX prompt:

% xmodmap -e 'keycode 57 = F35'

(substitute the correct keycode number and function key)

Now to bind the key. Firstly, make a sparse keymap and bind it to the
function key escape sequence, esc [.

(setq fnkey-map (make-sparse-keymap))
(define-key esc-map "[" fnkey-map)

Now you can bind functions to the various escape sequences. We're
using F35 here as delete, you can also use this technique to bind
things to other function keys. You can use C-q to find out what
different function keys send.

(define-key fnkey-map "222z" 'delete-char)

That's all there is to it. Hope this answers your question properly.

-Matt

--
| Matthew J. Brown  | Dept. of Computing | If God intended for us to go to   |
| mjb@doc.ic.ac.uk  | Imperial College,  | lectures He wouldn't have created |
| mjb02@cc.ic.ac.uk | 180 Queen's Gate   | double-sided photocopiers.        |
| Morven on Lambda  | LONDON SW7 2AZ     |          -IC RagMag 1991/92       |
Technical Details
Message-ID: <MJB.93Jan10133535@oak45.doc.ic.ac.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!agate!doc.ic.ac.uk!frigate.doc.ic.ac.uk!mjb
References: <1ifcu5INNmn5@agate.berkeley.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!agate!doc.ic.ac.uk!frigate.doc.ic.ac.uk!mjb
From: mjb@doc.ic.ac.uk (Matthew J Brown)
Newsgroups: gnu.emacs.help
Subject: Re: Remapping DEL key on a SUN4
Date: 10 Jan 93 13:35:35
Organization: Department Of Computing, Imperial College, London.
Lines: 63
Distribution: world
Message-ID: <MJB.93Jan10133535@oak45.doc.ic.ac.uk>
References: <1ifcu5INNmn5@agate.berkeley.edu>
NNTP-Posting-Host: oak45.doc.ic.ac.uk
In-reply-to: pedro@eerc.berkeley.edu's message of 6 Jan 1993 19:46:13 GMT