all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: gjadi@omecha.info (Grégoire Jadi)
To: Emacs Devel <emacs-devel@gnu.org>
Subject: [PATCH] Search for image from the beginning of the fetched buffer
Date: Sat, 22 Jul 2017 12:09:28 +0200	[thread overview]
Message-ID: <87r2x8u6jr.fsf@omecha.info> (raw)

Hi,

Some background : When browsing files locally (file://) images are never
rendered right the first time by eww/shr. I have to use redisplay
(`eww-redisplay') to display the images.
In the *Message* buffer, I've the following error :
> ImageMagick error: no decode delegate for this image format `' @ error/blob.c/BlobToImage/353

After a bit of lurking, I found out that the image where correctly
restored from the cache, because it starts to parse at position 1.
However, the position in the buffer in `shr-image-fetched' is something
else >1. I haven't figured out why the position isn't right (I suspect
something in `url-file').

The fix I've found so far is to force position 1 in `shr-image-fetched'.
I've also disabled multibyte because `shr-get-image-data' does it, but
it might be unnecessary.
Patch below.

Best,

PS: I've FSF copyright assignment number #793656

* lisp/net/shr.el (shr-image-fetched): Disable multibyte and go back
  to the beginning of the buffer before trying to parse the image
  fetched.
---
 lisp/net/shr.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 4d4e8a809e..b4dd60cf48 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -945,6 +945,8 @@ shr-image-fetched
     (when (and (buffer-name buffer)
 	       (not (plist-get status :error)))
       (url-store-in-cache image-buffer)
+      (goto-char (point-min))
+      (mm-disable-multibyte)
       (when (or (search-forward "\n\n" nil t)
 		(search-forward "\r\n\r\n" nil t))
 	(let ((data (shr-parse-image-data)))
-- 
2.13.1



             reply	other threads:[~2017-07-22 10:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-22 10:09 Grégoire Jadi [this message]
2017-07-24 15:30 ` [PATCH] Search for image from the beginning of the fetched buffer Lars Ingebrigtsen
2017-07-24 16:42   ` Grégoire Jadi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r2x8u6jr.fsf@omecha.info \
    --to=gjadi@omecha.info \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.