From unknown Thu Jun 19 14:17:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77967: [PATCH] Fallback `eww-switch-to-buffer' to `eww' Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: larsi@gnus.org, bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Apr 2025 17:45:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 77967 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 77967@debbugs.gnu.org Cc: Lars Magne Ingebrigtsen X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Lars Magne Ingebrigtsen Received: via spool by submit@debbugs.gnu.org id=B.174525745512299 (code B ref -1); Mon, 21 Apr 2025 17:45:03 +0000 Received: (at submit) by debbugs.gnu.org; 21 Apr 2025 17:44:15 +0000 Received: from localhost ([127.0.0.1]:38025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u6vBm-0003CI-T3 for submit@debbugs.gnu.org; Mon, 21 Apr 2025 13:44:15 -0400 Received: from lists.gnu.org ([2001:470:142::17]:55480) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u6vBh-0003Bx-5w for submit@debbugs.gnu.org; Mon, 21 Apr 2025 13:44:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u6vBZ-00037S-0T for bug-gnu-emacs@gnu.org; Mon, 21 Apr 2025 13:44:01 -0400 Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u6vBV-0004Pd-Hv for bug-gnu-emacs@gnu.org; Mon, 21 Apr 2025 13:44:00 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=mM05KffG eIQNoiltvH6aGmQEABTvfxy6sveRdgD/2MA=; h=date:subject:to:from; d=ledu-giraud.fr; b=OYkWIOQ5/oBOn5rTFH8R2mkaTiu9/InUIDgY5hcqXOov9QtHHX 2ZrPu1nG2NYrfCnmQRudortjR1FeR3IQJmAg== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=mM05KffGeIQNoilt vH6aGmQEABTvfxy6sveRdgD/2MA=; h=date:subject:to:from; d=ledu-giraud.fr; b=e+5VXdBJCtoAW23IPz/54nOFgffzkVllvnZkprrcPOkey/KvxN eV+vDyP+1uMD/FM3wFlVZOgaUeE/FBDRCa+P7dvSG8YNkVQFdC3l68W20y++/S0o5W66qJ ALEK5lkgiSA6WskIYuAS0ujDDeT82FZ4Iddps7It7SGDmKLS60OTLZ41s+f3GbaRojAftU hlkrHAVphYY4wkvRBME1TCMxJ6c39QVll8hy9CzjItTlaDA/YQNl8Z2bxedSqSFLcf2ENq EFgqDyXptflGYEKDT2wGdPCWCWrzhSrINbk6u/YYAmqekQdShr8JvEegoH0P3rexWNZTND WRfw44dmxKMA== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 671fdecc (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Mon, 21 Apr 2025 19:43:48 +0200 (CEST) From: Manuel Giraud Date: Mon, 21 Apr 2025 19:43:47 +0200 Message-ID: <87jz7d1kbw.fsf@ledu-giraud.fr> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) 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: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch Hi, The following patch calls `eww' interactively from `eww-switch-to-buffer' when there is no EWW buffers. Then, one can set a global shortcut on `eww-switch-to-buffer' and always be able to launch EWW. Thanks, In GNU Emacs 31.0.50 (build 5, x86_64-unknown-openbsd7.7, X toolkit) of 2025-04-20 built on computer Repository revision: b38fd553eb3291f140801ca158f6ab245496fa69 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101016 System Description: OpenBSD computer 7.7 GENERIC.MP#625 amd64 Configured using: 'configure CC=egcc CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs --bindir=/home/manuel/bin --with-x-toolkit=lucid --with-toolkit-scroll-bars=no --without-cairo --without-compress-install' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Fallback-eww-switch-to-buffer-to-eww.patch >From d63d4cacdd6bf9b9cbfff43cb07d3268f969bd25 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Mon, 21 Apr 2025 19:01:25 +0200 Subject: [PATCH] Fallback `eww-switch-to-buffer' to `eww' * lisp/net/eww.el (eww-switch-to-buffer): When no EWW buffers exist, call `eww' instead. --- lisp/net/eww.el | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 7edd1acbcf9..63425882583 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -2321,25 +2321,29 @@ eww-set-character-encoding (eww-reload nil charset))) (defun eww-switch-to-buffer () - "Prompt for an EWW buffer to display in the selected window." + "Prompt for an EWW buffer to display in the selected window. If no such +buffer exist, fallback to calling `eww'." (interactive nil eww-mode) (let ((completion-extra-properties `(:annotation-function ,(lambda (buf) (with-current-buffer buf (format " %s" (eww-current-url)))))) - (curbuf (current-buffer))) - (pop-to-buffer-same-window - (read-buffer "Switch to EWW buffer: " - (cl-loop for buf in (nreverse (buffer-list)) + (curbuf (current-buffer)) + (list (cl-loop for buf in (nreverse (buffer-list)) if (with-current-buffer buf (derived-mode-p 'eww-mode)) - return buf) - t - (lambda (bufn) - (setq bufn (if (consp bufn) (cdr bufn) (get-buffer bufn))) - (and (with-current-buffer bufn - (derived-mode-p 'eww-mode)) - (not (eq bufn curbuf)))))))) + return buf))) + (if list + (pop-to-buffer-same-window + (read-buffer "Switch to EWW buffer: " + list + t + (lambda (bufn) + (setq bufn (if (consp bufn) (cdr bufn) (get-buffer bufn))) + (and (with-current-buffer bufn + (derived-mode-p 'eww-mode)) + (not (eq bufn curbuf)))))) + (call-interactively 'eww)))) (defun eww-toggle-fonts () "Toggle whether to use monospaced or font-enabled layouts." -- 2.49.0 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=-- From unknown Thu Jun 19 14:17:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77967: [PATCH] Fallback `eww-switch-to-buffer' to `eww' Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Apr 2025 13:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77967 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Manuel Giraud Cc: 77967@debbugs.gnu.org, larsi@gnus.org Received: via spool by 77967-submit@debbugs.gnu.org id=B77967.174567254217655 (code B ref 77967); Sat, 26 Apr 2025 13:03:01 +0000 Received: (at 77967) by debbugs.gnu.org; 26 Apr 2025 13:02:22 +0000 Received: from localhost ([127.0.0.1]:59331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u8fAj-0004ag-NG for submit@debbugs.gnu.org; Sat, 26 Apr 2025 09:02:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34196) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u8fAh-0004aS-AI for 77967@debbugs.gnu.org; Sat, 26 Apr 2025 09:02:20 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u8fAb-0001pG-F6; Sat, 26 Apr 2025 09:02:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=2RlnkzseVJLlPkQ48UvqdWohaqgWN33Q2ROVjWBwJac=; b=PsaWeyA6nGey trZ1FIaj086Ai+NEl/Y/qAuZ1m0nWo4qgnGuHeuFKC9S+13FyUrdt25ZBKRA/nu9mUtf+47XGVcv5 yCymuIbLjwlAF0eeL/UJCn7RX+X4l5Gder2DUtFP2f7WZTwaQbNpQJcVAiSTNG4aSZQu9W/ErXJzf EpFtUaQVN27+9a91wBR5JqzUHgaUQakvnHBHdIiGj1skhmXkks0iyHnQSdP3DeNq0Zb9FBKvgkbJh BkB0OAwvGXE6kNP0drUB0iYbtFHvL7X+Hdk3kBdQdUQVbxaFR61oW0wuoucTsXF+t3o5tZsmyVdh4 0eW98A3EUoH1ZMEKrhdN+A==; Date: Sat, 26 Apr 2025 16:02:08 +0300 Message-Id: <86r01ft6sv.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87jz7d1kbw.fsf@ledu-giraud.fr> (message from Manuel Giraud on Mon, 21 Apr 2025 19:43:47 +0200) References: <87jz7d1kbw.fsf@ledu-giraud.fr> X-Spam-Score: -2.3 (--) 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 (---) > Cc: Lars Magne Ingebrigtsen > From: Manuel Giraud > Date: Mon, 21 Apr 2025 19:43:47 +0200 > > The following patch calls `eww' interactively from > `eww-switch-to-buffer' when there is no EWW buffers. Then, one can set > a global shortcut on `eww-switch-to-buffer' and always be able to launch > EWW. Thanks. > (defun eww-switch-to-buffer () > - "Prompt for an EWW buffer to display in the selected window." > + "Prompt for an EWW buffer to display in the selected window. If no such > +buffer exist, fallback to calling `eww'." The first line of a doc string should be a single complete sentence. Doesn't this change warrant a NEWS entry, and a suitable change to the EWW manual? From unknown Thu Jun 19 14:17:26 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77967: [PATCH] Fallback `eww-switch-to-buffer' to `eww' Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Apr 2025 11:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77967 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 77967@debbugs.gnu.org, larsi@gnus.org Received: via spool by 77967-submit@debbugs.gnu.org id=B77967.17457521455356 (code B ref 77967); Sun, 27 Apr 2025 11:10:02 +0000 Received: (at 77967) by debbugs.gnu.org; 27 Apr 2025 11:09:05 +0000 Received: from localhost ([127.0.0.1]:39647 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u8zse-0001OK-Ur for submit@debbugs.gnu.org; Sun, 27 Apr 2025 07:09:05 -0400 Received: from ledu-giraud.fr ([51.159.28.247]:16000) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u8zsa-0001Nj-Uc for 77967@debbugs.gnu.org; Sun, 27 Apr 2025 07:09:02 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=VQtOO350 7puF433xlrakJWBRjwJ3RM5Shf37nUW7I+U=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=kEh9C5txkNDPZg6I1riLDTcc+Fewao 8APPqk44mW7oxKsi8kd7EtePK14JtaHkWsERKa9aG3LSrBbji+J15gBQ== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=VQtOO3507puF433x lrakJWBRjwJ3RM5Shf37nUW7I+U=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=O6vpZX0UU824+d7bGJDOoSzlYU+6k3HHCUWCSN RjW/FML18zbuDT9xqE6H66qtFXPyZ6Qvt0Qjtm5rV8FJtNxavE1mMTeFwBLD7UZoSQO/LY 7wCSImbr5UNZxfMfAsXjY2Qlh4rpeUwW/07dab7z20XHLvRy79knaWwz8qwd/4Fdt891R1 PBQDxa5vwTgqJ9b/OLT9PjREFubrU/pbD+4sSCg0diorHt2DSEJVaHgmFH/wyik3w9Vjd7 A1TR1q7P88takVscE58246xmCloTy/OTpv6rbpFgwASfwNxLRX9vggxX/vf6G/401kxuh8 C+sIzvE1L1/HTTPtv+YNlqtQ== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 28ac71bf (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 27 Apr 2025 13:08:58 +0200 (CEST) From: Manuel Giraud In-Reply-To: <86r01ft6sv.fsf@gnu.org> References: <87jz7d1kbw.fsf@ledu-giraud.fr> <86r01ft6sv.fsf@gnu.org> Date: Sun, 27 Apr 2025 13:08:57 +0200 Message-ID: <87a581svxy.fsf@ledu-giraud.fr> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) 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.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> Cc: Lars Magne Ingebrigtsen >> From: Manuel Giraud >> Date: Mon, 21 Apr 2025 19:43:47 +0200 >> >> The following patch calls `eww' interactively from >> `eww-switch-to-buffer' when there is no EWW buffers. Then, one can set >> a global shortcut on `eww-switch-to-buffer' and always be able to launch >> EWW. > > Thanks. > >> (defun eww-switch-to-buffer () >> - "Prompt for an EWW buffer to display in the selected window." >> + "Prompt for an EWW buffer to display in the selected window. If no such >> +buffer exist, fallback to calling `eww'." > > The first line of a doc string should be a single complete sentence. > > Doesn't this change warrant a NEWS entry, and a suitable change to the > EWW manual? Thanks. Here is a new patch. While here, I also modified `eww-list-buffers' to not pop to *eww-buffers* when there is no such buffer. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fallback-eww-switch-to-buffer-to-eww.patch >From f8235beab112226cbe8bf43e30fcb31935824911 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Mon, 21 Apr 2025 19:01:25 +0200 Subject: [PATCH] Fallback `eww-switch-to-buffer' to `eww' * lisp/net/eww.el (eww-switch-to-buffer): When no EWW buffers exist, call `eww' instead. (eww-list-buffers): Do not pop to *eww buffers* when there is no EWW buffers. --- doc/misc/eww.texi | 3 +++ etc/NEWS | 5 +++++ lisp/net/eww.el | 38 ++++++++++++++++++++++---------------- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index 5be59972811..d092fc1f230 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -259,6 +259,9 @@ Basics switch EWW buffers through a minibuffer prompt, press @kbd{s} (@code{eww-switch-to-buffer}). +The @code{eww-switch-to-buffer} command will fallback to @code{eww} +when there is no EWW buffers. + @findex eww-browse-with-external-browser @vindex browse-url-secondary-browser-function @vindex eww-use-external-browser-for-content-type diff --git a/etc/NEWS b/etc/NEWS index 56a45068daf..787ab606276 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1214,6 +1214,11 @@ content-type of Web pages which don't have a valid 'Content-Type' header. The default value is a function that considers a page with an HTML 'doctype' declaration to have context-type "text/html". ++++ +*** 'eww-switch-to-buffer' falls back to 'eww'. +When there is no EWW buffers, 'eww-switch-to-buffer' falls back to +calling 'eww'. + ** CC mode +++ diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 7edd1acbcf9..c11e378c714 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -2321,25 +2321,29 @@ eww-set-character-encoding (eww-reload nil charset))) (defun eww-switch-to-buffer () - "Prompt for an EWW buffer to display in the selected window." + "Prompt for an EWW buffer to display in the selected window. +If no such buffer exist, fallback to calling `eww'." (interactive nil eww-mode) (let ((completion-extra-properties `(:annotation-function ,(lambda (buf) (with-current-buffer buf (format " %s" (eww-current-url)))))) - (curbuf (current-buffer))) - (pop-to-buffer-same-window - (read-buffer "Switch to EWW buffer: " - (cl-loop for buf in (nreverse (buffer-list)) + (curbuf (current-buffer)) + (list (cl-loop for buf in (nreverse (buffer-list)) if (with-current-buffer buf (derived-mode-p 'eww-mode)) - return buf) - t - (lambda (bufn) - (setq bufn (if (consp bufn) (cdr bufn) (get-buffer bufn))) - (and (with-current-buffer bufn - (derived-mode-p 'eww-mode)) - (not (eq bufn curbuf)))))))) + return buf))) + (if list + (pop-to-buffer-same-window + (read-buffer "Switch to EWW buffer: " + list + t + (lambda (bufn) + (setq bufn (if (consp bufn) (cdr bufn) (get-buffer bufn))) + (and (with-current-buffer bufn + (derived-mode-p 'eww-mode)) + (not (eq bufn curbuf)))))) + (call-interactively 'eww)))) (defun eww-toggle-fonts () "Toggle whether to use monospaced or font-enabled layouts." @@ -2718,10 +2722,12 @@ eww-buffer-list (defun eww-list-buffers () "Pop a buffer with a list of eww buffers." (interactive) - (with-current-buffer (get-buffer-create "*eww buffers*") - (eww-buffers-mode) - (eww--list-buffers-display-table)) - (pop-to-buffer "*eww buffers*")) + (if (null (eww-buffer-list)) + (message "No EWW buffers.") + (with-current-buffer (get-buffer-create "*eww buffers*") + (eww-buffers-mode) + (eww--list-buffers-display-table)) + (pop-to-buffer "*eww buffers*"))) (defun eww--list-buffers-display-table (&optional _ignore-auto _noconfirm) "Display a table with the list of eww buffers. -- 2.49.0 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=-- From unknown Thu Jun 19 14:17:26 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Manuel Giraud Subject: bug#77967: closed (Re: bug#77967: [PATCH] Fallback `eww-switch-to-buffer' to `eww') Message-ID: References: <86wmaoajay.fsf@gnu.org> <87jz7d1kbw.fsf@ledu-giraud.fr> X-Gnu-PR-Message: they-closed 77967 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 77967@debbugs.gnu.org Date: Sat, 10 May 2025 09:48:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1746870482-3572-1" This is a multi-part message in MIME format... ------------=_1746870482-3572-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #77967: [PATCH] Fallback `eww-switch-to-buffer' to `eww' which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 77967@debbugs.gnu.org. --=20 77967: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77967 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1746870482-3572-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 77967-done) by debbugs.gnu.org; 10 May 2025 09:48:01 +0000 Received: from localhost ([127.0.0.1]:44047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uDgoK-0000vN-RH for submit@debbugs.gnu.org; Sat, 10 May 2025 05:48:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43562) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uDgoH-0000v9-Dg for 77967-done@debbugs.gnu.org; Sat, 10 May 2025 05:47:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uDgoC-00032K-19; Sat, 10 May 2025 05:47:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=b+Uc0yLQxY06ZUj2AKtd/lIa3mDvcmeeKU8rlShfvPE=; b=LoXj5WjuwnNx Z8d3ZPc1uXEE+3tAbIlY9zpVWHwHRPkPz5nhHLSH9v4CPB4/1LLbm7h2SsKQMEXaDMal3RnevWmZw UO4YR8mbbMCXu3SfE+V0qf+H4I2mEKgMZEXXyDv4D9Y70OezaLynQGSXrkxeDJZ27kLZE5l1NCJJe s03ZrcRnQZfAku+AL/jd4vXxELGpU3BgBdW0ZWdgiRCHu3XTOzoracr2nr0XNv76Oz0R41luOl/KS wnVU+2FOORRfe4yPPGRWniBxFCzPlYUM4VyYmCD1C2XcC2I13vfXlPDY/EtE8sndnFu/TeIMrksrw QXtitLuB1MG6zKMyLs/gmg==; Date: Sat, 10 May 2025 12:47:49 +0300 Message-Id: <86wmaoajay.fsf@gnu.org> From: Eli Zaretskii To: Manuel Giraud In-Reply-To: <87a581svxy.fsf@ledu-giraud.fr> (message from Manuel Giraud on Sun, 27 Apr 2025 13:08:57 +0200) Subject: Re: bug#77967: [PATCH] Fallback `eww-switch-to-buffer' to `eww' References: <87jz7d1kbw.fsf@ledu-giraud.fr> <86r01ft6sv.fsf@gnu.org> <87a581svxy.fsf@ledu-giraud.fr> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77967-done Cc: larsi@gnus.org, 77967-done@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 (---) > From: Manuel Giraud > Cc: 77967@debbugs.gnu.org, larsi@gnus.org > Date: Sun, 27 Apr 2025 13:08:57 +0200 > > Eli Zaretskii writes: > > >> Cc: Lars Magne Ingebrigtsen > >> From: Manuel Giraud > >> Date: Mon, 21 Apr 2025 19:43:47 +0200 > >> > >> The following patch calls `eww' interactively from > >> `eww-switch-to-buffer' when there is no EWW buffers. Then, one can set > >> a global shortcut on `eww-switch-to-buffer' and always be able to launch > >> EWW. > > > > Thanks. > > > >> (defun eww-switch-to-buffer () > >> - "Prompt for an EWW buffer to display in the selected window." > >> + "Prompt for an EWW buffer to display in the selected window. If no such > >> +buffer exist, fallback to calling `eww'." > > > > The first line of a doc string should be a single complete sentence. > > > > Doesn't this change warrant a NEWS entry, and a suitable change to the > > EWW manual? > > Thanks. Here is a new patch. While here, I also modified > `eww-list-buffers' to not pop to *eww-buffers* when there is no such > buffer. Thanks, installed on the master branch, and closing the bug. ------------=_1746870482-3572-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 21 Apr 2025 17:44:15 +0000 Received: from localhost ([127.0.0.1]:38025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u6vBm-0003CI-T3 for submit@debbugs.gnu.org; Mon, 21 Apr 2025 13:44:15 -0400 Received: from lists.gnu.org ([2001:470:142::17]:55480) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u6vBh-0003Bx-5w for submit@debbugs.gnu.org; Mon, 21 Apr 2025 13:44:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u6vBZ-00037S-0T for bug-gnu-emacs@gnu.org; Mon, 21 Apr 2025 13:44:01 -0400 Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u6vBV-0004Pd-Hv for bug-gnu-emacs@gnu.org; Mon, 21 Apr 2025 13:44:00 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=mM05KffG eIQNoiltvH6aGmQEABTvfxy6sveRdgD/2MA=; h=date:subject:to:from; d=ledu-giraud.fr; b=OYkWIOQ5/oBOn5rTFH8R2mkaTiu9/InUIDgY5hcqXOov9QtHHX 2ZrPu1nG2NYrfCnmQRudortjR1FeR3IQJmAg== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=mM05KffGeIQNoilt vH6aGmQEABTvfxy6sveRdgD/2MA=; h=date:subject:to:from; d=ledu-giraud.fr; b=e+5VXdBJCtoAW23IPz/54nOFgffzkVllvnZkprrcPOkey/KvxN eV+vDyP+1uMD/FM3wFlVZOgaUeE/FBDRCa+P7dvSG8YNkVQFdC3l68W20y++/S0o5W66qJ ALEK5lkgiSA6WskIYuAS0ujDDeT82FZ4Iddps7It7SGDmKLS60OTLZ41s+f3GbaRojAftU hlkrHAVphYY4wkvRBME1TCMxJ6c39QVll8hy9CzjItTlaDA/YQNl8Z2bxedSqSFLcf2ENq EFgqDyXptflGYEKDT2wGdPCWCWrzhSrINbk6u/YYAmqekQdShr8JvEegoH0P3rexWNZTND WRfw44dmxKMA== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 671fdecc (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Mon, 21 Apr 2025 19:43:48 +0200 (CEST) From: Manuel Giraud To: bug-gnu-emacs@gnu.org Subject: [PATCH] Fallback `eww-switch-to-buffer' to `eww' X-Debbugs-Cc: Lars Magne Ingebrigtsen Date: Mon, 21 Apr 2025 19:43:47 +0200 Message-ID: <87jz7d1kbw.fsf@ledu-giraud.fr> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) 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: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch Hi, The following patch calls `eww' interactively from `eww-switch-to-buffer' when there is no EWW buffers. Then, one can set a global shortcut on `eww-switch-to-buffer' and always be able to launch EWW. Thanks, In GNU Emacs 31.0.50 (build 5, x86_64-unknown-openbsd7.7, X toolkit) of 2025-04-20 built on computer Repository revision: b38fd553eb3291f140801ca158f6ab245496fa69 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101016 System Description: OpenBSD computer 7.7 GENERIC.MP#625 amd64 Configured using: 'configure CC=egcc CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs --bindir=/home/manuel/bin --with-x-toolkit=lucid --with-toolkit-scroll-bars=no --without-cairo --without-compress-install' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Fallback-eww-switch-to-buffer-to-eww.patch >From d63d4cacdd6bf9b9cbfff43cb07d3268f969bd25 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Mon, 21 Apr 2025 19:01:25 +0200 Subject: [PATCH] Fallback `eww-switch-to-buffer' to `eww' * lisp/net/eww.el (eww-switch-to-buffer): When no EWW buffers exist, call `eww' instead. --- lisp/net/eww.el | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 7edd1acbcf9..63425882583 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -2321,25 +2321,29 @@ eww-set-character-encoding (eww-reload nil charset))) (defun eww-switch-to-buffer () - "Prompt for an EWW buffer to display in the selected window." + "Prompt for an EWW buffer to display in the selected window. If no such +buffer exist, fallback to calling `eww'." (interactive nil eww-mode) (let ((completion-extra-properties `(:annotation-function ,(lambda (buf) (with-current-buffer buf (format " %s" (eww-current-url)))))) - (curbuf (current-buffer))) - (pop-to-buffer-same-window - (read-buffer "Switch to EWW buffer: " - (cl-loop for buf in (nreverse (buffer-list)) + (curbuf (current-buffer)) + (list (cl-loop for buf in (nreverse (buffer-list)) if (with-current-buffer buf (derived-mode-p 'eww-mode)) - return buf) - t - (lambda (bufn) - (setq bufn (if (consp bufn) (cdr bufn) (get-buffer bufn))) - (and (with-current-buffer bufn - (derived-mode-p 'eww-mode)) - (not (eq bufn curbuf)))))))) + return buf))) + (if list + (pop-to-buffer-same-window + (read-buffer "Switch to EWW buffer: " + list + t + (lambda (bufn) + (setq bufn (if (consp bufn) (cdr bufn) (get-buffer bufn))) + (and (with-current-buffer bufn + (derived-mode-p 'eww-mode)) + (not (eq bufn curbuf)))))) + (call-interactively 'eww)))) (defun eww-toggle-fonts () "Toggle whether to use monospaced or font-enabled layouts." -- 2.49.0 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=-- ------------=_1746870482-3572-1--