aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/xwidget.el58
1 files changed, 26 insertions, 32 deletions
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index b38f7948c6c..8bb43fec38d 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -97,18 +97,12 @@ defaults to the string looking like a url around the cursor position."
97 (cons (aref xwi 2) 97 (cons (aref xwi 2)
98 (aref xwi 3)))) 98 (aref xwi 3))))
99 99
100(defmacro xwidget-image-mode-navigation-adaptor (fn) 100(defadvice image-display-size (around image-display-size-for-xwidget
101 "Image code adaptor. `image-mode' FN is called." 101 (spec &optional pixels frame)
102 `(lambda () (interactive) 102 activate)
103 (cl-flet ((image-display-size (spec) (xwidget-image-display-size spec))) 103 (if (eq (car spec) 'xwidget)
104 (funcall ,fn )))) 104 (setq ad-return-value (xwidget-image-display-size spec pixels frame))
105 105 ad-do-it))
106(defmacro xwidget-image-mode-navigation-adaptor-p (fn)
107 "Image code adaptor. `image-mode' FN is called with interactive arg."
108 `(lambda (n) (interactive "p")
109 (cl-flet ((image-display-size (spec) (xwidget-image-display-size spec)))
110 (funcall ,fn n))))
111
112 106
113;;todo. 107;;todo.
114;; - check that the webkit support is compiled in 108;; - check that the webkit support is compiled in
@@ -123,26 +117,26 @@ defaults to the string looking like a url around the cursor position."
123 (define-key map "w" 'xwidget-webkit-current-url) 117 (define-key map "w" 'xwidget-webkit-current-url)
124 118
125 ;;similar to image mode bindings 119 ;;similar to image mode bindings
126 (define-key map (kbd "SPC") (xwidget-image-mode-navigation-adaptor 'image-scroll-up)) 120 (define-key map (kbd "SPC") 'image-scroll-up)
127 (define-key map (kbd "DEL") (xwidget-image-mode-navigation-adaptor 'image-scroll-down)) 121 (define-key map (kbd "DEL") 'image-scroll-down)
128 122
129 (define-key map [remap scroll-up] (xwidget-image-mode-navigation-adaptor 'image-scroll-up)) 123 (define-key map [remap scroll-up] 'image-scroll-up)
130 (define-key map [remap scroll-up-command] (xwidget-image-mode-navigation-adaptor 'image-scroll-up)) 124 (define-key map [remap scroll-up-command] 'image-scroll-up)
131 125
132 (define-key map [remap scroll-down] (xwidget-image-mode-navigation-adaptor 'image-scroll-down)) 126 (define-key map [remap scroll-down] 'image-scroll-down)
133 (define-key map [remap scroll-down-command] (xwidget-image-mode-navigation-adaptor 'image-scroll-down)) 127 (define-key map [remap scroll-down-command] 'image-scroll-down)
134 128
135 (define-key map [remap forward-char] (xwidget-image-mode-navigation-adaptor-p 'image-forward-hscroll)) 129 (define-key map [remap forward-char] 'image-forward-hscroll)
136 (define-key map [remap backward-char] (xwidget-image-mode-navigation-adaptor-p 'image-backward-hscroll)) 130 (define-key map [remap backward-char] 'image-backward-hscroll)
137 (define-key map [remap right-char] (xwidget-image-mode-navigation-adaptor-p 'image-forward-hscroll)) 131 (define-key map [remap right-char] 'image-forward-hscroll)
138 (define-key map [remap left-char] (xwidget-image-mode-navigation-adaptor-p 'image-backward-hscroll)) 132 (define-key map [remap left-char] 'image-backward-hscroll)
139 (define-key map [remap previous-line] (xwidget-image-mode-navigation-adaptor-p 'image-previous-line)) 133 (define-key map [remap previous-line] 'image-previous-line)
140 (define-key map [remap next-line] (xwidget-image-mode-navigation-adaptor-p 'image-next-line)) 134 (define-key map [remap next-line] 'image-next-line)
141 135
142 (define-key map [remap move-beginning-of-line] (xwidget-image-mode-navigation-adaptor-p 'image-bol)) 136 (define-key map [remap move-beginning-of-line] 'image-bol)
143 (define-key map [remap move-end-of-line] (xwidget-image-mode-navigation-adaptor-p 'image-eol)) 137 (define-key map [remap move-end-of-line] 'image-eol)
144 (define-key map [remap beginning-of-buffer] (xwidget-image-mode-navigation-adaptor 'image-bob)) 138 (define-key map [remap beginning-of-buffer] 'image-bob)
145 (define-key map [remap end-of-buffer] (xwidget-image-mode-navigation-adaptor 'image-eob)) 139 (define-key map [remap end-of-buffer] 'image-eob)
146 map) 140 map)
147 "Keymap for `xwidget-webkit-mode'.") 141 "Keymap for `xwidget-webkit-mode'.")
148 142