1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00

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.
This commit is contained in:
Grégoire Jadi 2013-06-24 10:22:45 +02:00
parent d65ea7dd1d
commit da95bc007d
4 changed files with 37 additions and 2 deletions

View file

@ -454,6 +454,16 @@ It can be retrieved with `(xwidget-get XWIDGET PROPNAME)'."
;;(add-hook 'window-configuration-change-hook 'xwidget-cleanup)
(add-hook 'window-configuration-change-hook 'xwidget-delete-zombies)
(defun xwidget-kill-buffer-query-function ()
"Ask beforek illing a buffer that has xwidgets."
(let ((xwidgets (get-buffer-xwidgets (current-buffer))))
(or (not xwidgets)
(yes-or-no-p
(format "Buffer %S has xwidgets; kill it? "
(buffer-name (current-buffer)))))))
(add-hook 'kill-buffer-query-functions 'xwidget-kill-buffer-query-function)
;;killflash is sadly not reliable yet.
(defvar xwidget-webkit-kill-flash-oneshot t)
(defun xwidget-webkit-kill-flash ()