1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

Teach 'eww-open-file' about prefix argument

* lisp/net/eww.el (eww-open-file): Accept a new optional argument
NEW-BUFFER to show FILE in a new buffer.  (Bug#60809)

* etc/NEWS:
* doc/misc/eww.texi (Basics): Document the new feature.
This commit is contained in:
Eli Zaretskii 2023-01-14 11:48:55 +02:00
parent ac2a6fc83f
commit 9a1dbb7f08
3 changed files with 20 additions and 7 deletions

View file

@ -92,9 +92,10 @@ searched via @code{eww-search-prefix}. The default search engine is
either prefix the file name with @code{file://} or use the command
@kbd{M-x eww-open-file}.
If you invoke @code{eww} with a prefix argument, as in @w{@kbd{C-u
M-x eww}}, it will create a new EWW buffer instead of reusing the
default one, which is normally called @file{*eww*}.
If you invoke @code{eww} or @code{eww-open-file} with a prefix
argument, as in @w{@kbd{C-u M-x eww}}, they will create a new EWW
buffer instead of reusing the default one, which is normally called
@file{*eww*}.
@findex eww-quit
@findex eww-reload

View file

@ -147,6 +147,15 @@ point is not in a comment or a string. It is by default bound to
*** New connection method "toolbox".
This allow accessing system containers provided by Toolbox.
** EWW
+++
*** 'eww-open-file' can now display the file in a new buffer.
By default, the command reuses the '*eww*' buffer, but if called with
the new argument non-nil, it will use a new buffer instead.
Interactively, invoke 'eww-open-file' with a prefix argument to
activate this behavior.
* New Modes and Packages in Emacs 30.1

View file

@ -488,14 +488,17 @@ For more information, see Info node `(eww) Top'."
;;;###autoload (defalias 'browse-web 'eww)
;;;###autoload
(defun eww-open-file (file)
"Render FILE using EWW."
(interactive "fFile: ")
(defun eww-open-file (file &optional new-buffer)
"Render FILE using EWW.
If NEW-BUFFER is non-nil (interactively, the prefix arg), use a
new buffer instead of reusing the default EWW buffer."
(interactive "fFile: \nP")
(let ((url-allow-non-local-files t))
(eww (concat "file://"
(and (memq system-type '(windows-nt ms-dos))
"/")
(expand-file-name file)))))
(expand-file-name file))
new-buffer)))
(defun eww--file-buffer (file)
(with-current-buffer (generate-new-buffer " *eww file*")