Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Next: , Previous: Electric C, Up: C Modes

31.11.3 Hungry Delete Feature in C

If you want to delete an entire block of whitespace at point, you can use hungry deletion. This deletes all the contiguous whitespace either before point or after point in a single operation. Whitespace here includes tabs and newlines, but not comments or preprocessor commands.

C-c C-<BS>
C-c <BS>
c-hungry-backspace—Delete the entire block of whitespace preceding point.
C-c C-d
C-c C-<DEL>
C-c <DEL>
c-hungry-delete-forward—Delete the entire block of whitespace following point.

As an alternative to the above commands, you can enable hungry delete mode. When this feature is enabled (indicated by ‘/h’ in the mode line after the mode name), a single <BS> command deletes all preceding whitespace, not just one space, and a single C-c C-d (but not <delete>) deletes all following whitespace.

M-x c-toggle-hungry-state
Toggle the hungry-delete feature (c-toggle-hungry-state)1. With a prefix argument, this command turns the hungry-delete feature on if the argument is positive, and off if it is negative.

The variable c-hungry-delete-key controls whether the hungry-delete feature is enabled.


[1] This command had the binding C-c C-d in earlier versions of Emacs. C-c C-d is now bound to c-hungry-delete-forward.

  Published under the terms of the GNU General Public License Design by Interspire