From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#65346: 30.0.50; *lisp/net/eww.el: new function 'eww-open-in-new-buffer-background' Date: Fri, 18 Aug 2023 08:52:32 +0300 Message-ID: <83sf8g523j.fsf@gnu.org> References: <1181651021.466162.1581309285621.ref@mail.yahoo.com> <1181651021.466162.1581309285621@mail.yahoo.com> <83350i6rcy.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3560"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65346@debbugs.gnu.org To: Lin Sun Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 18 07:53:17 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qWsQ8-0000jB-Il for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Aug 2023 07:53:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWsPv-0001SQ-A7; Fri, 18 Aug 2023 01:53:03 -0400 Original-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 1qWsPu-0001S7-1g for bug-gnu-emacs@gnu.org; Fri, 18 Aug 2023 01:53:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWsPt-00072u-Pt for bug-gnu-emacs@gnu.org; Fri, 18 Aug 2023 01:53:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qWsPu-0007r8-0Z for bug-gnu-emacs@gnu.org; Fri, 18 Aug 2023 01:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Aug 2023 05:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65346 X-GNU-PR-Package: emacs Original-Received: via spool by 65346-submit@debbugs.gnu.org id=B65346.169233795330158 (code B ref 65346); Fri, 18 Aug 2023 05:53:01 +0000 Original-Received: (at 65346) by debbugs.gnu.org; 18 Aug 2023 05:52:33 +0000 Original-Received: from localhost ([127.0.0.1]:45910 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWsPR-0007qM-4J for submit@debbugs.gnu.org; Fri, 18 Aug 2023 01:52:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWsPP-0007q6-Mt for 65346@debbugs.gnu.org; Fri, 18 Aug 2023 01:52:32 -0400 Original-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 1qWsPJ-00070i-I4; Fri, 18 Aug 2023 01:52:25 -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=vpk0fTIkITg+eOav7XtM5KFohjOtWFTpGoEVZ9zHhkE=; b=AUB4QoCrMG1O CVgXA8WvmOuKriU70M3vAUTFyVpVGbkX5zrv7mAtj3EeZJxSVQnTOA2+FtmR6aDK8OHxa6TLV3JG0 afoyBR9WK8YW7c96/4j//YSYhd//vvMl+kcPTg8jDAnS0AG4Sd9/iiBjw2RcaijaV3w+l0yyzGU8W 4+bRgYq229LHgFEfJ5XLbFJ0erktXt4Abo9AaqnoRWdtTzabJ479np1WMLUsRzzga7HgSlcoeQ0u7 TZJrOawDiW6XLkfy1X0eOjK8+aP6g0lOCM5CALoSv2d1CJrTFXsU7Xamtdps7uG9vWxxnzF6iprot K4qpr0yXq9wE9At/IoH8Uw==; In-Reply-To: (message from Lin Sun on Thu, 17 Aug 2023 22:51:04 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:267715 Archived-At: > From: Lin Sun > Date: Thu, 17 Aug 2023 22:51:04 +0000 > Cc: 65346@debbugs.gnu.org > > Thank you for the comment, and agree with you, so I rewrote the > function `eww-open-in-new-buffer' with "C-u" support (also with an > optional argument "url"), then there is no "background" description. > > I also tested the new patch with tab-bar-mode on and off, it works for > both scenarios. > > Please help review again. Thanks. Thanks. However, the way you implemented my suggestion is not what I had in mind. > -(defun eww-open-in-new-buffer () > - "Fetch link at point in a new EWW buffer." > - (interactive) > - (let ((url (eww-suggested-uris))) > - (if (null url) (user-error "No link at point") > - (when (or (eq eww-browse-url-new-window-is-tab t) > - (and (eq eww-browse-url-new-window-is-tab 'tab-bar) > - tab-bar-mode)) > - (let ((tab-bar-new-tab-choice t)) > - (tab-new))) > - ;; clone useful to keep history, but > - ;; should not clone from non-eww buffer > - (with-current-buffer > - (if (eq major-mode 'eww-mode) (clone-buffer) > - (generate-new-buffer "*eww*")) > - (unless (equal url (eww-current-url)) > - (eww-mode) > - (eww (if (consp url) (car url) url))))))) > +(defun eww--open-url-in-new-buffer (url) > + "Open the URL in a new EWW buffer." > + ;; clone useful to keep history, but > + ;; should not clone from non-eww buffer > + (with-current-buffer > + (if (eq major-mode 'eww-mode) (clone-buffer) > + (generate-new-buffer "*eww*")) > + (unless (equal url (eww-current-url)) > + (eww-mode) > + (eww (if (consp url) (car url) url))))) > + > +(defun eww-open-in-new-buffer (stay &optional url) > + "Fetch URL in a new EWW buffer. This changes the API of a public function in incompatible ways, which we try very hard not to do. Instead, the signature or eww-open-in-new-buffer should be like this: (defun eww-open-in-new-buffer (&optional no-select) and the new NO-SELECT argument should be set non-nil by C-u. > + (user-error "No avaliable link"))) This also changes the text of the error message in this case. Was that really necessary? The original text was more accurate, I think. Also, this new feature needs a NEWS entry and a suitable addition to the EWW manual. Thanks.