bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25905: 25.1; Can't find regexp and replace in SVG files


From: Juri Linkov
Subject: bug#25905: 25.1; Can't find regexp and replace in SVG files
Date: Fri, 18 Dec 2020 00:03:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>>> There is also the dired-do-isearch command that searches in marked files.
>>>
>>> OTOH, when such "making text visible to search" would be implemented
>>> for isearch, then it will be used automatically by query-replace that
>>> relies on the same search functions.
>>
>> That's true...
>>
>> So we basically need some new functionality for switching to text mode
>> in image buffers when we're doing searches?
>
> Maybe isearch-open-necessary-overlays should detect if there is an image
> over point, then switch the buffer to text mode.

Here is one possible fix, but I'm still unsure if using image functions
in isearch is a good style.  Perhaps a better fix would be to add this
code to a buffer-local isearch-mode-hook in image-mode.el that runs
when isearch starts.

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 0d5c480c8d..12d31d49a7 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -3573,6 +3573,11 @@ isearch-close-unnecessary-overlays
 
 (defun isearch-range-invisible (beg end)
   "Return t if all the text from BEG to END is invisible."
+  (let ((inside-image (and (derived-mode-p 'image-mode)
+                           (fboundp 'image-get-display-property)
+                           (image-get-display-property))))
+    (when (and inside-image (fboundp 'image-mode-as-text))
+      (image-mode-as-text)))
   (when (/= beg end)
     ;; Check that invisibility runs up to END.
     (save-excursion

reply via email to

[Prev in Thread] Current Thread [Next in Thread]