From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#37592: Using tabs in EWW Date: Sun, 06 Oct 2019 01:35:40 +0300 Organization: LINKOV.NET Message-ID: <87zhieu8g3.fsf@mail.linkov.net> References: <87r23uga96.fsf@mail.linkov.net> <83zhii7dkk.fsf@gnu.org> <87pnjdh1up.fsf@mail.linkov.net> <83zhih55h3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="169187"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 37592@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 06 00:38:22 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iGsgw-000hsS-8j for geb-bug-gnu-emacs@m.gmane.org; Sun, 06 Oct 2019 00:38:22 +0200 Original-Received: from localhost ([::1]:59282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGsgu-0002F5-IB for geb-bug-gnu-emacs@m.gmane.org; Sat, 05 Oct 2019 18:38:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51632) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGsgh-0002Es-JS for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 18:38:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iGsgd-0001U4-1z for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 18:38:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36508) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iGsgb-0001Tg-TA for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 18:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iGsgb-0004yJ-Mb for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2019 18:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Oct 2019 22:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37592 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 37592-submit@debbugs.gnu.org id=B37592.157031503519050 (code B ref 37592); Sat, 05 Oct 2019 22:38:01 +0000 Original-Received: (at 37592) by debbugs.gnu.org; 5 Oct 2019 22:37:15 +0000 Original-Received: from localhost ([127.0.0.1]:45329 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGsfq-0004xC-WE for submit@debbugs.gnu.org; Sat, 05 Oct 2019 18:37:15 -0400 Original-Received: from beige.elm.relay.mailchannels.net ([23.83.212.16]:42266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iGsfo-0004wy-8U for 37592@debbugs.gnu.org; Sat, 05 Oct 2019 18:37:13 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 00ECA5E131D; Sat, 5 Oct 2019 22:37:11 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a36.g.dreamhost.com (100-96-87-199.trex.outbound.svc.cluster.local [100.96.87.199]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 883985E180D; Sat, 5 Oct 2019 22:37:10 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a36.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.3); Sat, 05 Oct 2019 22:37:10 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Ski-Exultant: 7c579c8306936f9d_1570315030766_2216901645 X-MC-Loop-Signature: 1570315030766:277998764 X-MC-Ingress-Time: 1570315030766 Original-Received: from pdx1-sub0-mail-a36.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a36.g.dreamhost.com (Postfix) with ESMTP id 706E381820; Sat, 5 Oct 2019 15:37:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=afSOZ6/uLwRbnKNnzeIl7pbY5qk=; b= hkriqOOi+9yrLeSJJV6qGmHNMMuXhU3U5payACX+eCDE0+7Hn4LvLJCT+Zi8/Q5A DyLY6XcEZIbtzD9DdukuIm4Bn6g7OD9dh4M+ujPF/2yPvJD91Z2C4K6cVMVd9fZA kai+95BfVbV8TfjoIZAFU5HyI/ggbwRItIMWIm2yOt0= Original-Received: from mail.jurta.org (m91-129-99-99.cust.tele2.ee [91.129.99.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a36.g.dreamhost.com (Postfix) with ESMTPSA id F3ACA8181E; Sat, 5 Oct 2019 15:37:03 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a36 In-Reply-To: <83zhih55h3.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 04 Oct 2019 10:34:32 +0300") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrheefgddujeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesmhdtreertdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrdelledrleelnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledrleelrdelledprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegvlhhiiiesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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" Xref: news.gmane.org gmane.emacs.bugs:168401 Archived-At: --=-=-= Content-Type: text/plain >> > Instead of adding another defcustom, how about doing this by default >> > if tab-bar-mode is enabled? >> >> I guess the users still need to decide whether they want to open >> new tabs in the tab-bar (when eww-browse-url-new-window-is-tab is non-nil), >> or new tabs in the tab-line (when eww-browse-url-new-window-is-tab is nil) >> that just creates a new buffer displayed in the window-local tab-line - >> this is the current behavior. >> >> Another use case is that when tab-bar-mode is not yet enabled, >> users migth prefer that clicking on a link with a Ctrl key >> could enable the tab-bar and open a new tab in automatically >> enabled tab-bar. > > It seems to me that there are sensible defaults in each of these > situations, and we could use those defaults unconditionally until > users complained. > > Adding too many user options has a downside as well, you know. > > Just one opinion. I agree, let's try this heuristics to open new tabs when tab-bar-mode is enabled: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=eww-tabs.2.patch diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index b8821cbc29..d0a4c9a790 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -105,7 +105,10 @@ Basics @kindex M-RET The @kbd{M-@key{RET}} command (@code{eww-open-in-new-buffer}) opens the URL at point in a new EWW buffer, akin to opening a link in a new -``tab'' in other browsers. +``tab'' in other browsers. When @code{global-tab-line-mode} is +enabled, this buffer is displayed in the tab on the window tab line. +When @code{tab-bar-mode} is enabled, a new tab is created on the frame +tab bar. @findex eww-readable @kindex R diff --git a/lisp/net/eww.el b/lisp/net/eww.el index fb495a9858..0756c6088b 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -369,6 +369,9 @@ eww-open-in-new-buffer (interactive) (let ((url (eww-suggested-uris))) (if (null url) (user-error "No link at point") + (when 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 @@ -878,7 +881,22 @@ eww-mode ;;;###autoload (defun eww-browse-url (url &optional new-window) + "Ask the EWW browser to load URL. + +Interactively, if the variable `browse-url-new-window-flag' is non-nil, +loads the document in a new buffer tab on the window tab-line. A non-nil +prefix argument reverses the effect of `browse-url-new-window-flag'. + +If `tab-bar-mode' is enabled, then whenever a document would +otherwise be loaded in a new buffer, it is loaded in a new tab +in the tab-bar on an existing frame. + +Non-interactively, this uses the optional second argument NEW-WINDOW +instead of `browse-url-new-window-flag'." (when new-window + (when tab-bar-mode + (let ((tab-bar-new-tab-choice t)) + (tab-new))) (pop-to-buffer-same-window (generate-new-buffer (format "*eww-%s*" (url-host (url-generic-parse-url diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 628cc17a5b..f3d5de9fb6 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -201,6 +201,7 @@ shr-map (define-key map [?\M-\t] 'shr-previous-link) (define-key map [follow-link] 'mouse-face) (define-key map [mouse-2] 'shr-browse-url) + (define-key map [C-down-mouse-1] 'shr-mouse-browse-url-new-window) (define-key map "I" 'shr-insert-image) (define-key map "w" 'shr-maybe-probe-and-copy-url) (define-key map "u" 'shr-maybe-probe-and-copy-url) @@ -967,7 +968,13 @@ shr-mouse-browse-url (mouse-set-point ev) (shr-browse-url)) -(defun shr-browse-url (&optional external mouse-event) +(defun shr-mouse-browse-url-new-window (ev) + "Browse the URL under the mouse cursor in a new window." + (interactive "e") + (mouse-set-point ev) + (shr-browse-url nil nil t)) + +(defun shr-browse-url (&optional external mouse-event new-window) "Browse the URL at point using `browse-url'. If EXTERNAL is non-nil (interactively, the prefix argument), browse the URL using `browse-url-secondary-browser-function'. @@ -987,7 +994,9 @@ shr-browse-url (progn (funcall browse-url-secondary-browser-function url) (shr--blink-link)) - (browse-url url)))))) + (browse-url url (if new-window + (not browse-url-new-window-flag) + browse-url-new-window-flag))))))) (defun shr-save-contents (directory) "Save the contents from URL in a file." --=-=-=--