From a9534e1a839f5a98569d516f56e15c77146db62b Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 27 Sep 2021 18:20:34 -0500 Subject: [PATCH] Add circe-buffer-source --- init.el | 2 ++ lisp/acdw-consult.el | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/init.el b/init.el index 84e0945..6620f45 100644 --- a/init.el +++ b/init.el @@ -1211,6 +1211,8 @@ specific to most general, they are these: "M-s e" #'consult-isearch "M-s l" #'consult-line)) + (:option (append consult-buffer-sources) #'circe-buffer-source) + (consult-history-to-modes ((minibuffer-local-map . nil) (shell-mode-map . shell-mode-hook) (term-mode-map . term-mode-hook) diff --git a/lisp/acdw-consult.el b/lisp/acdw-consult.el index daad645..84a7fea 100644 --- a/lisp/acdw-consult.el +++ b/lisp/acdw-consult.el @@ -67,4 +67,27 @@ if ripgrep is installed, otherwise `consult-grep'." defuns))) `(progn ,@ (nreverse defuns)))) +;;; Circe buffers source + +(require 'cl-lib) +(autoload 'circe-server-buffers "circe") +(autoload 'circe-server-chat-buffers "circe") + +(defun circe-all-buffers () + (cl-loop with servers = (circe-server-buffers) + for server in servers + collect server + nconc + (with-current-buffer server + (cl-loop for buf in (circe-server-chat-buffers) + collect buf)))) + +(defvar circe-buffer-source + `(:name "circe" + :hidden t + :narrow ?c + :category buffer + :state ,#'consult--buffer-state + :items ,(lambda () (mapcar #'buffer-name (circe-all-buffers))))) + (provide 'acdw-consult)