Function: eww-switch-to-buffer
eww-switch-to-buffer is an interactive and byte-compiled function
defined in eww.el.gz.
Signature
(eww-switch-to-buffer)
Documentation
Prompt for an EWW buffer to display in the selected window.
If no such buffer exist, fallback to calling eww.
Probably introduced at or before Emacs version 31.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/net/eww.el.gz
(defun eww-switch-to-buffer ()
"Prompt for an EWW buffer to display in the selected window.
If no such buffer exist, fallback to calling `eww'."
(interactive nil eww-mode)
(let ((list (seq-filter
(lambda (buf)
(and (eww--buffer-p buf) (not (eq buf (current-buffer)))))
(buffer-list))))
(if list
(pop-to-buffer-same-window
(if (length= list 1)
(car list)
(completing-read "Switch to EWW buffer: "
(completion-table-with-metadata
(mapcar #'buffer-name list)
`((category . buffer)
(annotation-function
. ,(lambda (buf)
(with-current-buffer buf
(format " %s" (eww-current-url)))))))
nil t nil nil (car-safe list))))
(call-interactively #'eww))))