emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c0c8079: Add sample user function in eww-auto-rename-buffer


From: Lars Ingebrigtsen
Subject: master c0c8079: Add sample user function in eww-auto-rename-buffer
Date: Mon, 18 Oct 2021 03:16:28 -0400 (EDT)

branch: master
commit c0c807909c8ee963a633011ebfd4291148ca0db4
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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 <abhiseckpaira@disroot.org>
    Co-authored-by: Protesilaos Stavrou <info@protesilaos.com>
---
 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 bed458e..178a25e 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'."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]