From: Protesilaos Stavrou Date: Mon, 18 Oct 2021 07:07:03 +0000 (+0300) Subject: Add sample user function in eww-auto-rename-buffer X-Git-Tag: emacs-29.0.90~3671^2~514 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c0c807909c8ee963a633011ebfd4291148ca0db4;p=emacs.git 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 --- 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'."