mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Use tabs in EWW (bug#37592)
* lisp/net/eww.el (eww-open-in-new-buffer): Call tab-new when tab-bar-mode is enabled. (eww-browse-url): Add docstring. Call tab-new when tab-bar-mode is enabled. * lisp/net/shr.el (shr-map): Bind [C-down-mouse-1] to shr-mouse-browse-url-new-window. (shr-mouse-browse-url-new-window): New command. (shr-browse-url): Add optional arg new-window. * doc/misc/eww.texi (Basics): Mention opening tabs on M-RET.
This commit is contained in:
parent
47cf2a37e7
commit
d24a197790
4 changed files with 37 additions and 3 deletions
|
|
@ -105,7 +105,10 @@ web page hit @kbd{g} (@code{eww-reload}). Pressing @kbd{w}
|
|||
@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
|
||||
|
|
|
|||
4
etc/NEWS
4
etc/NEWS
|
|
@ -1185,6 +1185,10 @@ document.
|
|||
Invoking the command with a prefix argument will cause it to create a
|
||||
new EWW buffer for the URL instead of reusing the default one.
|
||||
|
||||
+++
|
||||
*** Clicking with the Ctrl key or 'C-u RET' on a link opens a new tab
|
||||
when tab-bar-mode is enabled.
|
||||
|
||||
+++
|
||||
*** The 'd' ('eww-download') command now falls back to current page's URL.
|
||||
If this command is invoked with no URL at point, it now downloads the
|
||||
|
|
|
|||
|
|
@ -369,6 +369,9 @@ engine used."
|
|||
(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 @@ the like."
|
|||
|
||||
;;;###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
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ and other things:
|
|||
(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 @@ size, and full-buffer size."
|
|||
(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 @@ the mouse click event."
|
|||
(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."
|
||||
|
|
|
|||
Loading…
Reference in a new issue