GNU bug report logs -
#24019
25.1.50; Allow using a custom callback with xwidget
Previous Next
Reported by: Puneeth Chaganti <punchagan <at> muse-amuse.in>
Date: Mon, 18 Jul 2016 12:32:02 UTC
Severity: wishlist
Tags: fixed, patch
Found in version 25.1.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #13 received at 24019 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefan <at> marxist.se> writes:
>> `xwidgets.el' seems to have some commented code that used to allow using
>> a different callback on each xwidget. This functionality is useful to
>> have and this is a patch that uncomments this code. I've tested the
>> code, and it seems to work, and I'm not really sure, why this was
>> commented in the first place.
>>
>> Thanks!
>
> Could you please help review the below patches? They were submitted
> to the Emacs bug list in 2016, but no one has followed up on them.
I've re-spun the patch for Emacs 28. It seems "obviously correct", and
by doing some cursory testing, it doesn't seem to have broken anything,
so I'll just push it. If this leads to any problems, Joakim, feel free
to revert it.
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index aed6c09122..a4c15a1e26 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -207,12 +207,8 @@ xwidget-event-handler
(let*
((xwidget-event-type (nth 1 last-input-event))
(xwidget (nth 2 last-input-event))
- ;;(xwidget-callback (xwidget-get xwidget 'callback))
- ;;TODO stopped working for some reason
- )
- ;;(funcall xwidget-callback xwidget xwidget-event-type)
- (message "xw callback %s" xwidget)
- (funcall 'xwidget-webkit-callback xwidget xwidget-event-type)))
+ (xwidget-callback (xwidget-get xwidget 'callback)))
+ (funcall xwidget-callback xwidget xwidget-event-type)))
(defun xwidget-webkit-callback (xwidget xwidget-event-type)
"Callback for xwidgets.
@@ -481,10 +477,11 @@ xwidget-webkit-adjust-size-in-frame
(add-to-list 'window-size-change-functions
'xwidget-webkit-adjust-size-in-frame))
-(defun xwidget-webkit-new-session (url)
+(defun xwidget-webkit-new-session (url &optional callback)
"Create a new webkit session buffer with URL."
(let*
((bufname (generate-new-buffer-name "*xwidget-webkit*"))
+ (callback (or callback #'xwidget-webkit-callback))
xw)
(setq xwidget-webkit-last-session-buffer (switch-to-buffer
(get-buffer-create bufname)))
@@ -494,7 +491,7 @@ xwidget-webkit-new-session
(setq xw (xwidget-insert 1 'webkit bufname
(window-pixel-width)
(window-pixel-height)))
- (xwidget-put xw 'callback 'xwidget-webkit-callback)
+ (xwidget-put xw 'callback callback)
(xwidget-webkit-mode)
(xwidget-webkit-goto-uri (xwidget-webkit-last-session) url)))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 4 years and 281 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.