home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / gnu / emacs / help / 3962 < prev    next >
Encoding:
Internet Message Format  |  1992-09-02  |  2.3 KB

  1. Path: sparky!uunet!stanford.edu!ames!sun-barr!west.West.Sun.COM!cronkite.Central.Sun.COM!texsun!digi!kgallagh
  2. From: kgallagh@digi.lonestar.org (Kevin Gallagher)
  3. Newsgroups: gnu.emacs.help
  4. Subject: Re: Binding the DEL key.
  5. Message-ID: <1992Sep2.161606.12486@digi.lonestar.org>
  6. Date: 2 Sep 92 16:16:06 GMT
  7. References: <BturFr.BB2@news.cso.uiuc.edu> <1992Sep02.030617.21228@bnr.ca>
  8. Organization: DSC Communications Corp, Plano, TX
  9. Lines: 34
  10.  
  11. In article <1992Sep02.030617.21228@bnr.ca> mac@bnr.ca (Michael Campbell) writes:
  12. >Your problem may be related to the terminal type you are using.
  13.  
  14. I don't think so.  This is what is probably happening:
  15.  
  16. Standard key bindings are found in the key map called global-map.  In that
  17. map, DEL is bound to delete-backward-char. by default.  If you are editing a
  18. file in a buffer running in Fundamental mode or Text mode, you will find that
  19. DEL is bound to this function.  If you use the define-key command in your
  20. .emacs file to change the binding of DEL in the global-map, you will find that
  21. DEL does INDEED get the new function binding in Text mode and Fundamental mode
  22. buffers.
  23.  
  24. HOWEVER, if you are in a C mode buffer, you will find that DEL is bound to
  25. backward-delete-char-untabify and is not affected by changing the binding of
  26. DEL in global-MAP.  This is because C mode has a local mode map that binds the
  27. DEL key to backward-delete-char-untabify.  Key bindings in local mode maps
  28. ALWAYS override bindings found in global maps when that mode is active in a
  29. buffer. 
  30.  
  31. If you want to change the binding of DEL when in C mode, you must change the
  32. binding of DEL in c-mode-map.  The safest way to do this in your .emacs file
  33. is to use the c-mode-hook.  Write a small function that changes the binding of
  34. DEL in c-mode-map via the define-key command.  Then assign that function name
  35. to the variable c-mode-hook.  Then, each time a C mode buffer it intialized,
  36. the function assigned to c-mode-hook will be called after C mode
  37. initialization is complete.  The DEL key will be redefined for just that
  38. buffer.
  39.  
  40. -- 
  41. ----------------------------------------------------------------------------
  42. Kevin Gallagher        kgallagh@digi.lonestar.org OR ...!uunet!digi!kgallagh
  43. DSC Communications Corporation   Addr: MS 152, 1000 Coit Rd, Plano, TX 75075
  44. ----------------------------------------------------------------------------
  45.