Emacs – Delete selected text


In order to set emacs to delete the selected text when you press DEL, Ctrl-d, or Backspace, add the following to your .emacs file:

(delete-selection-mode t)

An additional effect is that when you insert text while some text is selected, the selected text will be deleted.

This will also enable transient-mark-mode (see Highlight selected text).


4 Responses to “Emacs – Delete selected text”

  1. Emacs - Highlight selected text « Not So Frequently Asked Questions Says:

    […] See also Delete selected text. […]

  2. quizzlo Says:

    (A little late, indeed, but) thanks a lot πŸ™‚ I was looking for this by ages!

  3. daFeda Says:

    I do not understand why this is not a default setting. Thanks!

  4. Dave (@xaccrocheur) Says:

    Oh and by all means, don’t forget to set the flag

    (setq behave-like-something-actually-usable-by-humans t)


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: