summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2016-09-20 21:53:45 +0200
committerrekado <rekado@elephly.net>2016-09-20 22:11:46 +0200
commit51816d9c9cf940d1592a4f989ee4e9a90e96ad28 (patch)
tree2dfc04fd6a60e591b72f7e4434f460630f5a5ead /lisp
parentaf660e60fc8160cace416e144fb6f817ee74b7d4 (diff)
WIP xwidgets: bind beginning/end of buffer.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/xwidget.el17
1 files changed, 15 insertions, 2 deletions
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index 0892030246..6ee4c672f6 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.