From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 19 12:28:47 2021 Received: (at submit) by debbugs.gnu.org; 19 Sep 2021 16:28:47 +0000 Received: from localhost ([127.0.0.1]:39674 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRzgK-0002Tm-TY for submit@debbugs.gnu.org; Sun, 19 Sep 2021 12:28:47 -0400 Received: from lists.gnu.org ([209.51.188.17]:56580) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRzgF-0002TX-Lw for submit@debbugs.gnu.org; Sun, 19 Sep 2021 12:28:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRzgF-0005NG-9Y for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 12:28:39 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:55913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRzgD-00047g-DP for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 12:28:39 -0400 Received: (Authenticated sender: juri@linkov.net) by relay12.mail.gandi.net (Postfix) with ESMTPSA id C1747200002 for ; Sun, 19 Sep 2021 16:28:34 +0000 (UTC) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: eww-retrieve-synchronously Organization: LINKOV.NET Date: Sun, 19 Sep 2021 19:12:39 +0300 Message-ID: <874kagmv98.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=217.70.178.232; envelope-from=juri@linkov.net; helo=relay12.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain Tags: patch This is a spin-off from bug#50497. >> What do you think about supporting synchronous mode in eww? >> When adding a variable that causes eww-retrieve to use >> url-retrieve-synchronously, isearch part could look like this: >> >> (defun eww-isearch-next-buffer (&optional _buffer wrap) >> (let ((eww-synchronous t)) >> (if wrap >> (condition-case nil >> (eww-top-url) >> (error nil)) >> (if isearch-forward >> (eww-next-url) >> (eww-previous-url)))) >> (current-buffer)) > > Sure, makes sense to me. Here is a patch that implements this: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=eww-retrieve-synchronously.patch diff --git a/lisp/net/eww.el b/lisp/net/eww.el index c1202974f4..7ae44fdc71 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -143,11 +143,13 @@ eww-history-limit (defcustom eww-retrieve-command nil "Command to retrieve an URL via an external program. -If nil, `url-retrieve' is used to download the data. If non-nil, -this should be a list where the first item is the program, and -the rest are the arguments." +If nil, `url-retrieve' is used to download the data. +If `sync', `url-retrieve-synchronously' is used. +For other non-nil values, this should be a list where the first item +is the program, and the rest are the arguments." :version "28.1" :type '(choice (const :tag "Use `url-retrieve'" nil) + (const :tag "Use `url-retrieve-synchronously'" sync) (repeat string))) (defcustom eww-use-external-browser-for-content-type @@ -366,9 +368,16 @@ eww (list url nil (current-buffer)))))) (defun eww-retrieve (url callback cbargs) - (if (null eww-retrieve-command) - (url-retrieve url #'eww-render - (list url nil (current-buffer))) + (cond + ((null eww-retrieve-command) + (url-retrieve url #'eww-render + (list url nil (current-buffer)))) + ((eq eww-retrieve-command 'sync) + (let ((orig-buffer (current-buffer)) + (data-buffer (url-retrieve-synchronously url))) + (with-current-buffer data-buffer + (eww-render nil url nil orig-buffer)))) + (t (let ((buffer (generate-new-buffer " *eww retrieve*")) (error-buffer (generate-new-buffer " *eww error*"))) (with-current-buffer buffer @@ -388,7 +397,7 @@ eww-retrieve (with-current-buffer buffer (goto-char (point-min)) (insert "Content-type: text/html; charset=utf-8\n\n") - (apply #'funcall callback nil cbargs)))))))))) + (apply #'funcall callback nil cbargs))))))))))) (function-put 'eww 'browse-url-browser-kind 'internal) @@ -2398,13 +2407,14 @@ eww-restore-desktop (defun eww-isearch-next-buffer (&optional _buffer wrap) "Go to the next page to search using `rel' attribute for navigation." - (if wrap - (condition-case nil - (eww-top-url) - (error nil)) - (if isearch-forward - (eww-next-url) - (eww-previous-url))) + (let ((eww-retrieve-command 'sync)) + (if wrap + (condition-case nil + (eww-top-url) + (error nil)) + (if isearch-forward + (eww-next-url) + (eww-previous-url)))) (current-buffer)) (provide 'eww) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 20 01:49:34 2021 Received: (at 50680) by debbugs.gnu.org; 20 Sep 2021 05:49:34 +0000 Received: from localhost ([127.0.0.1]:40663 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSCBK-00028q-JX for submit@debbugs.gnu.org; Mon, 20 Sep 2021 01:49:34 -0400 Received: from quimby.gnus.org ([95.216.78.240]:57502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSCBI-00028c-64 for 50680@debbugs.gnu.org; Mon, 20 Sep 2021 01:49:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=h/+JHy0KLYBU1H8QqunBHrBvIP5AicveDSEPQMAjWdo=; b=NJ4H9JDHNzPKwDAyTNrUWQ8Smb 5wdxVidyPxoZSENENE1kmdJDxJQDRg4OaZHJyMAsMq5yBja0KpJSGicpaTrgD10UTXjP7G2plvAyP xK8++qAKWpn/DJqPpWfbWlMXLkyq/urg/sValZTb07QPq69p2qy3L9pMzUiZ6YiNamv4=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mSCB8-0005qF-US; Mon, 20 Sep 2021 07:49:25 +0200 From: Lars Ingebrigtsen To: Juri Linkov Subject: Re: bug#50680: eww-retrieve-synchronously References: <874kagmv98.fsf@mail.linkov.net> Date: Mon, 20 Sep 2021 07:49:22 +0200 In-Reply-To: <874kagmv98.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 19 Sep 2021 19:12:39 +0300") Message-ID: <871r5jlrtp.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Juri Linkov writes: > Here is a patch that implements this: I haven't tried the patch, but skimming it, it makes sense to me, so please go ahead and push it. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 50680 Cc: 50680@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Juri Linkov writes: > Here is a patch that implements this: I haven't tried the patch, but skimming it, it makes sense to me, so please go ahead and push it. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 20 03:17:10 2021 Received: (at 50680) by debbugs.gnu.org; 20 Sep 2021 07:17:10 +0000 Received: from localhost ([127.0.0.1]:40880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSDY6-0004N2-F2 for submit@debbugs.gnu.org; Mon, 20 Sep 2021 03:17:10 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:56209) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSDY4-0004Gp-S9; Mon, 20 Sep 2021 03:17:09 -0400 Received: (Authenticated sender: juri@linkov.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id E1C061C000F; Mon, 20 Sep 2021 07:17:00 +0000 (UTC) From: Juri Linkov To: Lars Ingebrigtsen Subject: Re: bug#50680: eww-retrieve-synchronously Organization: LINKOV.NET References: <874kagmv98.fsf@mail.linkov.net> <871r5jlrtp.fsf@gnus.org> Date: Mon, 20 Sep 2021 10:16:27 +0300 In-Reply-To: <871r5jlrtp.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 20 Sep 2021 07:49:22 +0200") Message-ID: <87a6k7n2d1.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 50680 Cc: 50680@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) tags 50680 fixed close 50680 28.0.50 quit >> Here is a patch that implements this: > > I haven't tried the patch, but skimming it, it makes sense to me, so > please go ahead and push it. Now pushed. From unknown Sun Sep 21 05:09:15 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 18 Oct 2021 11:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator