>From 85762fa3b88410675cbf89854f3a1c29bbac7a9d Mon Sep 17 00:00:00 2001 Message-Id: <85762fa3b88410675cbf89854f3a1c29bbac7a9d.1634540834.git.info@protesilaos.com> From: Protesilaos Stavrou Date: Mon, 18 Oct 2021 10:07:03 +0300 Subject: [PATCH] Add sample user function in eww-auto-rename-buffer * eww.el (eww-auto-rename-buffer): Update doc string. Fix bug#51176. Co-authored-by: Abhiseck Paira Co-authored-by: Protesilaos Stavrou --- lisp/net/eww.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index bed458ed8a..178a25e4be 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -187,7 +187,14 @@ (defcustom eww-auto-rename-buffer nil - `title': Use the web page's title. - `url': Use the web page's URL. - a function's symbol: Run a user-defined function that returns a - string with which to rename the buffer. + string with which to rename the buffer. Sample of a + user-defined function: + + (defun my-eww-rename-buffer () + (when (eq major-mode 'eww-mode) + (when-let ((string (or (plist-get eww-data :title) + (plist-get eww-data :url)))) + (format \"*%s*\" string)))) The string of `title' and `url' is always truncated to the value of `eww-buffer-name-length'." -- 2.33.1