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: Wed, 02 Oct 2019 23:31:17 +0300 Organization: LINKOV.NET Message-ID: <87r23uga96.fsf@mail.linkov.net> 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="162864"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) To: 37592@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 02 22:47:59 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 1iFlXS-000gDv-Dw for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Oct 2019 22:47:58 +0200 Original-Received: from localhost ([::1]:59122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFlXR-0002rP-5h for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Oct 2019 16:47:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32905) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFlK1-0007y0-1p for bug-gnu-emacs@gnu.org; Wed, 02 Oct 2019 16:34:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFlJy-0006WV-Rm for bug-gnu-emacs@gnu.org; Wed, 02 Oct 2019 16:34:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57825) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iFlJy-0006WN-Og for bug-gnu-emacs@gnu.org; Wed, 02 Oct 2019 16:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iFlJy-0008PU-CD for bug-gnu-emacs@gnu.org; Wed, 02 Oct 2019 16:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Oct 2019 20:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37592 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.157004843032300 (code B ref -1); Wed, 02 Oct 2019 20:34:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Oct 2019 20:33:50 +0000 Original-Received: from localhost ([127.0.0.1]:38412 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFlJm-0008Ot-1y for submit@debbugs.gnu.org; Wed, 02 Oct 2019 16:33:50 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:58714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iFlJh-0008Oj-P4 for submit@debbugs.gnu.org; Wed, 02 Oct 2019 16:33:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32838) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFlJe-0007na-9j for bug-gnu-emacs@gnu.org; Wed, 02 Oct 2019 16:33:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFlJb-0006Ik-MY for bug-gnu-emacs@gnu.org; Wed, 02 Oct 2019 16:33:41 -0400 Original-Received: from anteater.elm.relay.mailchannels.net ([23.83.212.3]:56362) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFlJb-0006Gj-83 for bug-gnu-emacs@gnu.org; Wed, 02 Oct 2019 16:33:39 -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 3FFDA8C1274 for ; Wed, 2 Oct 2019 20:33:36 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a65.g.dreamhost.com (100-96-91-70.trex.outbound.svc.cluster.local [100.96.91.70]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 9568F8C2EC5 for ; Wed, 2 Oct 2019 20:33:35 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a65.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.17.5); Wed, 02 Oct 2019 20:33:36 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Industry-Shrill: 2b4df85b202786a9_1570048415848_260023891 X-MC-Loop-Signature: 1570048415848:2313092419 X-MC-Ingress-Time: 1570048415847 Original-Received: from pdx1-sub0-mail-a65.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a65.g.dreamhost.com (Postfix) with ESMTP id 28C198584B for ; Wed, 2 Oct 2019 13:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:date:message-id:mime-version:content-type; s= linkov.net; bh=6uUf6wrmj6iwIXTnAwh4xNNG+WE=; b=q2giUMCXgW2+c5s6W WD87ruuv3VlxovmbjBzYWTf/D+sfWLdWorhjtbM7dlfjSv9efjtgeJjG8sUJGQY4 UoihShUcMmR6rN6GU+AaR9fwz/I/+JekD/vEowge0TCIypr3iON4Gspvz3gsEDjU Eo7xN6fkWijwBRj15gOZlhUHes= 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-a65.g.dreamhost.com (Postfix) with ESMTPSA id 4B2DB8583D for ; Wed, 2 Oct 2019 13:33:28 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a65 X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrgeeigdduhedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuohffkfgfgggtsehmtderredtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledrleelrdelleenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrdelledrleelpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] 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:168178 Archived-At: --=-=-= Content-Type: text/plain Severity: wishlist Tags: patch Like in web browsers opens links in a new tab, the attached patch does the same for EWW. The change that implements support for tabs in EWW is just 3 lines: (when eww-browse-url-new-window-is-tab (let ((tab-bar-new-tab-choice t)) (tab-new))) Everything else is replicating the existing code: 1. A new defcustom eww-browse-url-new-window-is-tab is a copy of existing browse-url-firefox-new-window-is-tab 2. The docstring for eww-browse-url is copied from browse-url-firefox 3. The code for shr-browse-url is copied from browse-url-at-point --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=eww-tabs.patch diff --git a/lisp/net/eww.el b/lisp/net/eww.el index fb495a9858..a39f8b87cc 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -876,9 +876,32 @@ eww-mode (buffer-disable-undo) (setq buffer-read-only t)) +(defcustom eww-browse-url-new-window-is-tab nil + "Whether to open up new windows in a tab or a new buffer. +If non-nil, then open the URL in a new tab rather than a new buffer if +`eww-browse-url' is asked to open it in a new window." + :version "27.1" + :group 'eww + :type 'boolean) + ;;;###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 `eww-browse-url-new-window-is-tab' is non-nil, 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 eww-browse-url-new-window-is-tab + (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 ef236bf7c4..390be4deff 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." --=-=-=--