* About rename xwidget-webkit-buffer-name-prefix
@ 2021-11-09 12:31 tumashu
2021-11-09 12:34 ` Po Lu
2021-11-10 6:33 ` Po Lu
0 siblings, 2 replies; 16+ messages in thread
From: tumashu @ 2021-11-09 12:31 UTC (permalink / raw)
To: emacs-devel@gnu.org
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)))))
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About rename xwidget-webkit-buffer-name-prefix
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
1 sibling, 0 replies; 16+ messages in thread
From: Po Lu @ 2021-11-09 12:34 UTC (permalink / raw)
To: tumashu; +Cc: emacs-devel@gnu.org
tumashu <tumashu@163.com> writes:
> 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)))))
That's alright by me, but could you perhaps give me a day or 2 to finish
the tests I've been working on, before making this change?
Thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About rename xwidget-webkit-buffer-name-prefix
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 8:16 ` [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix) tumashu
1 sibling, 2 replies; 16+ messages in thread
From: Po Lu @ 2021-11-10 6:33 UTC (permalink / raw)
To: tumashu; +Cc: emacs-devel@gnu.org
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.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re:Re: About rename xwidget-webkit-buffer-name-prefix
2021-11-10 6:33 ` Po Lu
@ 2021-11-10 6:46 ` tumashu
2021-11-10 6:52 ` Po Lu
2021-11-10 8:16 ` [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix) tumashu
1 sibling, 1 reply; 16+ messages in thread
From: tumashu @ 2021-11-10 6:46 UTC (permalink / raw)
To: Po Lu; +Cc: emacs-devel@gnu.org
[-- Attachment #1: Type: text/plain, Size: 1339 bytes --]
--
发自我的网易邮箱手机智能版
<br/><br/><br/>
----- Original Message -----
From: "Po Lu" <luangruo@yahoo.com>
To: tumashu <tumashu@163.com>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Sent: Wed, 10 Nov 2021 14:33:20 +0800
Subject: Re: About rename xwidget-webkit-buffer-name-prefix
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
no patch at moment, :) do we only support title? xwidget-webkit-buffer-name-function or xwidget-webkit-buffer-name-format, which one is better?
[-- Attachment #2: Type: text/html, Size: 3371 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About rename xwidget-webkit-buffer-name-prefix
2021-11-10 6:46 ` tumashu
@ 2021-11-10 6:52 ` Po Lu
2021-11-10 6:54 ` Lars Ingebrigtsen
0 siblings, 1 reply; 16+ messages in thread
From: Po Lu @ 2021-11-10 6:52 UTC (permalink / raw)
To: tumashu; +Cc: emacs-devel@gnu.org
tumashu <tumashu@163.com> writes:
> no patch at moment, :) do we only support title?
> xwidget-webkit-buffer-name-function or
> xwidget-webkit-buffer-name-format, which one is better?
I would prefer a format string. A format string would make it easier to
support new parameters in the future, but I think it would be good to
let the others chime in and see what they think too.
Thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About rename xwidget-webkit-buffer-name-prefix
2021-11-10 6:52 ` Po Lu
@ 2021-11-10 6:54 ` Lars Ingebrigtsen
0 siblings, 0 replies; 16+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-10 6:54 UTC (permalink / raw)
To: Po Lu; +Cc: tumashu, emacs-devel@gnu.org
Po Lu <luangruo@yahoo.com> writes:
> I would prefer a format string. A format string would make it easier to
> support new parameters in the future, but I think it would be good to
> let the others chime in and see what they think too.
A format string (using `format-spec') would be quite convenient.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix)
2021-11-10 6:33 ` Po Lu
2021-11-10 6:46 ` tumashu
@ 2021-11-10 8:16 ` tumashu
2021-11-10 9:32 ` Po Lu
1 sibling, 1 reply; 16+ messages in thread
From: tumashu @ 2021-11-10 8:16 UTC (permalink / raw)
To: Po Lu; +Cc: emacs-devel@gnu.org
[-- 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
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix)
2021-11-10 8:16 ` [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix) tumashu
@ 2021-11-10 9:32 ` Po Lu
2021-11-10 9:49 ` tumashu
0 siblings, 1 reply; 16+ messages in thread
From: Po Lu @ 2021-11-10 9:32 UTC (permalink / raw)
To: tumashu; +Cc: emacs-devel@gnu.org
tumashu <tumashu@163.com> writes:
> - (rename-buffer (concat xwidget-webkit-buffer-name-prefix
> - title "*")
> - t)))))
> + (rename-buffer
> + (format-spec
> + xwidget-webkit-buffer-name-format
> + `((?T . ,title)))
> + t)))))
Doesn't this mean you have to (require 'format-spec)?
Thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re:Re: [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix)
2021-11-10 9:32 ` Po Lu
@ 2021-11-10 9:49 ` tumashu
2021-11-10 9:50 ` Po Lu
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: tumashu @ 2021-11-10 9:49 UTC (permalink / raw)
To: Po Lu; +Cc: emacs-devel@gnu.org
[-- Attachment #1: Type: text/plain, Size: 567 bytes --]
At 2021-11-10 17:32:24, "Po Lu" <luangruo@yahoo.com> wrote:
>tumashu <tumashu@163.com> writes:
>
>> - (rename-buffer (concat xwidget-webkit-buffer-name-prefix
>> - title "*")
>> - t)))))
>> + (rename-buffer
>> + (format-spec
>> + xwidget-webkit-buffer-name-format
>> + `((?T . ,title)))
>> + t)))))
>
>Doesn't this mean you have to (require 'format-spec)?
Added.
>
>Thanks.
>
[-- Attachment #2: 0001-xwidget-Add-xwidget-webkit-buffer-name-format.patch --]
[-- Type: application/octet-stream, Size: 2474 bytes --]
From 5b44bc6cbbf409d50dd9bf5e109f76b640b4d4db 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.
(format-spec): required.
* etc/NEWS: Note xwidget-webkit-buffer-name-format.
---
etc/NEWS | 2 +-
lisp/xwidget.el | 15 ++++++++++-----
2 files changed, 11 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..f5ae3cdb85 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -33,6 +33,7 @@
(require 'cl-lib)
(require 'bookmark)
+(require 'format-spec)
(declare-function make-xwidget "xwidget.c"
(type title width height arguments &optional buffer related))
@@ -95,8 +96,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 +375,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
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix)
2021-11-10 9:49 ` tumashu
@ 2021-11-10 9:50 ` Po Lu
2021-11-10 13:54 ` Eli Zaretskii
2021-11-11 10:26 ` Po Lu
2 siblings, 0 replies; 16+ messages in thread
From: Po Lu @ 2021-11-10 9:50 UTC (permalink / raw)
To: tumashu; +Cc: emacs-devel@gnu.org
tumashu <tumashu@163.com> writes:
> Added.
Thanks, if nobody else has a comment I'll install it.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix)
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
` (2 more replies)
2021-11-11 10:26 ` Po Lu
2 siblings, 3 replies; 16+ messages in thread
From: Eli Zaretskii @ 2021-11-10 13:54 UTC (permalink / raw)
To: tumashu; +Cc: luangruo, emacs-devel
> Date: Wed, 10 Nov 2021 17:49:04 +0800 (CST)
> From: tumashu <tumashu@163.com>
> Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
>
> -*** 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.
Using this option you can control how the xwidget-webkit buffers are
named.
> +(defcustom xwidget-webkit-buffer-name-format "*xwidget-webkit: %T*"
> + "Buffer name format used by `xwidget-webkit' buffers.
Template for naming `xwidget-webkit' buffers.
It can use the following special constructs:
%T -- the title of the Web page loaded by the xwidget.
> + (rename-buffer
> + (format-spec
> + xwidget-webkit-buffer-name-format
> + `((?T . ,title)))
> + t)))))
Hmmm... does this mean that the format spec _must_ contain %T?
Because otherwise all the buffers will have the same name, no?
Which would mean this change introduces a regression wrt how this
worked previously, right?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re:Re: [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix)
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
2 siblings, 0 replies; 16+ messages in thread
From: tumashu @ 2021-11-10 22:41 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: luangruo, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]
--
发自我的网易邮箱手机智能版
<br/><br/><br/>
----- Original Message -----
From: "Eli Zaretskii" <eliz@gnu.org>
To: tumashu <tumashu@163.com>
Cc: luangruo@yahoo.com, emacs-devel@gnu.org
Sent: Wed, 10 Nov 2021 15:54:21 +0200
Subject: Re: [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix)
> Date: Wed, 10 Nov 2021 17:49:04 +0800 (CST)
> From: tumashu <tumashu@163.com>
> Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
>
> -*** 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.
Using this option you can control how the xwidget-webkit buffers are
named.
> +(defcustom xwidget-webkit-buffer-name-format "*xwidget-webkit: %T*"
> + "Buffer name format used by `xwidget-webkit' buffers.
Template for naming `xwidget-webkit' buffers.
It can use the following special constructs:
%T -- the title of the Web page loaded by the xwidget.
> + (rename-buffer
> + (format-spec
> + xwidget-webkit-buffer-name-format
> + `((?T . ,title)))
> + t)))))
Hmmm... does this mean that the format spec _must_ contain %T?
Because otherwise all the buffers will have the same name, no?
Which would mean this change introduces a regression wrt how this
worked previously, right?
we use (rename-buffer xxx t), so i think buffer name will different but similar when no %T,
[-- Attachment #2: Type: text/html, Size: 3147 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re:Re: [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix)
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
2 siblings, 0 replies; 16+ messages in thread
From: tumashu @ 2021-11-11 0:15 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Po Lu, emacs-devel@gnu.org
[-- Attachment #1: Type: text/plain, Size: 1372 bytes --]
At 2021-11-10 21:54:21, "Eli Zaretskii" <eliz@gnu.org> wrote:
>> Date: Wed, 10 Nov 2021 17:49:04 +0800 (CST)
>> From: tumashu <tumashu@163.com>
>> Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
>>
>> -*** 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.
>
> Using this option you can control how the xwidget-webkit buffers are
> named.
changed.
>
>> +(defcustom xwidget-webkit-buffer-name-format "*xwidget-webkit: %T*"
>> + "Buffer name format used by `xwidget-webkit' buffers.
>
> Template for naming `xwidget-webkit' buffers.
> It can use the following special constructs:
>
> %T -- the title of the Web page loaded by the xwidget.
changed.
>
>> + (rename-buffer
>> + (format-spec
>> + xwidget-webkit-buffer-name-format
>> + `((?T . ,title)))
>> + t)))))
>
>Hmmm... does this mean that the format spec _must_ contain %T?
>Because otherwise all the buffers will have the same name, no?
>Which would mean this change introduces a regression wrt how this
>worked previously, right?
I have tested without %T, it will like *xwidget-webkit:*<2> ,*xwidget-webkit:*<3> ...
so I think some user will like this and set without %T.
[-- Attachment #2: 0001-xwidget-Add-xwidget-webkit-buffer-name-format.patch --]
[-- Type: application/octet-stream, Size: 2650 bytes --]
From efc593fc70f61879556a0a05469b162800eebb2e 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.
(format-spec): required.
* etc/NEWS: Note xwidget-webkit-buffer-name-format.
---
etc/NEWS | 5 +++--
lisp/xwidget.el | 16 +++++++++++-----
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index b403be65da..d53869e245 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -443,8 +443,9 @@ This is a convenience function to extract the field data from
** Xwidgets
---
-*** New user option 'xwidget-webkit-buffer-name-prefix'.
-This allows the user to change the webkit buffer names.
+*** New user option 'xwidget-webkit-buffer-name-format'.
+Using this option you can control how the xwidget-webkit buffers are
+named.
+++
*** New minor mode 'xwidget-webkit-edit-mode'.
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index cc149cf197..1b3fb932ba 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -33,6 +33,7 @@
(require 'cl-lib)
(require 'bookmark)
+(require 'format-spec)
(declare-function make-xwidget "xwidget.c"
(type title width height arguments &optional buffer related))
@@ -95,8 +96,11 @@ 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*"
+ "Template for naming `xwidget-webkit' buffers.
+It can use the following special constructs:
+
+ %T -- the title of the Web page loaded by the xwidget."
:type 'string
:version "29.1")
@@ -372,9 +376,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
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix)
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
2 siblings, 1 reply; 16+ messages in thread
From: Po Lu @ 2021-11-11 0:30 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: tumashu, emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> + (rename-buffer
>> + (format-spec
>> + xwidget-webkit-buffer-name-format
>> + `((?T . ,title)))
>> + t)))))
> Hmmm... does this mean that the format spec _must_ contain %T?
> Because otherwise all the buffers will have the same name, no?
> Which would mean this change introduces a regression wrt how this
> worked previously, right?
It tells `rename-buffer' to come up with a new name in that cases, which
is pretty much how the old code worked (except it called
`generate-new-buffer-name' manually).
Thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix)
2021-11-11 0:30 ` Po Lu
@ 2021-11-11 6:54 ` Eli Zaretskii
0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2021-11-11 6:54 UTC (permalink / raw)
To: Po Lu; +Cc: tumashu, emacs-devel
> From: Po Lu <luangruo@yahoo.com>
> Cc: tumashu <tumashu@163.com>, emacs-devel@gnu.org
> Date: Thu, 11 Nov 2021 08:30:13 +0800
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> + (rename-buffer
> >> + (format-spec
> >> + xwidget-webkit-buffer-name-format
> >> + `((?T . ,title)))
> >> + t)))))
>
> > Hmmm... does this mean that the format spec _must_ contain %T?
> > Because otherwise all the buffers will have the same name, no?
> > Which would mean this change introduces a regression wrt how this
> > worked previously, right?
>
> It tells `rename-buffer' to come up with a new name in that cases, which
> is pretty much how the old code worked (except it called
> `generate-new-buffer-name' manually).
Thanks, I have no more comments to that patch.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix)
2021-11-10 9:49 ` tumashu
2021-11-10 9:50 ` Po Lu
2021-11-10 13:54 ` Eli Zaretskii
@ 2021-11-11 10:26 ` Po Lu
2 siblings, 0 replies; 16+ messages in thread
From: Po Lu @ 2021-11-11 10:26 UTC (permalink / raw)
To: tumashu; +Cc: emacs-devel@gnu.org
Thanks, pushed to master (with the changes suggested by Eli.)
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2021-11-11 10:26 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH] xwidget: Add xwidget-webkit-buffer-name-format (Re:Re: About rename xwidget-webkit-buffer-name-prefix) tumashu
2021-11-10 9:32 ` 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
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).