summaryrefslogtreecommitdiff
path: root/lisp/net/eww.el
diff options
context:
space:
mode:
authorMark Oteiza <mvoteiza@udel.edu>2016-02-04 18:00:37 +1100
committerLars Ingebrigtsen <larsi@gnus.org>2016-02-04 18:00:51 +1100
commit535e2bef6dd7b9abe2567f865c8b24a06a555178 (patch)
tree95bc7781ab27b049c3db9e7b127cfad300fb9244 /lisp/net/eww.el
parent8b35b109dd00e42a06f1031c49c471882460184f (diff)
downloademacs-535e2bef6dd7b9abe2567f865c8b24a06a555178.tar.gz
emacs-535e2bef6dd7b9abe2567f865c8b24a06a555178.tar.bz2
emacs-535e2bef6dd7b9abe2567f865c8b24a06a555178.zip
Add a new command to switch between erc buffers
* doc/misc/eww.texi: Document eww-switch-to-buffer and its keybinding * etc/NEWS: Mention new command * lisp/net/eww.el (eww-mode-map): Bind eww-switch-to-buffer to "s" (eww-mode-map): Add menu item (eww-switch-to-buffer): New command
Diffstat (limited to 'lisp/net/eww.el')
-rw-r--r--lisp/net/eww.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 503651c9a38..bc74a0d31d2 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -689,6 +689,7 @@ the like."
(define-key map "R" 'eww-readable)
(define-key map "H" 'eww-list-histories)
(define-key map "E" 'eww-set-character-encoding)
+ (define-key map "s" 'eww-switch-to-buffer)
(define-key map "S" 'eww-list-buffers)
(define-key map "F" 'eww-toggle-fonts)
(define-key map [(meta C)] 'eww-toggle-colors)
@@ -712,6 +713,7 @@ the like."
["View page source" eww-view-source]
["Copy page URL" eww-copy-page-url t]
["List histories" eww-list-histories t]
+ ["Switch to buffer" eww-switch-to-buffer t]
["List buffers" eww-list-buffers t]
["Add bookmark" eww-add-bookmark t]
["List bookmarks" eww-list-bookmarks t]
@@ -1498,6 +1500,24 @@ If CHARSET is nil then use UTF-8."
(eww-reload nil 'utf-8)
(eww-reload nil charset)))
+(defun eww-switch-to-buffer ()
+ "Prompt for an EWW buffer to display in the selected window."
+ (interactive)
+ (let ((completion-extra-properties
+ '(:annotation-function (lambda (buf)
+ (with-current-buffer buf
+ (format " %s" (eww-current-url)))))))
+ (switch-to-buffer
+ (read-buffer "Switch to EWW buffer: "
+ (cl-loop for buf in (nreverse (buffer-list))
+ if (with-current-buffer buf (derived-mode-p 'eww-mode))
+ return buf)
+ t
+ (lambda (bufn)
+ (with-current-buffer
+ (if (consp bufn) (cdr bufn) (get-buffer bufn))
+ (derived-mode-p 'eww-mode)))))))
+
(defun eww-toggle-fonts ()
"Toggle whether to use monospaced or font-enabled layouts."
(interactive)