irc: add +irc/tracking-next-buffer

This way the user won't accidentally switch to the next unread buffer in
the wrong workspacee and end up in a weird state.
This commit is contained in:
Sean Farley 2019-01-21 17:20:22 -08:00
parent ffc9e0f48e
commit 274d9a6c0c
3 changed files with 21 additions and 14 deletions

View file

@ -43,15 +43,15 @@ custom keybinding.
When in a circe buffer these keybindings will be available. When in a circe buffer these keybindings will be available.
| command | key | description | | command | key | description |
|------------------------+-----------+----------------------------------------------| |-----------------------------+-----------+----------------------------------------------|
| ~tracking-next-buffer~ | =SPC m a= | Switch to the next active buffer | | ~+irc/tracking-next-buffer~ | =SPC m a= | Switch to the next active buffer |
| ~circe-command-JOIN~ | =SPC m j= | Join a channel | | ~circe-command-JOIN~ | =SPC m j= | Join a channel |
| ~+irc/send-message~ | =SPC m m= | Send a private message | | ~+irc/send-message~ | =SPC m m= | Send a private message |
| ~circe-command-NAMES~ | =SPC m n= | List the names of the current channel | | ~circe-command-NAMES~ | =SPC m n= | List the names of the current channel |
| ~circe-command-PART~ | =SPC m p= | Part the current channel | | ~circe-command-PART~ | =SPC m p= | Part the current channel |
| ~+irc/quit~ | =SPC m Q= | Kill the current circe session and workgroup | | ~+irc/quit~ | =SPC m Q= | Kill the current circe session and workgroup |
| ~circe-reconnect~ | =SPC m R= | Reconnect the current server | | ~circe-reconnect~ | =SPC m R= | Reconnect the current server |
* Configuration * Configuration
Use ~set-irc-server!~ to configure IRC servers. Its second argument (a plist) Use ~set-irc-server!~ to configure IRC servers. Its second argument (a plist)

View file

@ -138,13 +138,19 @@ playback.")
(persp-remove-buffer buf persp)))) (persp-remove-buffer buf persp))))
(add-hook 'circe-mode-hook #'+irc|add-circe-buffer-to-persp) (add-hook 'circe-mode-hook #'+irc|add-circe-buffer-to-persp)
(defun +irc/tracking-next-buffer ()
"Dissables switching to an unread buffer unless in the irc workspace."
(interactive)
(when (derived-mode-p 'circe-mode)
(tracking-next-buffer)))
(after! solaire-mode (after! solaire-mode
;; distinguish chat/channel buffers from server buffers. ;; distinguish chat/channel buffers from server buffers.
(add-hook 'circe-chat-mode-hook #'solaire-mode)) (add-hook 'circe-chat-mode-hook #'solaire-mode))
(map! :localleader (map! :localleader
(:map circe-mode-map (:map circe-mode-map
"a" #'tracking-next-buffer "a" #'+irc/tracking-next-buffer
"j" #'circe-command-JOIN "j" #'circe-command-JOIN
"m" #'+irc/send-message "m" #'+irc/send-message
"p" #'circe-command-PART "p" #'circe-command-PART

View file

@ -172,10 +172,11 @@
;; IRC ;; IRC
(:when (featurep! :app irc) (:when (featurep! :app irc)
(:prefix ("I" . "irc") (:prefix ("I" . "irc")
:desc "Open irc app" "i" #'=irc :desc "Open irc app" "i" #'=irc
:desc "Quit irc" "q" #'+irc/quit :desc "Next unread buffer" "a" #'+irc/tracking-next-buffer
:desc "Reconnect all" "r" #'circe-reconnect-all :desc "Quit irc" "q" #'+irc/quit
:desc "Send message" "s" #'+irc/send-message :desc "Reconnect all" "r" #'circe-reconnect-all
:desc "Send message" "s" #'+irc/send-message
(:when (featurep! :completion ivy) (:when (featurep! :completion ivy)
:desc "Jump to channel" "j" #'irc/ivy-jump-to-channel))) :desc "Jump to channel" "j" #'irc/ivy-jump-to-channel)))
;; Twitter ;; Twitter