Subject: bug#51176: [External] : bug#51176: eww switch buffer by title

From: Drew Adams <[email-masked]>
Date: Thu, 14 Oct 2021 00:16:16 +0000

> >> I see.  Then maybe in the existing hook `eww-after-render-hook'?
> >
> > Yup; I misread the code -- that looks like the correct place to put it.
> > But I can also see many people wanting this, so perhaps a user option to
> > rename the buffers this way would be nice.
> 
> That is right.  I am preparing together with another person a patch
> that auto-renames eww buffers after they are rendered.  The idea is to use
> either the page title or, if that is not available, the page's URL.
> 
> In terms of user options, there would be a toggle to enable the
> behaviour (off by default to not upset existing users) as well as a
> defcustom with ":type 'function", so users can specify exactly how the
> renaming scheme should work.
> 
> I expect the code to be finalised within the coming days, in case you
> have not done the work already.

FWIW, Bookmark+ allows these kinds of automatic renaming:

(defcustom bmkp-eww-buffer-renaming nil
  "Whether and how an EWW buffer is renamed.
Non-nil values affect EWW behavior even when bookmarks are not used.

* nil:    Do not rename buffer - use `*eww*' (vanilla EWW behavior).
* `url':  Rename buffer to web-page title plus last 20 chars of URL.
* `page': Rename buffer to web-page title (only)."
  :type '(choice
          (const :tag "Do not rename buffer (use name `*eww*')"                    nil)
          (const :tag "Rename buffer to web-page title plus last 20 chars of URL"  url)
          ;; Any symbol other than `page' and nil is treated the same as `page'.
          (const :tag "Rename buffer to web-page title"                            page))
  :group 'bookmark-plus)

The code (e.g. for the after-render hook function)
is in file `bookmark+-1.el'.

https://www.emacswiki.org/emacs/BookmarkPlus