irc: only use the switch buffer logic during creation

This fixes a problem where calling IRC (e.g. C-c I I) will switch to
a (seemingly random but is ordered by load order) buffer.

It also adds a `user-error` when the IRC workspace is already selected.
This commit is contained in:
Sean Farley 2020-03-26 13:32:38 -07:00
parent 4b20c7206e
commit b78c96044e

View file

@ -7,12 +7,14 @@
(not inhibit-workspace))
(+workspace-switch +irc--workspace-name 'auto-create))
(let ((buffers (doom-buffers-in-mode 'circe-mode nil t)))
(if (not (member (window-buffer) buffers))
(if buffers
(ignore (switch-to-buffer (car buffers)))
(require 'circe)
(delete-other-windows)
(switch-to-buffer (doom-fallback-buffer))
t)))
t)
(user-error "IRC buffer is already active and selected"))))
;;;###autoload
(defun =irc (&optional inhibit-workspace)