2

Sometimes key binding changes unexpectedly such that if I position the cursor next to the first occurence of 'm'

lorem ipsum 

and type 'xxxx', I get

loremxxxxum

instead of:

loremxxxx ipsum

Also, typing backspace replaced each character by a blank rather than deleting it.

If I quit and re-open the fame file, backspace works as expected. What causes this problem and how to fix it during an Emacs session?

This is using GNU Emacs 26.3 (GUI)

Drew
  • 75,699
  • 9
  • 109
  • 225

3 Answers3

4

You've accidentally turn on overwrite-mode, probably by accidentally hitting the <insert> key (typically labeled Insert on your keyboard).

When overwrite-mode is enabled, text you type replaces existing text.

As for how to "fix it": just hit the <insert> key again: it's a toggle key.

(As @db48x mentioned in his answer, you can turn on view-lossage to see which keys and mouse actions you've recently used. That will no doubt show you that you used key <insert>.)

Drew
  • 75,699
  • 9
  • 109
  • 225
  • 1
    If you don't know what the `` key is, toggle `M-x overwrite-mode` (man 5.21). –  Aug 27 '22 at 05:03
1

You can use M-x view-lossage to review the last few hundred keystrokes.

db48x
  • 15,741
  • 1
  • 19
  • 23
0

If you know that you never want overwrite-mode, you can put this in your init file:

(put 'overwrite-mode 'disabled t)
Phil Hudson
  • 1,651
  • 10
  • 13