xwidget: Fix xwidget-at misinterpreting non-xwidget text-properties
authorGeorge Huebner <george@feyor.sh>
Sun, 14 Jul 2024 06:46:07 +0000 (01:46 -0500)
committerEli Zaretskii <eliz@gnu.org>
Thu, 29 Aug 2024 12:11:55 +0000 (15:11 +0300)
'xwidget-open' wrongly assumed the the text-property at
min-position is an xwidget, if it exists; the fix is just
returning nil if the text-property isn't an xwidget.
* lisp/xwidget.el (xwidget-at): Use 'ignore-errors'.  (Bug#72848)

Copyright-paperwork-exempt: yes

lisp/xwidget.el

index bf5987d742fba6f9564aabd0b890bc83dbf442bf..c5a84db6d4a20be38ad4e24def945a9c8d86a97f 100644 (file)
@@ -81,7 +81,7 @@ This returns the result of `make-xwidget'."
 (defun xwidget-at (pos)
   "Return xwidget at POS."
   (let* ((disp (get-text-property pos 'display))
-         (xw (car (cdr (cdr disp)))))
+         (xw (ignore-errors (car (cdr (cdr disp))))))
     (when (xwidget-live-p xw) xw)))