This is because isearch
does not use the minibuffer to read input from the user, rather it simply updates the echo area with the characters entered during isearch
. Please note that the minibuffer and the echo area are different. From the GNU Emacs Manual
The echo area is used for displaying error messages (see Errors), for
messages made with the message primitive, and for echoing keystrokes.
It is not the same as the minibuffer, despite the fact that the
minibuffer appears (when active) in the same place on the screen as
the echo area.
As such minibuffer-setup-hook
is never executed during isearch
since the minibuffer is never setup.
In this specific case, isearch-mode
sets overriding-terminal-map
to isearch-mode-map
which binds all characters from in ascii range 32 to 255 to isearch-printing-char
which updates the isearch prompt by echoing the new prompt.
If you follow the calls, you will find that isearch-update
is used to update the prompt which isearch-message-function
(if defined) to update the prompt otherwise it falls back to isearch-message
. So a solution might be to set isearch-message-function
to a custom function which calls message
with a propertized string with face
property set to custom face with desired height.
Following implements the idea mentioned in the previous paragraph, most of it is copied directly from the function isearch-message
except for the last part where the string passed to message is propertized to have a larger height.
(defun my-isearch-message (&optional c-q-hack ellipsis)
;; Generate and print the message string.
(let ((cursor-in-echo-area ellipsis)
(m isearch-message)
(fail-pos (isearch-fail-pos t)))
;; Highlight failed part
(when fail-pos
(setq m (copy-sequence m))
(add-text-properties fail-pos (length m) '(face isearch-fail) m)
;; Highlight failed trailing whitespace
(when (string-match " +$" m)
(add-text-properties (match-beginning 0) (match-end 0)
'(face trailing-whitespace) m)))
(setq m (concat
(isearch-message-prefix ellipsis isearch-nonincremental)
m
(isearch-message-suffix c-q-hack)))
(if c-q-hack m (let ((message-log-max nil)) (message "%s" (propertize m 'face '(:inherit default :height 1.5)))))))
(setq isearch-message-function #'my-isearch-message)