home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / gnu / emacs / help / 5314 < prev    next >
Encoding:
Text File  |  1993-01-10  |  2.9 KB  |  77 lines

  1. Path: sparky!uunet!spool.mu.edu!agate!doc.ic.ac.uk!frigate.doc.ic.ac.uk!mjb
  2. From: mjb@doc.ic.ac.uk (Matthew J Brown)
  3. Newsgroups: gnu.emacs.help
  4. Subject: Re: Remapping DEL key on a SUN4
  5. Date: 10 Jan 93 13:35:35
  6. Organization: Department Of Computing, Imperial College, London.
  7. Lines: 63
  8. Distribution: world
  9. Message-ID: <MJB.93Jan10133535@oak45.doc.ic.ac.uk>
  10. References: <1ifcu5INNmn5@agate.berkeley.edu>
  11. NNTP-Posting-Host: oak45.doc.ic.ac.uk
  12. In-reply-to: pedro@eerc.berkeley.edu's message of 6 Jan 1993 19:46:13 GMT
  13.  
  14. In article <1ifcu5INNmn5@agate.berkeley.edu> pedro@eerc.berkeley.edu (Peter Clark) writes:
  15. > Hi all,
  16.  
  17. > I am using emacs 18.58 on a SUN 4 (Sparc 1) with a type 4 keyboard.
  18.  
  19. > I would like to remap the DEL key on the keypad from delete-backward-char
  20. > to delete-char.  I have tried in my .emacs
  21. > (global-set-key "DEL" 'delete-char)
  22. > (global-set-key "\DEL" 'delete-char)
  23. > etc. to no avail.
  24.  
  25. > I did notice that I could do a 
  26. > M-x local-set-key DEL delete-char
  27. > while running emacs and this worked OK.
  28.  
  29. > I've looked in the FAQ, I've tried everything, please help explain this!!!
  30.  
  31. > Thanks for all hints and pointers!
  32.  
  33. I assume you mean the "."/DEL key on the keypad, and you're running
  34. EMACS under X. From what you write I assume that this keycode is
  35. mapped to the keysym "Delete" at the moment, to do the same as the
  36. normal "Delete" key.
  37.  
  38. What you're going to have to do, is to modify the X keymapping of this
  39. key with 'xmodmap'. Now, Emacs can understand both normal ASCII keys,
  40. and function keys, for which an escape sequence is sent to the rest of
  41. EMACS. EMACS does not understand 'symbol' keys (at least, I haven't
  42. found out how), so, to get EMACS to distinguish this key, you're going
  43. to have to map it to a function key. Choose a function key which is
  44. not mapped - X function keys range between F1 and F36. Map this to the
  45. keycode generated by the keypad 'del' key - this is 57 on a sun type
  46. 5, I believe it is the same on a type 4. You can use 'xev' to find
  47. out.
  48.  
  49. Type the following at a UNIX prompt:
  50.  
  51. % xmodmap -e 'keycode 57 = F35'
  52.  
  53. (substitute the correct keycode number and function key)
  54.  
  55. Now to bind the key. Firstly, make a sparse keymap and bind it to the
  56. function key escape sequence, esc [.
  57.  
  58. (setq fnkey-map (make-sparse-keymap))
  59. (define-key esc-map "[" fnkey-map)
  60.  
  61. Now you can bind functions to the various escape sequences. We're
  62. using F35 here as delete, you can also use this technique to bind
  63. things to other function keys. You can use C-q to find out what
  64. different function keys send.
  65.  
  66. (define-key fnkey-map "222z" 'delete-char)
  67.  
  68. That's all there is to it. Hope this answers your question properly.
  69.  
  70. -Matt
  71.  
  72. --
  73. | Matthew J. Brown  | Dept. of Computing | If God intended for us to go to   |
  74. | mjb@doc.ic.ac.uk  | Imperial College,  | lectures He wouldn't have created |
  75. | mjb02@cc.ic.ac.uk | 180 Queen's Gate   | double-sided photocopiers.        |
  76. | Morven on Lambda  | LONDON SW7 2AZ     |          -IC RagMag 1991/92       |
  77.