summaryrefslogtreecommitdiffhomepage
path: root/eww.org
diff options
context:
space:
mode:
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 ()