GNU bug report logs - #21870
25.0.50; image now shown after decrypting image file

Previous Next

Package: emacs;

Reported by: Dirk-Jan C. Binnema <djcb <at> djcbsoftware.nl>

Date: Tue, 10 Nov 2015 08:35:02 UTC

Severity: normal

Found in version 25.0.50

Done: Daiki Ueno <ueno <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Daiki Ueno <ueno <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "Dirk-Jan C. Binnema" <djcb <at> djcbsoftware.nl>, 21870 <at> debbugs.gnu.org
Subject: bug#21870: 25.0.50; image now shown after decrypting image file
Date: Mon, 16 Nov 2015 15:10:11 +0900
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> >> It seems the auto-decryption functionality does not work correctly for
>> >> encrypted images - that is, decryption works, but then the image is not
>> >> shown.
>> >> 
>> >> Steps to reproduce:
>> >> 1) Open an encrypted image file (say, test.jpeg.gpg)
>> >> 2) Enter the passphrase, when asked (by easypg I assume)
>> >> 3) Now, see a small rectangle in the upper left of the current window;
>> >>    instead of the expected image
>> >> 
>> >> Expected behavior would be to see the image, just as if opening
>> >> test.jpeg directly.
>> >
>> > If you do the same with a different kind of file, does Emacs activate
>> > the correct major mode after decrypting the file?
>> 
>> Yes - e.g. opening test.org.gpg will decrypt, then activate org-mode.
>> 
>> (and note that this is reproducible with emacs -Q)
>
> Looks like epa-file.el doesn't run normal-mode after decrypting the
> file?

Thanks for forwarding.  Hmm, it seems that normal-mode is actually
called, but image-mode tries to load the contents from the file, not
from the buffer.  Does the following hack look correct?

(It seems reading test.jpeg.gz works because ImageMagick supports
compressed files.)

Regards,
-- 
Daiki Ueno
[image-mode.el.diff (text/x-patch, inline)]
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index e6d6a3e..12c8b95 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -658,7 +658,11 @@ image-toggle-display-image
 			   (not (and (boundp 'archive-superior-buffer)
 				     archive-superior-buffer))
 			   (not (and (boundp 'tar-superior-buffer)
-				     tar-superior-buffer)))))
+				     tar-superior-buffer))
+                           (not (eq (find-file-name-handler
+                                     filename
+                                     'insert-file-contents)
+                                    'epa-file-handler)))))
 	 (file-or-data (if data-p
 			   (string-make-unibyte
 			    (buffer-substring-no-properties (point-min) (point-max)))

This bug report was last modified 9 years and 186 days ago.

Previous Next


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