This behaviour was discussed in bug#34374 and merged on 2019-02-15.
So in Emacs 27, calling
eww with a prefix argument tells it to use a new buffer instead of reusing the default
I'm surprised this functionality isn't just built-in. Am I just missing it?
Yes and no. Similar functionality was added in Emacs 26 as the command
eww-open-in-new-buffer, which is bound to M-RET in EWW buffers by default:
eww-open-in-new-buffer is an interactive compiled Lisp function in
It is bound to M-RET, <menu-bar> <Eww> <Follow URL in new buffer>.
Fetch link at point in a new EWW buffer.
The only problem is that, at the time of writing, this command is limited to working only in EWW buffers. In particular, it throws a
user-error if no meaningful link is found at point, as determined by the user option
eww-suggest-uris is a variable defined in ‘eww.el’.
Its value is
(eww-links-at-point url-get-url-at-point eww-current-url)
List of functions called to form the list of default URIs for ‘eww’.
Each of the elements is a function returning either a string or a list
of strings. The results will be joined into a single list with
duplicate entries (if any) removed.
You can customize this variable.
This variable was introduced, or its default value was changed, in
version 25.1 of Emacs.
A further limitation of the command is that it does not prompt the user for a URL or search terms, as the command
Here's a simple example of how you could bridge these differences between
(defun my-eww-new-buffer (url)
"Like `eww', but fetch URL in a new EWW buffer."
(interactive (advice-eval-interactive-spec (cadr (interactive-form 'eww))))
(let ((eww-suggest-uris (list (lambda () url))))
What this does is first call the
interactive spec of
eww, which prompts for URLs or search terms as usual. It then calls
eww-open-in-new-buffer with the previously input URLs or search terms as the only suggested URI, so that the command does not throw a tantrum.
This command will work both within and without EWW buffers, so it can act as a drop-in replacement for the default
eww-open-in-new-buffer, if you prefer:
(define-key eww-mode-map [remap eww-open-in-new-buffer] #'my-eww-new-buffer))
Either way, you can invoke it from anywhere as M-x
my-eww-new-bufferRET or bind it globally to a more convenient key.
ewwwith a prefix argument; see my answer below.