www.delorie.com/gnu/docs/emacs/cc-mode_13.html   search  
Buy the book!

CC Mode Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 Hungry-deletion of Whitespace

Hungry deletion of whitespace, or as it more commonly called, hungry-delete mode, is a simple feature that some people find extremely useful. In fact, you might find yourself wanting hungry-delete in all your editing modes!

In a nutshell, when hungry-delete mode is enabled, hitting the Backspace key(12) will consume all preceding whitespace, including newlines and tabs. This can really cut down on the number of Backspace's you have to type if, for example you made a mistake on the preceding line.

By default, when you hit the Backspace key CC Mode runs the command c-electric-backspace, which deletes text in the backwards direction. When deleting a single character, or when Backspace is hit in a literal (see section 4.1 Auto-newline Insertion), or when hungry-delete mode is disabled, the function contained in the c-backspace-function variable is called with one argument (the number of characters to delete). This variable is set to backward-delete-char-untabify by default.

The default behavior of the Delete key depends on the flavor of Emacs you are using. By default in XEmacs 20.3 and beyond, the Delete key is bound to c-electric-delete. You control the direction that the Delete key deletes by setting the variable delete-key-deletes-forward, a standard XEmacs variable. When this variable is non-nil and hungry-delete mode is enabled, c-electric-delete will consume all whitespace following point. When delete-key-deletes-forward is nil, it deletes all whitespace preceding point(13) When deleting a single character, or if Delete is hit in a literal, or hungry-delete mode is disabled, the function contained in c-delete-function is called with one argument: the number of characters to delete. This variable is set to delete-char by default.

In Emacs 19 or Emacs 20, both the Delete and Backspace keys are bound to c-electric-backspace, however you can change this by explicitly binding [delete](14).

XEmacsen older than 20.3 behave similar to Emacs 19 and Emacs 20.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003