4

How can change this behaviour:

  1. C-s — start incremental search
  2. type word — misprint the last character
  3. Backspace — Oops! incremental search disappears, and I actually delete 1 character from the buffer.

to that one:

  1. C-s — start incremental search
  2. word — misprint the last character
  3. Backspace — delete the last d character
  4. type kwork — correct, and continue the search

I run Emacs in text terminal via SSH in PuTTY.

Operating system version: 2.6.16.60-0.58.1.1882.3.PTF.638363-smp #1 SMP Wed Dec 2 12:27:56 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux

Emacs version: GNU Emacs 23.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.14.6) of 2010-07-16

With the -q option, Backspace sent by PuTTY is just C-h, and it acts like C-h, but in my .emacsfile I it bind to delete-backward-char:

(global-set-key [(control h)] 'delete-backward-char)
Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
Necto
  • 2,594
  • 1
  • 20
  • 45
  • 1
    This should work out of the box. What operating system are you using? Are you running Emacs in a GUI or in a text terminal, and which? Do you see the same behavior if you run `emacs -q`? What about `emacs -Q`? What is shown when you press `C-h c Backspace`? – Gilles 'SO- stop being evil' Aug 17 '12 at 12:02
  • The answers is above. emacs -Q is like emacs -Q but without welcome screen. C-h c Backspace - as i said, Backspace is just C-h, being passed through the putty. – Necto Aug 17 '12 at 12:27

3 Answers3

4

Try this:

(define-key isearch-mode-map [(control h)] 'isearch-delete-char)
Tom
  • 7,515
  • 7
  • 38
  • 54
2

What you should do is configure PuTTY to send C-? (byte 127) for Backspace instead of C-h (byte 8). This is the setting that works best in most circumstances. See the PuTTY manual.

If you changed the PuTTY setting to send C-h because some other application didn't work, check that your terminal settings are correct on the server. The setting is often correctly autodetected, but sometimes you may need to add stty erase '^?' to your shell configuration file (.bashrc or similar) on the server.

If you really absolutely have to have Backspace send C-h, then globally rebinding C-h isn't sufficient. Instead, add (normal-erase-is-backspace-mode 1) to your .emacs. See the Emacs manual.

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
  • You are right, I changed Backspace to C-h because to wrong teminal settings in the past, and now it isn't neccessary. – Necto Aug 18 '12 at 08:26
0

How you should use Emacs:

  1. C-s - start incremental search
  2. type word - misprint the last character
  3. M-e - goes into edit-search-word-thing-mode-in-minibuffer :-)
  4. correct the typo
  5. C-s - continue incremental search
bjacquet
  • 118
  • 3