From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.bugs Subject: bug#19225: eww-render: runs eww-after-render-hook in the (temporary) data buffer Date: Sun, 30 Nov 2014 09:59:10 +0000 Message-ID: <87tx1hnh5d.fsf_-_@violet.siamics.net> References: <87fvpmwint.fsf@violet.siamics.net> <87eh56dkdo.fsf@flea.lifelogs.com> <87d2knaf08.fsf@flea.lifelogs.com> <87a9fqy8q9.fsf@building.gnus.org> <871u12tyz8.fsf@violet.siamics.net> <87d28j8z67.fsf@violet.siamics.net> <87k32r7fje.fsf@violet.siamics.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1417341633 5326 80.91.229.3 (30 Nov 2014 10:00:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Nov 2014 10:00:33 +0000 (UTC) To: 19225@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 30 11:00:28 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xv1Ip-000372-ND for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Nov 2014 11:00:27 +0100 Original-Received: from localhost ([::1]:50033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xv1Ip-00049k-BL for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Nov 2014 05:00:27 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xv1Ie-00049O-Kq for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 05:00:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xv1IV-0003yh-Jl for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 05:00:16 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xv1IT-0003tl-Rr for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 05:00:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xv1IT-0002Nb-Bw for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 05:00:05 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Nov 2014 10:00:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19225 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: submit@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14173415869086 (code B ref -1); Sun, 30 Nov 2014 10:00:04 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Nov 2014 09:59:46 +0000 Original-Received: from localhost ([127.0.0.1]:49563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xv1I6-0002MO-EX for submit@debbugs.gnu.org; Sun, 30 Nov 2014 04:59:46 -0500 Original-Received: from fely.am-1.org ([78.47.74.50]:42913) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xv1Hz-0002M9-99 for submit@debbugs.gnu.org; Sun, 30 Nov 2014 04:59:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=yH5htW/v8Bo3S8XXwuVSxGWMhF2Z37vtrrPxfEZnReI=; b=lfY5ZDymrlrFlpHhDEpX4SIiCoLj7dvRwDY8IDdoC6OTm2cNYg511eRChSmmtJzXu+JjYpGidQzYlNTjWN4MklqfQ6uigOO7qzNHnpZ8YamOoP18eqR3K2uHh5MEkrIrSOpAyfwtmlzP0iSpgibkq/MnN7w3RpjwD8kGXIg5KfU=; Original-Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Xv1Hi-0006xL-8V for submit@debbugs.gnu.org; Sun, 30 Nov 2014 09:59:18 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Xv1Ha-0004EY-RY for submit@debbugs.gnu.org; Sun, 30 Nov 2014 16:59:10 +0700 In-Reply-To: (Lars Magne Ingebrigtsen's message of "Wed, 19 Nov 2014 18:41:37 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:96751 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Package: emacs >>>>> Lars Magne Ingebrigtsen writes: >>>>> Ivan Shmakov writes: [=E2=80=A6] >> 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=E2=80= =99m >> 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) =E2=80=A6 287 (let* ((headers (eww-parse-headers)) =E2=80=A6 298 (data-buffer (current-buffer))) 299 (unwind-protect 300 (progn =E2=80=A6 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=E2=80=99s 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: # There=E2=80=99re two obvious ways to deal with the issues with eww-data and eww-history-position: =E2=80=A2 they could be wrapped into a (with-current-buffer buffer =E2=80= =A6) form in eww-render; =E2=80=A2 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=E2=80=99d rather prefer having some easy way to access /either/ of the buffers from the functions referenced. For instance, I=E2=80=99d 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 =E2=80=9Ccore,=E2=80=9D so doing it from the hook looks sensibl= e.) --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A --=-=-= Content-Type: text/plain Content-Disposition: inline commit 6fd82d61a2b82e772e8cde0e04516f5c3ca98ed3 Author: Lars Magne Ingebrigtsen 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. --=-=-=--