emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master d9a3c89: * lisp/net/eww.el (eww-browse-url-new-wind


From: Juri Linkov
Subject: [Emacs-diffs] master d9a3c89: * lisp/net/eww.el (eww-browse-url-new-window-is-tab): New defcustom.
Date: Sat, 19 Oct 2019 18:40:15 -0400 (EDT)

branch: master
commit d9a3c8974f9690e68d34a261bde58fb465750908
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/net/eww.el (eww-browse-url-new-window-is-tab): New defcustom.
    
    (eww-open-in-new-buffer, eww-browse-url): Use new defcustom (bug#37592).
---
 lisp/net/eww.el | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index f5dedd5..dccaf04 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -128,6 +128,18 @@ The string will be passed through 
`substitute-command-keys'."
   :type '(choice (const :tag "Never" nil)
                  regexp))
 
+(defcustom eww-browse-url-new-window-is-tab 'tab-bar
+  "Whether to open up new windows in a tab or a new buffer.
+If t, 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.
+If `tab-bar', then open the URL in a new tab only when
+the tab bar is enabled."
+  :version "27.1"
+  :group 'eww
+  :type '(choice (const :tag "Always open URL in new tab" t)
+                 (const :tag "Open new tab when tab bar is enabled" tab-bar)
+                 (const :tag "Never open URL in new tab" nil)))
+
 (defcustom eww-after-render-hook nil
   "A hook called after eww has finished rendering the buffer."
   :version "25.1"
@@ -369,7 +381,9 @@ engine used."
   (interactive)
   (let ((url (eww-suggested-uris)))
     (if (null url) (user-error "No link at point")
-      (when tab-bar-mode
+      (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
@@ -889,12 +903,15 @@ 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.
+in the tab-bar on an existing frame.  See more options in
+`eww-browse-url-new-window-is-tab'.
 
 Non-interactively, this uses the optional second argument NEW-WINDOW
 instead of `browse-url-new-window-flag'."
   (when new-window
-    (when tab-bar-mode
+    (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)))
     (pop-to-buffer-same-window



reply via email to

[Prev in Thread] Current Thread [Next in Thread]