From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Protesilaos Stavrou Newsgroups: gmane.emacs.bugs Subject: bug#51176: eww switch buffer by title Date: Mon, 18 Oct 2021 10:15:11 +0300 Message-ID: <87wnmag5xc.fsf@protesilaos.com> References: <87v9214j6g.fsf@ypei.me> <87lf2x6t11.fsf@gnus.org> <87fst53ytg.fsf@ypei.me> <871r4p6q5n.fsf@gnus.org> <871r4oyjm1.fsf@mail.linkov.net> <875yu050sz.fsf@gnus.org> <875yu0x256.fsf@mail.linkov.net> <87wnmg3i8f.fsf@gnus.org> <87pms8psyt.fsf@protesilaos.com> <87r1co1x8f.fsf@gnus.org> <87bl3qiysk.fsf@protesilaos.com> <87sfx24lua.fsf@gnus.org> <87ee8my1l8.fsf@protesilaos.com> <87a6ja4hb3.fsf@gnus.org> <8735p2qv1w.fsf@gnus.jao.io> <87ilxy2xrb.fsf@gnus.org> <87r1cmoy8g.fsf@gnus.jao.io> <87ee8ltxi8.fsf@protesilaos.com> <87fssyomsf.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4408"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Notmuch/0.33.2 (https://notmuchmail.org) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 51176@debbugs.gnu.org, Yuchen Pei , Jose Antonio Ortega Ruiz , Abhiseck Paira , Juri Linkov To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 18 09:16:22 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcMsb-0000lO-5K for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 Oct 2021 09:16:17 +0200 Original-Received: from localhost ([::1]:43900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcMsZ-0007oz-M6 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 Oct 2021 03:16:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcMsM-0007nS-FS for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2021 03:16:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34196) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcMsM-0003jk-6v for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2021 03:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mcMsM-000551-30 for bug-gnu-emacs@gnu.org; Mon, 18 Oct 2021 03:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Protesilaos Stavrou Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Oct 2021 07:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51176 X-GNU-PR-Package: emacs Original-Received: via spool by 51176-submit@debbugs.gnu.org id=B51176.163454132419481 (code B ref 51176); Mon, 18 Oct 2021 07:16:02 +0000 Original-Received: (at 51176) by debbugs.gnu.org; 18 Oct 2021 07:15:24 +0000 Original-Received: from localhost ([127.0.0.1]:45742 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcMrj-000549-TX for submit@debbugs.gnu.org; Mon, 18 Oct 2021 03:15:24 -0400 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:35119) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcMrh-00053s-GY for 51176@debbugs.gnu.org; Mon, 18 Oct 2021 03:15:22 -0400 Original-Received: (Authenticated sender: public@protesilaos.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id CD24424000F; Mon, 18 Oct 2021 07:15:12 +0000 (UTC) In-Reply-To: <87fssyomsf.fsf@gnus.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:217449 Archived-At: --=-=-= Content-Type: text/plain On 2021-10-18, 08:43 +0200, Lars Ingebrigtsen wrote: > Protesilaos Stavrou writes: > >> How about we add a sample function in the doc string? That would give >> users all the information they need to get started, no? > > Makes sense to me. Patch attached. I only updated the doc string, thinking that this addition does not need to be added to the NEWS. -- Protesilaos Stavrou https://protesilaos.com --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-sample-user-function-in-eww-auto-rename-buffer.patch >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 --=-=-=--