summaryrefslogtreecommitdiffhomepage
path: root/completion.org
diff options
context:
space:
mode:
Diffstat (limited to 'completion.org')
-rw-r--r--completion.org25
1 files changed, 25 insertions, 0 deletions
diff --git a/completion.org b/completion.org
index 741bb26..04d09dc 100644
--- a/completion.org
+++ b/completion.org
@@ -185,11 +185,36 @@
(add-hook 'minibuffer-setup-hook #'jao-consult-initial-narrow)
+ (defmacro jao-consult--mode-buffers (&rest modes)
+ `(lambda ()
+ (seq-map #'buffer-name
+ (seq-filter (lambda (b)
+ (with-current-buffer b
+ (derived-mode-p ,@modes)))
+ (buffer-list)))))
+
(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
+*** narrowing chats
+ #+begin_src emacs-lisp
+ (defvar jao-chat-buffer-source
+ (list :name "chats"
+ :category 'buffer
+ :action #'pop-to-buffer
+ :hidden t
+ :narrow (cons ?c "chats")
+ :items (jao-consult--mode-buffers 'erc-mode
+ 'signel-chat-mode
+ 'slack-message-buffer-mode
+ 'slack-thread-message-buffer-mode
+ 'telega-root-mode
+ 'telega-chat-mode)))
+ (jao-consult-add-buffer-source 'jao-chat-buffer-source)
+ #+end_src
+
* embark
*** packages
#+begin_src emacs-lisp