From: Puneeth Chaganti <punchagan@muse-amuse.in>
To: 24019@debbugs.gnu.org
Subject: bug#24019: 25.1.50; Allow using a custom callback with xwidget
Date: Mon, 18 Jul 2016 18:00:48 +0530 [thread overview]
Message-ID: <87vb03qgav.fsf@muse-amuse.in> (raw)
[-- Attachment #1: Type: text/plain, Size: 328 bytes --]
Hello,
`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!
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-the-callback-set-as-widget-s-property.patch --]
[-- Type: text/x-diff, Size: 1295 bytes --]
From 63d1b53583263065edea3ee53d708693415a6057 Mon Sep 17 00:00:00 2001
From: Puneeth Chaganti <punchagan@muse-amuse.in>
Date: Mon, 18 Jul 2016 16:34:24 +0530
Subject: [PATCH 1/2] Use the callback set as widget's property
Revert a commented piece of code, that allows using a different callback
for each xwidget on an event, instead of a single global one.
* lisp/xwidget.el (xwidget-event-handler): Use callback widget property
---
lisp/xwidget.el | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index 7a0ca8b..3434e24 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -172,12 +172,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.
--
2.7.4
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Allow-specifying-the-callback-if-new-session.patch --]
[-- Type: text/x-diff, Size: 1508 bytes --]
From 095f02a5581c2c5c157ec312a64288b0c675da74 Mon Sep 17 00:00:00 2001
From: Puneeth Chaganti <punchagan@muse-amuse.in>
Date: Mon, 18 Jul 2016 17:46:19 +0530
Subject: [PATCH 2/2] Allow specifying the callback if new session
This change makes it easier to create xwidgets with their callbacks that
are invoked by the event handler
* lisp/xwidget.el (xwidget-webkit-new-session): Optional callback arg
---
lisp/xwidget.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index 3434e24..0f6751e 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -416,16 +416,17 @@ xwidget-webkit-fit-width
(car (window-inside-pixel-edges)))
1000))
-(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)))
(insert " 'a' adjusts the xwidget size.")
(setq xw (xwidget-insert 1 'webkit bufname 1000 1000))
- (xwidget-put xw 'callback 'xwidget-webkit-callback)
+ (xwidget-put xw 'callback callback)
(xwidget-webkit-mode)
(xwidget-webkit-goto-uri (xwidget-webkit-last-session) url)))
--
2.7.4
next reply other threads:[~2016-07-18 12:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-18 12:30 Puneeth Chaganti [this message]
2020-01-20 20:23 ` bug#24019: 25.1.50; Allow using a custom callback with xwidget Stefan Kangas
2020-08-11 14:21 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vb03qgav.fsf@muse-amuse.in \
--to=punchagan@muse-amuse.in \
--cc=24019@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).