From b78c96044e3252af08bf066e50ed6342341274e2 Mon Sep 17 00:00:00 2001 From: Sean Farley Date: Thu, 26 Mar 2020 13:32:38 -0700 Subject: [PATCH] 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. --- modules/app/irc/autoload/irc.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/app/irc/autoload/irc.el b/modules/app/irc/autoload/irc.el index b560563fe..2f6434af6 100644 --- a/modules/app/irc/autoload/irc.el +++ b/modules/app/irc/autoload/irc.el @@ -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 buffers - (ignore (switch-to-buffer (car buffers))) - (require 'circe) - (delete-other-windows) - (switch-to-buffer (doom-fallback-buffer)) - 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) + (user-error "IRC buffer is already active and selected")))) ;;;###autoload (defun =irc (&optional inhibit-workspace)