From c0c807909c8ee963a633011ebfd4291148ca0db4 Mon Sep 17 00:00:00 2001 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 bed458ed8a5..178a25e4be2 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -187,7 +187,14 @@ determine the renaming scheme, as follows: - `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.39.2