From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#25905: 25.1; Can't find regexp and replace in SVG files Date: Fri, 18 Dec 2020 10:46:38 +0200 Organization: LINKOV.NET Message-ID: <87bler1lpl.fsf@mail.linkov.net> References: <1488327656.1648.1.camel@delair-tech.com> <87a6ui94s8.fsf@gnus.org> <9f8916a2-293e-16c9-4a3c-f69f215a7fa2@yandex.ru> <87a6uh6fnu.fsf@gnus.org> <87y2i1cw4d.fsf@mail.linkov.net> <875z541hpt.fsf@gnus.org> <87mtyg2ryb.fsf@mail.linkov.net> <87a6uf1sss.fsf@gnus.org> <87mtyeycdr.fsf@mail.linkov.net> <875z50gkf4.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6540"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 25905@debbugs.gnu.org, Dmitry Gutov To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 18 10:59:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kqCXV-0001Ze-CA for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Dec 2020 10:59:09 +0100 Original-Received: from localhost ([::1]:45824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqCXU-0007sE-63 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Dec 2020 04:59:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqCXN-0007s1-Rk for bug-gnu-emacs@gnu.org; Fri, 18 Dec 2020 04:59:01 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54429) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kqCXN-0006vL-L4 for bug-gnu-emacs@gnu.org; Fri, 18 Dec 2020 04:59:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kqCXN-0006Jw-Ix for bug-gnu-emacs@gnu.org; Fri, 18 Dec 2020 04:59:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Dec 2020 09:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25905 X-GNU-PR-Package: emacs Original-Received: via spool by 25905-submit@debbugs.gnu.org id=B25905.160828553424282 (code B ref 25905); Fri, 18 Dec 2020 09:59:01 +0000 Original-Received: (at 25905) by debbugs.gnu.org; 18 Dec 2020 09:58:54 +0000 Original-Received: from localhost ([127.0.0.1]:37742 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kqCXG-0006JZ-F6 for submit@debbugs.gnu.org; Fri, 18 Dec 2020 04:58:54 -0500 Original-Received: from relay9-d.mail.gandi.net ([217.70.183.199]:39855) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kqCXC-0006JH-E6 for 25905@debbugs.gnu.org; Fri, 18 Dec 2020 04:58:53 -0500 X-Originating-IP: 91.129.99.98 Original-Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 05D5BFF80B; Fri, 18 Dec 2020 09:58:41 +0000 (UTC) In-Reply-To: <875z50gkf4.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 18 Dec 2020 00:03:11 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:196313 Archived-At: --=-=-= Content-Type: text/plain >>>> 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. Here is a more correct implementation: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=image-mode-isearch-filter.patch diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 032ebf3873..87a8dc9ef2 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -667,6 +667,9 @@ image-mode--setup-mode (when image-auto-resize-on-window-resize (add-hook 'window-state-change-functions #'image--window-state-change nil t)) + (add-function :before-while (local 'isearch-filter-predicate) + #'image-mode-isearch-filter) + (run-mode-hooks 'image-mode-hook) (let ((image (image-get-display-property)) (msg1 (substitute-command-keys @@ -782,6 +790,13 @@ image-toggle-display-text (if (called-interactively-p 'any) (message "Repeat this command to go back to displaying the image")))) +(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) + (defvar archive-superior-buffer) (defvar tar-superior-buffer) (declare-function image-flush "image.c" (spec &optional frame)) --=-=-=--