First, in general, Isearch uses the minibuffer only for M-e
. So your minbufferminibuffer-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)