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."
|
||||
(interactive "P")
|
||||
(call-interactively
|
||||
(cond ((featurep! :completion ivy) #'+irc/ivy-jump-to-channel)
|
||||
((user-error "No jump-to-channel backend is enabled. Enable ivy!")))))
|
||||
(cond ((featurep! :completion ivy) #'+irc/ivy-jump-to-channel)
|
||||
((featurep! :completion selectrum) #'+irc/selectrum-jump-to-channel)
|
||||
((user-error "No jump-to-channel backend is enabled. Enable selectrum or ivy!")))))
|
||||
|
||||
;;;###autoload
|
||||
(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
|
||||
(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 circe-mode-map
|
||||
"a" #'tracking-next-buffer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue