diff options
| author | Grégoire Jadi | 2013-06-24 10:22:45 +0200 |
|---|---|---|
| committer | Grégoire Jadi | 2013-06-24 10:22:45 +0200 |
| commit | da95bc007d161d6d901b7600120a97fd2f54ce4b (patch) | |
| tree | 1a1ac334d23acedd4dd97cea4066537c67a36cdc /lisp | |
| parent | d65ea7dd1d4aa93a44c39a44d0e79fca6e912690 (diff) | |
| download | emacs-da95bc007d161d6d901b7600120a97fd2f54ce4b.tar.gz emacs-da95bc007d161d6d901b7600120a97fd2f54ce4b.zip | |
Handle xwidgets like processes and delete them when their buffer is killed.
* lisp/xwidget.el (xwidget-kill-buffer-query-function): New function to
query a user before killing a buffer with xwidgets in it.
This function is stored in `kill-buffer-query-functions' and called from
`kill-buffer'.
* src/buffer.c (Fkill_buffer): Call `kill_buffer_xwidgets'.
* src/xwidget.c (kill_buffer_xwidgets): Delete xwidgets attached to the
specified buffer.
* src/xwidget.h (kill_buffer_xwidgets): Add definition.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/xwidget.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/xwidget.el b/lisp/xwidget.el index 9be7c4a60ff..4d2453e9d2d 100644 --- a/lisp/xwidget.el +++ b/lisp/xwidget.el | |||
| @@ -454,6 +454,16 @@ It can be retrieved with `(xwidget-get XWIDGET PROPNAME)'." | |||
| 454 | ;;(add-hook 'window-configuration-change-hook 'xwidget-cleanup) | 454 | ;;(add-hook 'window-configuration-change-hook 'xwidget-cleanup) |
| 455 | (add-hook 'window-configuration-change-hook 'xwidget-delete-zombies) | 455 | (add-hook 'window-configuration-change-hook 'xwidget-delete-zombies) |
| 456 | 456 | ||
| 457 | (defun xwidget-kill-buffer-query-function () | ||
| 458 | "Ask beforek illing a buffer that has xwidgets." | ||
| 459 | (let ((xwidgets (get-buffer-xwidgets (current-buffer)))) | ||
| 460 | (or (not xwidgets) | ||
| 461 | (yes-or-no-p | ||
| 462 | (format "Buffer %S has xwidgets; kill it? " | ||
| 463 | (buffer-name (current-buffer))))))) | ||
| 464 | |||
| 465 | (add-hook 'kill-buffer-query-functions 'xwidget-kill-buffer-query-function) | ||
| 466 | |||
| 457 | ;;killflash is sadly not reliable yet. | 467 | ;;killflash is sadly not reliable yet. |
| 458 | (defvar xwidget-webkit-kill-flash-oneshot t) | 468 | (defvar xwidget-webkit-kill-flash-oneshot t) |
| 459 | (defun xwidget-webkit-kill-flash () | 469 | (defun xwidget-webkit-kill-flash () |