Subject: bug#51176: eww switch buffer by title

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 13 Oct 2021 13:52:42 +0200

Yuchen Pei <[email-masked]> writes:

> How about switching to an eww buffer by title?

So the use case is that you have a large number of eww buffers, but you
want to find a particular based on the title of the web page being
displayed in that buffer?

I'm not sure that's generally useful enough to include -- do people use
`C-u M-x eww' a lot?

Some code comments:

> (defun eww-switch-by-title (title-and-buffer)
>  "Switches to an eww buffer with selected title."
>  (interactive
>   (list
>    (let ((com-table))
>      (dolist (buffer (buffer-list))
> 	(with-current-buffer buffer
> 	  (when (equal major-mode 'eww-mode)
> 	    (add-to-list
> 	     'com-table

Use `push'.

> 	     (concat (plist-get eww-data :title)
> 		     (propertize (concat " " (buffer-name))
> 				 'invisible t))))))
>      (completing-read "Eww buffer title: " com-table))))

Use an alist instead of propertising a string.

There may also be several buffers with the same title, I guess, in which
case this wouldn't allow you to choose either?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no