summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-05-21 02:32:25 +0100
committerjao <jao@gnu.org>2021-05-21 02:32:25 +0100
commit211ecc643cdca54f3f9f403e4c8961108ddac0e9 (patch)
tree76cde833bae669404402b65b5e38daaec500432d
parent19a27822c075c8b056dd6cc9b1dc22609b172f19 (diff)
downloadelibs-211ecc643cdca54f3f9f403e4c8961108ddac0e9.tar.gz
elibs-211ecc643cdca54f3f9f403e4c8961108ddac0e9.tar.bz2
narrowing frenzy (chat buffers)
-rw-r--r--completion.org25
-rw-r--r--eww.org2
2 files changed, 26 insertions, 1 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
diff --git a/eww.org b/eww.org
index 0dd04bb..3801215 100644
--- a/eww.org
+++ b/eww.org
@@ -78,7 +78,7 @@
(eq 'eww-mode
(buffer-local-value 'major-mode b)))
(buffer-list))))))
- (jao-consult-add-buffer-source jao-eww-buffer-source "Web" ?e))
+ (jao-consult-add-buffer-source 'jao-eww-buffer-source "Web" ?e))
#+end_src
* Images
#+begin_src emacs-lisp