[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/15] xwidget: Bind "beginning-of-buffer" and "end-of-buffer"
From: |
Ricardo Wurmus |
Subject: |
[PATCH 14/15] xwidget: Bind "beginning-of-buffer" and "end-of-buffer" |
Date: |
Mon, 24 Oct 2016 18:41:00 +0200 |
* lisp/xwidget.el: Rebind "beginning-of-buffer" and "end-of-buffer" to
"xwidget-webkit-scroll-top" and "xwidget-webkit-scroll-bottom",
respectively.
(xwidget-webkit-scroll-top,
xwidget-webkit-scroll-bottom): New procedures.
---
lisp/xwidget.el | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index 871b729..8aa0584 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -129,8 +129,8 @@ Interactively, URL defaults to the string looking like a
url around point."
;; (define-key map [remap move-beginning-of-line] 'image-bol)
;; (define-key map [remap move-end-of-line] 'image-eol)
- ;; (define-key map [remap beginning-of-buffer] 'image-bob)
- ;; (define-key map [remap end-of-buffer] 'image-eob)
+ (define-key map [remap beginning-of-buffer] 'xwidget-webkit-scroll-top)
+ (define-key map [remap end-of-buffer] 'xwidget-webkit-scroll-bottom)
map)
"Keymap for `xwidget-webkit-mode'.")
@@ -172,6 +172,19 @@ Interactively, URL defaults to the string looking like a
url around point."
(xwidget-webkit-current-session)
"window.scrollBy(-50, 0);"))
+(defun xwidget-webkit-scroll-top ()
+ "Scroll webkit to the very top."
+ (interactive)
+ (xwidget-webkit-execute-script
+ (xwidget-webkit-current-session)
+ "window.scrollTo(pageXOffset, 0);"))
+
+(defun xwidget-webkit-scroll-bottom ()
+ "Scroll webkit to the very bottom."
+ (interactive)
+ (xwidget-webkit-execute-script
+ (xwidget-webkit-current-session)
+ "window.scrollTo(pageXOffset, window.document.body.clientHeight);"))
;; The xwidget event needs to go into a higher level handler
;; since the xwidget can generate an event even if it's offscreen.
--
2.10.1
- [PATCH 04/15] xwidget: Do not use `xwidget-execute-script-rv' to insert string, (continued)
- [PATCH 04/15] xwidget: Do not use `xwidget-execute-script-rv' to insert string, Ricardo Wurmus, 2016/10/24
- [PATCH 05/15] xwidget: Get title via asynchronous JavaScript., Ricardo Wurmus, 2016/10/24
- [PATCH 06/15] xwidget: Simplify functions to scroll to elements, Ricardo Wurmus, 2016/10/24
- [PATCH 07/15] xwidget: Add function to find element by CSS selector, Ricardo Wurmus, 2016/10/24
- [PATCH 08/15] xwidget: Get selection with asynchronous JavaScript, Ricardo Wurmus, 2016/10/24
- [PATCH 09/15] xwidget: Get URL asynchronously., Ricardo Wurmus, 2016/10/24
- [PATCH 10/15] xwidget: Remove title hack., Ricardo Wurmus, 2016/10/24
- [PATCH 11/15] Let initial WebKit view fill window, Ricardo Wurmus, 2016/10/24
- [PATCH 12/15] Dynamically resize WebKit widget., Ricardo Wurmus, 2016/10/24
- [PATCH 13/15] Implement zoom for WebKit widget., Ricardo Wurmus, 2016/10/24
- [PATCH 14/15] xwidget: Bind "beginning-of-buffer" and "end-of-buffer",
Ricardo Wurmus <=
- [PATCH 15/15] xwidget: Map "previous-line" and "next-line" to scroll, Ricardo Wurmus, 2016/10/24
- Re: [PATCH v2 00/15] xwidget webkit improvements, Paul Eggert, 2016/10/25
- Re: [PATCH v2 00/15] xwidget webkit improvements, Live System User, 2016/10/26
- Re: [PATCH v2 00/15] xwidget webkit improvements, Live System User, 2016/10/26