GNU bug report logs - #25905
25.1; Can't find regexp and replace in SVG files

Previous Next

Package: emacs;

Reported by: Matthias Meulien <matthias.meulien <at> delair-tech.com>

Date: Wed, 1 Mar 2017 00:25:01 UTC

Severity: minor

Tags: fixed

Found in version 25.1

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Matthias Meulien <matthias.meulien <at> delair-tech.com>, 25905 <at> debbugs.gnu.org
Subject: bug#25905: 25.1; Can't find regexp and replace in SVG files
Date: Sat, 12 Dec 2020 22:24:42 +0200
>> Open a dired buffer visiting a directory with SVG images. Mark some SVG
>> files then try to `dired-do-find-regexp-and-replace' in those files.
>>
>> It fails due to `image-file-mode' turning all visited buffers as
>> read-only...
>
> It'll also display the svg files as images (although with the real text
> in the buffer "shadowed" by the image).
>
> I guess this is a problem with all files that Emacs displays in
> ... highly interpreted form, like images and tar files and the like.
> The thing that makes SVG files special here is that you could see
> somebody actually want to do a find-and-replace on them, while you don't
> really see that in a, say, zip file.  Often.
>
> But I wonder whether this problem should nevertheless have a general
> solution.  That is, should this command have a variation that works on
> literal files instead?  Perhaps a prefix of `C-u' to make the query
> replace use find-file-literally?
>
> Any opinions?

A general solution is to customize image-visiting mode as text
by adding to the init file:

  (push '("\\.svgz?\\'" . image-mode-as-text) auto-mode-alist)

I don't know whether or where this solution could be mentioned more,
but currently this is documented in image-mode-as-text:

  You can use `image-mode-as-text' in `auto-mode-alist' when you want
  to display an image file as text initially.




This bug report was last modified 4 years and 212 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.