all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ivan Shmakov <ivan@siamics.net>
To: 19225@debbugs.gnu.org
Subject: bug#19225: eww-render: runs eww-after-render-hook in the (temporary) data buffer
Date: Sun, 30 Nov 2014 09:59:10 +0000	[thread overview]
Message-ID: <87tx1hnh5d.fsf_-_@violet.siamics.net> (raw)
In-Reply-To: <m3y4r72ilq.fsf@stories.gnus.org> (Lars Magne Ingebrigtsen's message of "Wed, 19 Nov 2014 18:41:37 +0100")

[-- Attachment #1: Type: text/plain, Size: 2100 bytes --]

Package:  emacs

>>>>> Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
>>>>> Ivan Shmakov <ivan@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.

   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
…
   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))))

	What’s even worse is that the call to eww-after-render-hook is
	among them, and thus the code there has no (easy) way of finding
	the EWW buffer proper; consider, e. g.:

(add-hook 'eww-after-render-hook
          (lambda () (message "Called in: %S" (current-buffer))))

Called in: #<buffer  *http my.proxy.example:3128*>

	There’re two obvious ways to deal with the issues with eww-data
	and eww-history-position:

	• they could be wrapped into a (with-current-buffer buffer …)
	  form in eww-render;

	• or they could be moved from there to eww-display-raw, -image,
	  and -pdf; (eww-display-html already has them.)

	The eww-after-render-hook case is a bit trickier, as I’d rather
	prefer having some easy way to access /either/ of the buffers
	from the functions referenced.  For instance, I’d like to have a
	way to capture the HTTP header and provide a command to present
	it to the user when asked.  (I doubt this feature really belongs
	to the EWW “core,” so doing it from the hook looks sensible.)

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A

[-- Attachment #2: Type: text/plain, Size: 459 bytes --]

commit 6fd82d61a2b82e772e8cde0e04516f5c3ca98ed3
Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
Date:   Sun Nov 23 17:22:41 2014 +0100

    Switch to the *eww* buffer immediately to avoid doing it asynchronously
    
    (eww): Pop to the *eww* buffer immediately after executing the
    `M-x eww' command to avoid having buffers pop up later.
    (eww-display-html): Don't pop the *eww* buffer.
    (eww-display-raw): Ditto.
    (eww-display-image): Ditto.

  reply	other threads:[~2014-11-30  9:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-21 11:24 bug#16211: eww should support multiple *eww* buffers Ivan Shmakov
2013-12-21 20:22 ` Ted Zlatanov
2013-12-21 21:51   ` Ivan Shmakov
2013-12-22 22:36     ` Ted Zlatanov
2014-07-06 19:05       ` Ivan Shmakov
2014-11-04 16:42         ` Ted Zlatanov
2013-12-23  3:21   ` Stefan Monnier
2013-12-23 13:11     ` Ted Zlatanov
2013-12-23 18:19       ` Ivan Shmakov
2013-12-23 19:01         ` Glenn Morris
2013-12-24  8:05       ` Lars Ingebrigtsen
2013-12-24  8:49         ` Ivan Shmakov
2014-11-10 21:18           ` Lars Magne Ingebrigtsen
2014-11-19  6:47             ` Ivan Shmakov
2014-11-19  8:36               ` Ivan Shmakov
2014-11-19 17:41                 ` Lars Magne Ingebrigtsen
2014-11-30  9:59                   ` Ivan Shmakov [this message]
2014-11-30 10:45                     ` bug#19225: eww-render: runs eww-after-render-hook in the (temporary) data buffer Ivan Shmakov
2014-12-01 17:56                       ` Lars Magne Ingebrigtsen
2014-11-19 17:38               ` bug#16211: eww should support multiple *eww* buffers Lars Magne Ingebrigtsen

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=87tx1hnh5d.fsf_-_@violet.siamics.net \
    --to=ivan@siamics.net \
    --cc=19225@debbugs.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.