>> +(defun image-mode-isearch-filter (_beg _end) >> + "Show image as text when trying to search in the image buffer." >> + (when (and (derived-mode-p 'image-mode) >> + (image-get-display-property)) >> + (image-mode-as-text)) >> + t) > > This would switch to text representation for all images, though. Is > that what we want? Hm... perhaps? It makes sense to do this even in binary formats when the user wants to search the text of e.g. EXIF tags, etc. > So that's a good solution for isearch, but I don't think we'd want that > for search/replace. Possibly. This is what OP wanted (unfortunately, mails to his mailbox bounce back). But we could install the patch anyway. The only problem I noticed that the previous patch shows isearch highlighting at wrong places because there is a need to wrap the call to image-mode-as-text in save-match-data (alas, global match data bites again).