Skip to main content
1 of 2
Drew
  • 79.1k
  • 10
  • 123
  • 257

First, in general, Isearch uses the minibuffer only M-e. So your minbuffer-local-isearch-map key binding is useless here. That's the keymap used when editing after M-e.

Second, your isearch-mode-map binding means that C-h ends up deleting the char in the buffer you're searching, not deleting a char from the search string. The current buffer remains the buffer you're searching.

This is what you need to do. It defines a command that pops the last char off of the end of the search string.

(defun foo ()
  "Delete last char of the search string."
  (interactive)
  (unless (equal isearch-string "") (isearch-pop-state))
  (isearch-update))

(define-key isearch-mode-map (kbd "C-h") 'foo)
Drew
  • 79.1k
  • 10
  • 123
  • 257