home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!ames!sun-barr!west.West.Sun.COM!cronkite.Central.Sun.COM!texsun!digi!kgallagh
- From: kgallagh@digi.lonestar.org (Kevin Gallagher)
- Newsgroups: gnu.emacs.help
- Subject: Re: Binding the DEL key.
- Message-ID: <1992Sep2.161606.12486@digi.lonestar.org>
- Date: 2 Sep 92 16:16:06 GMT
- References: <BturFr.BB2@news.cso.uiuc.edu> <1992Sep02.030617.21228@bnr.ca>
- Organization: DSC Communications Corp, Plano, TX
- Lines: 34
-
- In article <1992Sep02.030617.21228@bnr.ca> mac@bnr.ca (Michael Campbell) writes:
- >Your problem may be related to the terminal type you are using.
-
- I don't think so. This is what is probably happening:
-
- Standard key bindings are found in the key map called global-map. In that
- map, DEL is bound to delete-backward-char. by default. If you are editing a
- file in a buffer running in Fundamental mode or Text mode, you will find that
- DEL is bound to this function. If you use the define-key command in your
- .emacs file to change the binding of DEL in the global-map, you will find that
- DEL does INDEED get the new function binding in Text mode and Fundamental mode
- buffers.
-
- HOWEVER, if you are in a C mode buffer, you will find that DEL is bound to
- backward-delete-char-untabify and is not affected by changing the binding of
- DEL in global-MAP. This is because C mode has a local mode map that binds the
- DEL key to backward-delete-char-untabify. Key bindings in local mode maps
- ALWAYS override bindings found in global maps when that mode is active in a
- buffer.
-
- If you want to change the binding of DEL when in C mode, you must change the
- binding of DEL in c-mode-map. The safest way to do this in your .emacs file
- is to use the c-mode-hook. Write a small function that changes the binding of
- DEL in c-mode-map via the define-key command. Then assign that function name
- to the variable c-mode-hook. Then, each time a C mode buffer it intialized,
- the function assigned to c-mode-hook will be called after C mode
- initialization is complete. The DEL key will be redefined for just that
- buffer.
-
- --
- ----------------------------------------------------------------------------
- Kevin Gallagher kgallagh@digi.lonestar.org OR ...!uunet!digi!kgallagh
- DSC Communications Corporation Addr: MS 152, 1000 Coit Rd, Plano, TX 75075
- ----------------------------------------------------------------------------
-