summaryrefslogtreecommitdiffhomepage
path: root/eww.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-05-20 06:13:31 +0100
committerjao <jao@gnu.org>2021-05-20 06:13:31 +0100
commitc29f6653150081aafa1ddcb7d6518cccb464b7c2 (patch)
tree19213708d62fbf396a389ba3f38aa1f6cab22324 /eww.org
parent64087b0f9620c0273d5258430f4c1f73b783f49f (diff)
downloadelibs-c29f6653150081aafa1ddcb7d6518cccb464b7c2.tar.gz
elibs-c29f6653150081aafa1ddcb7d6518cccb464b7c2.tar.bz2
eww/w3m consult narrowing refactored
Diffstat (limited to 'eww.org')
-rw-r--r--eww.org28
1 files changed, 28 insertions, 0 deletions
diff --git a/eww.org b/eww.org
index e2e9ae5..0dd04bb 100644
--- a/eww.org
+++ b/eww.org
@@ -52,6 +52,34 @@
(eww-reload t))
(call-interactively 'eww-reload)))
#+end_src
+* Consult narrowing
+ #+begin_src emacs-lisp
+ (with-eval-after-load "consult"
+ (defvar jao-eww-consult-history nil)
+ (defvar jao-eww-buffer-source
+ (list :name "eww buffer"
+ :category 'eww-buffer
+ :hidden t
+ :narrow (cons ?e "eww")
+ :annotate (lambda (c) (get-text-property 0 'url c))
+ :history 'jao-eww-consult-history
+ :action (lambda (b)
+ (jao-afio--goto-www)
+ (switch-to-buffer (get-text-property 0 'buffer b)))
+ :items
+ (lambda ()
+ (seq-map (lambda (b)
+ (with-current-buffer b
+ (let ((tl (or (plist-get eww-data :title) ""))
+ (url (or (eww-current-url) "<no url>")))
+ (propertize (if (string-blank-p tl) url tl)
+ 'buffer b 'url url))))
+ (seq-filter (lambda (b)
+ (eq 'eww-mode
+ (buffer-local-value 'major-mode b)))
+ (buffer-list))))))
+ (jao-consult-add-buffer-source jao-eww-buffer-source "Web" ?e))
+ #+end_src
* Images
#+begin_src emacs-lisp
(defun jao-eww-next-image ()