summaryrefslogtreecommitdiffhomepage
path: root/completion.org
diff options
context:
space:
mode:
Diffstat (limited to 'completion.org')
-rw-r--r--completion.org66
1 files changed, 10 insertions, 56 deletions
diff --git a/completion.org b/completion.org
index 5c1a050..741bb26 100644
--- a/completion.org
+++ b/completion.org
@@ -175,66 +175,20 @@
#+end_src
*** narrow helpers
#+begin_src emacs-lisp
- (defvar jao-consult-www-narrow nil)
+ (defvar jao-consult-narrow nil)
(defun jao-consult-initial-narrow ()
- (when (and jao-consult-www-narrow
- (eq this-command #'consult-buffer)
- (string-equal "Web" (jao-afio-current-frame)))
+ (when (eq this-command #'consult-buffer)
+ (when-let (c (cdr (assoc (jao-afio-current-frame) jao-consult-narrow)))
(setq unread-command-events
- (append unread-command-events `(,jao-consult-www-narrow 32)))))
+ (append unread-command-events `(,c 32))))))
+
(add-hook 'minibuffer-setup-hook #'jao-consult-initial-narrow)
- #+end_src
-*** narrowing eww buffers
- #+begin_src emacs-lisp
- (with-eval-after-load "jao-eww-session"
- (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 (jao-eww-buffer-title) ""))
- (url (or (jao-eww--current-url) "<no url>")))
- (propertize (if (string-blank-p tl) url tl)
- 'buffer b 'url url))))
- (jao-eww-session--list-buffers)))))
-
- (add-to-list 'consult-buffer-sources 'jao-eww-buffer-source t)
- (unless jao-afio-use-w3m (setq jao-consult-www-narrow ?e)))
- #+end_src
-*** narrowing w3m buffers
- #+begin_src emacs-lisp
- (with-eval-after-load "w3m"
- (defvar jao-consult-w3m-buffer-history nil)
- (setq jao-consult-w3m-source
- (list :name "w3m buffer"
- :category 'w3m-buffer
- :hidden t
- :narrow (cons ?w "w3m")
- :annotate (lambda (b) (get-text-property 0 'url b))
- :history 'jao-consult-w3m-buffer-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
- (propertize w3m-current-title
- 'buffer b
- 'url w3m-current-url)))
- (w3m-list-buffers)))))
- (when jao-afio-use-w3m (setq jao-consult-www-narrow ?w))
- (add-to-list 'consult-buffer-sources 'jao-consult-w3m-source t))
+
+ (defun jao-consult-add-buffer-source (src &optional aframe key)
+ (add-to-list 'consult-buffer-sources src t)
+ (when (and aframe key)
+ (add-to-list 'jao-consult-narrow (cons aframe key))))
#+end_src
* embark
*** packages