selectrum: add +irc/selectrum-jump-to-channel
This commit is contained in:
parent
26a310d04c
commit
693eb3c9a4
4 changed files with 32 additions and 3 deletions
|
@ -68,8 +68,9 @@ workspace for it."
|
||||||
argument) is non-nil only show channels in current server."
|
argument) is non-nil only show channels in current server."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(call-interactively
|
(call-interactively
|
||||||
(cond ((featurep! :completion ivy) #'+irc/ivy-jump-to-channel)
|
(cond ((featurep! :completion ivy) #'+irc/ivy-jump-to-channel)
|
||||||
((user-error "No jump-to-channel backend is enabled. Enable ivy!")))))
|
((featurep! :completion selectrum) #'+irc/selectrum-jump-to-channel)
|
||||||
|
((user-error "No jump-to-channel backend is enabled. Enable selectrum or ivy!")))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +irc/tracking-next-buffer ()
|
(defun +irc/tracking-next-buffer ()
|
||||||
|
|
25
modules/app/irc/autoload/selectrum.el
Normal file
25
modules/app/irc/autoload/selectrum.el
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
;;; app/irc/autoload/selectrum.el -*- lexical-binding: t; -*-
|
||||||
|
;;;###if (featurep! :completion selectrum)
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +irc/selectrum-jump-to-channel (&optional this-server)
|
||||||
|
"Jump to an open channel or server buffer with selectrum. If THIS-SERVER (universal
|
||||||
|
argument) is non-nil only show channels in current server."
|
||||||
|
(interactive "P")
|
||||||
|
(if (not (circe-server-buffers))
|
||||||
|
(message "No circe buffers available")
|
||||||
|
(when (and this-server (not circe-server-buffer))
|
||||||
|
(setq this-server nil))
|
||||||
|
(when-let
|
||||||
|
((buffer (completing-read
|
||||||
|
(format "Jump to%s: " (if this-server (format " (%s)" (buffer-name circe-server-buffer)) ""))
|
||||||
|
(cl-loop with servers = (if this-server (list circe-server-buffer) (circe-server-buffers))
|
||||||
|
with current-buffer = (current-buffer)
|
||||||
|
for server in servers
|
||||||
|
collect (buffer-name server)
|
||||||
|
nconc
|
||||||
|
(with-current-buffer server
|
||||||
|
(cl-loop for buf in (circe-server-chat-buffers)
|
||||||
|
unless (eq buf current-buffer)
|
||||||
|
collect (buffer-name buf)))))))
|
||||||
|
(switch-to-buffer buffer))))
|
|
@ -141,6 +141,10 @@ playback.")
|
||||||
;; Fail gracefully if not in a circe buffer
|
;; Fail gracefully if not in a circe buffer
|
||||||
(global-set-key [remap tracking-next-buffer] #'+irc/tracking-next-buffer)
|
(global-set-key [remap tracking-next-buffer] #'+irc/tracking-next-buffer)
|
||||||
|
|
||||||
|
(after! marginalia
|
||||||
|
(when (featurep! :completion selectrum)
|
||||||
|
(add-to-list 'marginalia-command-categories '(+irc/selectrum-jump-to-channel . buffer))))
|
||||||
|
|
||||||
(map! :localleader
|
(map! :localleader
|
||||||
(:map circe-mode-map
|
(:map circe-mode-map
|
||||||
"a" #'tracking-next-buffer
|
"a" #'tracking-next-buffer
|
||||||
|
|
|
@ -41,5 +41,4 @@ are nontrivial loading order shenanigans happening that make that not straightfo
|
||||||
*** TODO lookup module
|
*** TODO lookup module
|
||||||
*** TODO taskrunner module (doesn't seem to be an interface yet)
|
*** TODO taskrunner module (doesn't seem to be an interface yet)
|
||||||
*** TODO pass module (creating embark-pass can't be that hard)
|
*** TODO pass module (creating embark-pass can't be that hard)
|
||||||
*** TODO ~+irc/ivy-jump-to-channel~ analogue
|
|
||||||
*** TODO =SPC s B= (~swiper-all~ analogue)
|
*** TODO =SPC s B= (~swiper-all~ analogue)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue