unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: tumashu  <tumashu@163.com>
To: "Po Lu" <luangruo@yahoo.com>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix)
Date: Wed, 10 Nov 2021 16:16:38 +0800 (CST)	[thread overview]
Message-ID: <4e33ab77.4b00.17d08eb9d6c.Coremail.tumashu@163.com> (raw)
In-Reply-To: <87tugkcyfj.fsf@yahoo.com>

[-- Attachment #1: Type: text/plain, Size: 1027 bytes --]


















At 2021-11-10 14:33:20, "Po Lu" <luangruo@yahoo.com> wrote:
>tumashu <tumashu@163.com> writes:
>
>> Hi:
>>
>> xwidget-webkit-buffer-name-prefix only use the below code now: 
>> what about rename this variable to xwidget-webkit-buffer-name-format and set 
>> vaule to "*xwidget-webkit: %s*"? i
>>
>>
>>                (with-current-buffer (xwidget-buffer xwidget)
>>                  (setq xwidget-webkit--title title)
>>                  (force-mode-line-update)
>>                  (xwidget-log "webkit finished loading: %s" title)
>>                  ;; Do not adjust webkit size to window here, the
>>                  ;; selected window can be the mini-buffer window
>>                  ;; unwantedly.
>>                  (rename-buffer (concat xwidget-webkit-buffer-name-prefix
>>                                         title "*")
>>                                         
>>                                 t)))))
>
>Could you send a patch that makes these changes?  Thanks.

Please see attachment.



[-- Attachment #2: 0001-xwidget-Add-xwidget-webkit-buffer-name-format.patch --]
[-- Type: application/octet-stream, Size: 2237 bytes --]

From fec6efece6eab77c835da518cf3d76be70400570 Mon Sep 17 00:00:00 2001
From: Feng Shu <tumashu@163.com>
Date: Wed, 10 Nov 2021 16:10:37 +0800
Subject: [PATCH] xwidget: Add xwidget-webkit-buffer-name-format.

* lisp/xwidget.el (xwidget-webkit-buffer-name-prefix): Rename from ...
(xwidget-webkit-buffer-name-format):  to this.
(xwidget-webkit-callback): Use xwidget-webkit-buffer-name-format instead.

* etc/NEWS: Note xwidget-webkit-buffer-name-format.
---
 etc/NEWS        |  2 +-
 lisp/xwidget.el | 14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 3cad0995ac..56f5ac486f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -504,7 +504,7 @@ This is a convenience function to extract the field data from
 ** Xwidgets
 
 ---
-*** New user option 'xwidget-webkit-buffer-name-prefix'.
+*** New user option 'xwidget-webkit-buffer-name-format'.
 This allows the user to change the webkit buffer names.
 
 +++
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index 905327083b..54ae36e547 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -95,8 +95,10 @@ xwidget-webkit
   :group 'web
   :prefix "xwidget-webkit-")
 
-(defcustom xwidget-webkit-buffer-name-prefix "*xwidget-webkit: "
-  "Buffer name prefix used by `xwidget-webkit' buffers."
+(defcustom xwidget-webkit-buffer-name-format "*xwidget-webkit: %T*"
+  "Buffer name format used by `xwidget-webkit' buffers.
+Format specs supported:
+1. %T -- title of web page."
   :type 'string
   :version "29.1")
 
@@ -372,9 +374,11 @@ xwidget-webkit-callback
                  ;; Do not adjust webkit size to window here, the
                  ;; selected window can be the mini-buffer window
                  ;; unwantedly.
-                 (rename-buffer (concat xwidget-webkit-buffer-name-prefix
-                                        title "*")
-                                t)))))
+                 (rename-buffer
+                  (format-spec
+                   xwidget-webkit-buffer-name-format
+                   `((?T . ,title)))
+                  t)))))
           ((eq xwidget-event-type 'decide-policy)
            (let ((strarg  (nth 3 last-input-event)))
              (if (string-match ".*#\\(.*\\)" strarg)
-- 
2.30.2


  parent reply	other threads:[~2021-11-10  8:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 12:31 About rename xwidget-webkit-buffer-name-prefix tumashu
2021-11-09 12:34 ` Po Lu
2021-11-10  6:33 ` Po Lu
2021-11-10  6:46   ` tumashu
2021-11-10  6:52     ` Po Lu
2021-11-10  6:54       ` Lars Ingebrigtsen
2021-11-10  8:16   ` tumashu [this message]
2021-11-10  9:32     ` [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix) Po Lu
2021-11-10  9:49       ` tumashu
2021-11-10  9:50         ` Po Lu
2021-11-10 13:54         ` Eli Zaretskii
2021-11-10 22:41           ` tumashu
2021-11-11  0:15           ` tumashu
2021-11-11  0:30           ` Po Lu
2021-11-11  6:54             ` Eli Zaretskii
2021-11-11 10:26         ` Po Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e33ab77.4b00.17d08eb9d6c.Coremail.tumashu@163.com \
    --to=tumashu@163.com \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).