What happens when like
is not replaced? Is the letter you typed inserted at the cursor (which is then after the e
in like
)?
A guess is that you've somehow toggled Delete-Selection mode: turned it off instead of on.
When the mode is on and the region is active (i.e., text is selected/highlighted), text you type replaces the selected text. When off, text you type is inserted at the cursor.
Do you see the same thing when you start Emacs with emacs -Q
(no init file)? By default, Delete-Selection mode is off. Probably something in your init file is probably turning Delete-Selection mode on, and then you are likely doing something that turns it off.
Maybe the command that toggles the mode on/off, which is delete-selection-mode
, is bound to some key that you sometimes hit accidentally. To find out, use C-h w
(command where-is
), and type delete-selection-mode
at the prompt. It will tell you which key, if any, that command is bound to.
If this doesn't help, you may need to provide more info about what you use in your init file. Try to provide a step-by-step recipe, starting from emacs -Q
, to reproduce the problem.
For more info about delete-selection-mode
: C-h f delete-selection-mode
.