It should no longer be possible for Lisp code to abuse internal
xwidget state, or cause crashes with killed xwidgets and such,
so the pedantic checking done in this function is no longer
necessary. (In fact, it is even wrong, as it won't catch
killed xwidgets.)
* lisp/xwidget.el (xwidget-at): Use `xwidget-live-p'.
(declare-function xwidget-webkit-back-forward-list "xwidget.c" (xwidget &optional limit))
(declare-function xwidget-webkit-estimated-load-progress "xwidget.c" (xwidget))
(declare-function xwidget-webkit-set-cookie-storage-file "xwidget.c" (xwidget file))
+(declare-function xwidget-live-p "xwidget.c" (xwidget))
(defgroup xwidget nil
"Displaying native widgets in Emacs buffers."
(defun xwidget-at (pos)
"Return xwidget at POS."
- ;; TODO this function is a bit tedious because the C layer isn't well
- ;; protected yet and xwidgetp apparently doesn't work yet.
(let* ((disp (get-text-property pos 'display))
- (xw (car (cdr (cdr disp)))))
- ;;(if (xwidgetp xw) xw nil)
- (if (equal 'xwidget (car disp)) xw)))
+ (xw (car (cdr (cdr disp)))))
+ (when (xwidget-live-p xw) xw)))