[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 4aa7c4b 08/16: xwidget: Get selection with asynchro
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 4aa7c4b 08/16: xwidget: Get selection with asynchronous JavaScript |
Date: |
Wed, 26 Oct 2016 06:07:20 +0000 (UTC) |
branch: master
commit 4aa7c4b4aa2cedbc401b624846285905fb9f8a43
Author: Ricardo Wurmus <address@hidden>
Commit: Paul Eggert <address@hidden>
xwidget: Get selection with asynchronous JavaScript
* lisp/xwidget.el (xwidget-webkit-get-selection): Add PROC argument to
process selection.
(xwidget-webkit-copy-selection-as-kill): Kill selection in callback.
---
lisp/xwidget.el | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index d7ef44d..dc31b85 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -504,15 +504,17 @@ DEFAULT is the default return value."
title))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defun xwidget-webkit-get-selection ()
- "Get the webkit selection."
- (xwidget-webkit-execute-script-rv (xwidget-webkit-current-session)
- "window.getSelection().toString();"))
+(defun xwidget-webkit-get-selection (proc)
+ "Get the webkit selection and pass it to PROC."
+ (xwidget-webkit-execute-script
+ (xwidget-webkit-current-session)
+ "window.getSelection().toString();"
+ proc))
(defun xwidget-webkit-copy-selection-as-kill ()
"Get the webkit selection and put it on the kill-ring."
(interactive)
- (kill-new (xwidget-webkit-get-selection)))
+ (xwidget-webkit-get-selection (lambda (selection) (kill-new selection))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- [Emacs-diffs] master updated (1ea669d -> 5edf76b), Paul Eggert, 2016/10/26
- [Emacs-diffs] master 8809002 09/16: xwidget: Get URL asynchronously., Paul Eggert, 2016/10/26
- [Emacs-diffs] master 4aa7c4b 08/16: xwidget: Get selection with asynchronous JavaScript,
Paul Eggert <=
- [Emacs-diffs] master cc3b868 05/16: xwidget: Get title via asynchronous JavaScript., Paul Eggert, 2016/10/26
- [Emacs-diffs] master ca479f9 15/16: xwidget: Map "previous-line" and "next-line" to scroll, Paul Eggert, 2016/10/26
- [Emacs-diffs] master 01c2fba 14/16: xwidget: Bind "beginning-of-buffer" and "end-of-buffer", Paul Eggert, 2016/10/26
- [Emacs-diffs] master 623deaf 02/16: xwidget: Pass JavaScript return value to optional callback procedure, Paul Eggert, 2016/10/26
- [Emacs-diffs] master ff80a9c 04/16: xwidget: Do not use `xwidget-execute-script-rv' to insert string, Paul Eggert, 2016/10/26
- [Emacs-diffs] master 7ee870e 03/16: Remove scrolled window container around WebKit widget, Paul Eggert, 2016/10/26
- [Emacs-diffs] master 67e0331 10/16: xwidget: Remove title hack., Paul Eggert, 2016/10/26
- [Emacs-diffs] master e443eab 13/16: Implement zoom for WebKit widget., Paul Eggert, 2016/10/26
- [Emacs-diffs] master d781662 01/16: xwidget: Use WebKit2 API, Paul Eggert, 2016/10/26
- [Emacs-diffs] master c483fa6 11/16: Let initial WebKit view fill window, Paul Eggert, 2016/10/26