summaryrefslogtreecommitdiff
path: root/lisp/xwidget.el
diff options
context:
space:
mode:
authorFeng Shu <tumashu@163.com>2021-11-11 18:24:49 +0800
committerPo Lu <luangruo@yahoo.com>2021-11-11 18:26:05 +0800
commitf69a808ddcf7b2fd8cc2eacf99dd98248b9c455a (patch)
treea8c7048c85053e1fb86f10f78149f91a09dac42f /lisp/xwidget.el
parent12a638d845ec19f632f4257fbeaf00c9a87f7d54 (diff)
downloademacs-f69a808ddcf7b2fd8cc2eacf99dd98248b9c455a.tar.gz
xwidget: Add xwidget-webkit-buffer-name-format.
* lisp/xwidget.el (xwidget-webkit-buffer-name-prefix): Remove variable. (xwidget-webkit-buffer-name-format): New variable. (xwidget-webkit-callback): Use xwidget-webkit-buffer-name-format instead. (format-spec): required. * etc/NEWS: Note xwidget-webkit-buffer-name-format.
Diffstat (limited to 'lisp/xwidget.el')
-rw-r--r--lisp/xwidget.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index 2c7b4dd83da..8078f1d01b0 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 @@ This returns the result of `make-xwidget'."
: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 instance, XWIDGET-EVENT-TYPE depends on the originating xwidget."
;; 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)