diff options
| author | Feng Shu | 2021-11-11 18:24:49 +0800 |
|---|---|---|
| committer | Po Lu | 2021-11-11 18:26:05 +0800 |
| commit | f69a808ddcf7b2fd8cc2eacf99dd98248b9c455a (patch) | |
| tree | a8c7048c85053e1fb86f10f78149f91a09dac42f | |
| parent | 12a638d845ec19f632f4257fbeaf00c9a87f7d54 (diff) | |
| download | emacs-f69a808ddcf7b2fd8cc2eacf99dd98248b9c455a.tar.gz emacs-f69a808ddcf7b2fd8cc2eacf99dd98248b9c455a.zip | |
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.
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/xwidget.el | 16 |
2 files changed, 14 insertions, 7 deletions
| @@ -454,8 +454,9 @@ This is a convenience function to extract the field data from | |||
| 454 | ** Xwidgets | 454 | ** Xwidgets |
| 455 | 455 | ||
| 456 | --- | 456 | --- |
| 457 | *** New user option 'xwidget-webkit-buffer-name-prefix'. | 457 | *** New user option 'xwidget-webkit-buffer-name-format'. |
| 458 | This allows the user to change the webkit buffer names. | 458 | Using this option you can control how the xwidget-webkit buffers are |
| 459 | named. | ||
| 459 | 460 | ||
| 460 | +++ | 461 | +++ |
| 461 | *** New minor mode 'xwidget-webkit-edit-mode'. | 462 | *** New minor mode 'xwidget-webkit-edit-mode'. |
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 @@ | |||
| 33 | 33 | ||
| 34 | (require 'cl-lib) | 34 | (require 'cl-lib) |
| 35 | (require 'bookmark) | 35 | (require 'bookmark) |
| 36 | (require 'format-spec) | ||
| 36 | 37 | ||
| 37 | (declare-function make-xwidget "xwidget.c" | 38 | (declare-function make-xwidget "xwidget.c" |
| 38 | (type title width height arguments &optional buffer related)) | 39 | (type title width height arguments &optional buffer related)) |
| @@ -95,8 +96,11 @@ This returns the result of `make-xwidget'." | |||
| 95 | :group 'web | 96 | :group 'web |
| 96 | :prefix "xwidget-webkit-") | 97 | :prefix "xwidget-webkit-") |
| 97 | 98 | ||
| 98 | (defcustom xwidget-webkit-buffer-name-prefix "*xwidget-webkit: " | 99 | (defcustom xwidget-webkit-buffer-name-format "*xwidget-webkit: %T*" |
| 99 | "Buffer name prefix used by `xwidget-webkit' buffers." | 100 | "Template for naming `xwidget-webkit' buffers. |
| 101 | It can use the following special constructs: | ||
| 102 | |||
| 103 | %T -- the title of the Web page loaded by the xwidget." | ||
| 100 | :type 'string | 104 | :type 'string |
| 101 | :version "29.1") | 105 | :version "29.1") |
| 102 | 106 | ||
| @@ -372,9 +376,11 @@ XWIDGET instance, XWIDGET-EVENT-TYPE depends on the originating xwidget." | |||
| 372 | ;; Do not adjust webkit size to window here, the | 376 | ;; Do not adjust webkit size to window here, the |
| 373 | ;; selected window can be the mini-buffer window | 377 | ;; selected window can be the mini-buffer window |
| 374 | ;; unwantedly. | 378 | ;; unwantedly. |
| 375 | (rename-buffer (concat xwidget-webkit-buffer-name-prefix | 379 | (rename-buffer |
| 376 | title "*") | 380 | (format-spec |
| 377 | t))))) | 381 | xwidget-webkit-buffer-name-format |
| 382 | `((?T . ,title))) | ||
| 383 | t))))) | ||
| 378 | ((eq xwidget-event-type 'decide-policy) | 384 | ((eq xwidget-event-type 'decide-policy) |
| 379 | (let ((strarg (nth 3 last-input-event))) | 385 | (let ((strarg (nth 3 last-input-event))) |
| 380 | (if (string-match ".*#\\(.*\\)" strarg) | 386 | (if (string-match ".*#\\(.*\\)" strarg) |