GNU bug report logs - #19225
eww-render: runs eww-after-render-hook in the (temporary) data buffer

Previous Next

Package: emacs;

Reported by: Ivan Shmakov <ivan <at> siamics.net>

Date: Sun, 30 Nov 2014 10:00:04 UTC

Severity: normal

Tags: fixed, patch

Merged with 19227

Found in version 25.0.50

Fixed in version 25.1

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ivan Shmakov <ivan <at> siamics.net>
To: 19225 <at> debbugs.gnu.org, control <at> debbugs.gnu.org
Subject: bug#19225: eww-render: runs eww-after-render-hook in the (temporary) data buffer 
Date: Sun, 30 Nov 2014 10:45:46 +0000
[Message part 1 (text/plain, inline)]
tags 19225 + patch
thanks

>>>>> Ivan Shmakov <ivan <at> siamics.net> writes:
>>>>> Lars Magne Ingebrigtsen <larsi <at> gnus.org> writes:
>>>>> Ivan Shmakov <ivan <at> siamics.net> writes:

[…]

 >>> The plist-put calls down that progn are evaluated after
 >>> eww-display-*, and thus after either eww-setup-buffer or some other
 >>> set-buffer.  The eww-use-external-browser-for-content-type case I’m
 >>> unsure about, though.

 >> I've now removed the statement.

 > Following the change for eww-display-* /not/ to change the
 > current buffer ($ git log entry MIMEd), those forms are now also
 > evaluated in the data buffer.

	… As well as a couple of eww-update-header-line-format calls.

	Please consider the patch MIMEd.  This one doesn’t pass the data
	buffer to eww-after-render-hook, and I hope this still could be
	resolved a bit later.

	* eww.el (eww-render): Call eww-update-header-line-format
	unconditionally and in the browsing buffer (was: data buffer);
	change eww-data and eww-history-position for the browsing
	buffer, and run eww-after-render-hook there, too.
	(eww-display-html): Do not call eww-update-header-line-format or
	change eww-data, eww-history-position (now done in eww-render.)

   283	(defun eww-render (status url &optional point buffer encode)
…
   287	  (let* ((headers (eww-parse-headers))
…
   298		 (data-buffer (current-buffer)))
   299	    (unwind-protect
   300		(progn
   301		  (cond
…
   310		   ((string-match-p "\\`image/" (car content-type))
   311		    (eww-display-image buffer)
   312		    (eww-update-header-line-format))
   313		   (t
   314		    (eww-display-raw buffer encode)
   315		    (eww-update-header-line-format)))
   316		  (plist-put eww-data :url url)
   317		  (setq eww-history-position 0)
   318		  (run-hooks 'eww-after-render-hook))
   319	      (kill-buffer data-buffer))))

[…]

-- 
FSF associate member #7257  np. Surrender — Jami Sieber … 3013 B6A0 230E 334A
[Message part 2 (text/diff, inline)]
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -308,14 +315,14 @@ defun eww-render (status url &optional point buffer encode)
 	   ((equal (car content-type) "application/pdf")
 	    (eww-display-pdf))
 	   ((string-match-p "\\`image/" (car content-type))
-	    (eww-display-image buffer)
-	    (eww-update-header-line-format))
+	    (eww-display-image buffer))
 	   (t
-	    (eww-display-raw buffer encode)
-	    (eww-update-header-line-format)))
-	  (plist-put eww-data :url url)
-	  (setq eww-history-position 0)
-	  (run-hooks 'eww-after-render-hook))
+	    (eww-display-raw buffer encode)))
+	  (with-current-buffer buffer
+	    (plist-put eww-data :url url)
+	    (eww-update-header-line-format)
+	    (setq eww-history-position 0)
+	    (run-hooks 'eww-after-render-hook)))
       (kill-buffer data-buffer))))
 
 (defun eww-parse-headers ()
@@ -403,10 +411,7 @@ defun eww-display-html (charset url &optional document point buffer encode)
 	  (while (and (not (eobp))
 		      (get-text-property (point) 'eww-form))
 	    (forward-line 1)))))
-      (plist-put eww-data :url url)
-      (setq eww-history-position 0)
-      (eww-size-text-inputs)
-      (eww-update-header-line-format))))
+      (eww-size-text-inputs))))
 
 (defun eww-handle-link (dom)
   (let* ((rel (dom-attr dom 'rel))

This bug report was last modified 10 years and 173 days ago.

Previous Next


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