Reputation: 41
Emacs's Delete-selection-mode, modern as it feels, makes it too easy to inadvertently delete code. Thus, I would like it disabled by default. Therefore, I added
(delete-selection-mode f)
to my init.el file but that had no effect. By which I mean, if I highlight a region and type something, the contents of the selection are replaced with the new typing. I also tried toggling the mode with M-x delete-selection-mode
command, but that had no effect. I use Emacs 24.1.1 on Windows7, Mac and Linux. What am I missing, is there some other mode or variable that I should be enabling instead?
Upvotes: 2
Views: 1031
Reputation: 41
delete-selection-mode
is set by default when CUA mode is enabled, but it can be disabled via M-x customize
. CUA settings are a subgroup of the "Editing Basics" subgroup of the top-level "Editing" group. To disable delete-selection mode, use the Value Menu of the "Cua Delete Selection" item and change the setting to Disabled. This will place the following line among the custom-set-variables defined in your .emacs or init.el file: (cua-delete-selection nil)
. After this has been set, actions such as cut with C-w
or pressing the delete key will continue to operate normally on regions.
Upvotes: 2