Subject: bug#22244: 25.0.50; Make eww use display-buffer to display eww buffer

From: Mark Oteiza <[email-masked]>
Date: Tue, 2 Feb 2016 21:57:11 -0500

On 03/02/16 at 12:59pm, Lars Ingebrigtsen wrote:
> Mark Oteiza <[email-masked]> writes:
> 
> > Just an idle though: something like erc's erc-switch-to-buffer could be
> > a step above standard buffer switching.
> 
> I use ido mode, and that's as convenient, I find...

I don't, but I was thinking more like "S but in the minibuffer". Where the
buffer names in erc are meaningful, in eww they are not so much (at
least in my case where I'm usually using clone-buffer to make more eww
buffers). So the completion candidates might be the buffer urls, titles, or
instead just showing annotations like so:

(defun eww-switch-to-buffer ()
  "Prompt for an EWW buffer to switch to."
  (interactive)
  (let ((completion-extra-properties
         '(:annotation-function
           (lambda (bufn)
             (with-current-buffer bufn
               (format " %s" (eww-current-url)))))))
    (switch-to-buffer
     (read-buffer "Switch to EWW buffer: "
                  (cl-loop for buf in (nreverse (buffer-list))
                           if (with-current-buffer buf (derived-mode-p 'eww-mode))
                           return buf)
                  t
                  (lambda (bufn)
                    (let ((buf (if (consp bufn) (cdr bufn) (get-buffer bufn))))
                      (with-current-buffer buf
                        (derived-mode-p 'eww-mode))))))))