irc: add +irc|add-circe-buffer-to-persp

A convenience function that prevents a new circe buffer (e.g. a new
message pop up) from being added automatically to whichever is current
workspace and instead adds it to the irc workspace.
This commit is contained in:
Sean Farley 2019-01-21 17:13:52 -08:00
parent 8a0098ee52
commit 7f205130af

View file

@ -125,6 +125,19 @@ playback.")
+irc--workspace-name))))
(add-hook 'doom-real-buffer-functions #'+circe-buffer-p)
(defun +irc|add-circe-buffer-to-persp ()
(let ((persp (get-current-persp))
(buf (current-buffer)))
;; only add a new circe buffer to the irc workspace when we're in another
;; workspace
(unless (eq (safe-persp-name persp) +irc--workspace-name)
;; add new circe buffers to the persp containing circe buffers
(persp-add-buffer buf
(persp-get-by-name +irc--workspace-name))
;; remove new buffer from accidental workspace
(persp-remove-buffer buf persp))))
(add-hook 'circe-mode-hook #'+irc|add-circe-buffer-to-persp)
(after! solaire-mode
;; distinguish chat/channel buffers from server buffers.
(add-hook 'circe-chat-mode-hook #'solaire-mode))