doomemacs / doomemacs/core

Circe buffers are not correctly added to the *IRC* workspace

Open
#5,958 0 comments 1 reaction 0 assignees View on GitHub
is:bug needs-triage
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### What did you expect to happen?

I configured `:app irc` to use my [ZNC bouncer](https://wiki.znc.in/ZNC) where I follow a set of channels, so when I connect (with `C-c I I`) I receive a _backlog_ in each of them.
Since I also activated the `:ui workspaces` module, by default Doom hooks `+irc--add-circe-buffer-to-persp-h` to `circe-mode-hook`, and I would expect that all the `circe-channel-mode` buffers be collected in the `*IRC*` workspace.

### What actually happened?

Instead, only one of them is actually bound to the `*IRC*` workspace, that is `persp-switch-to-buffer` (`C-x b`) shows only one channel, while `ibuffer` (`C-x C-b`) effectively lists all of them.

### Describe your attempts to resolve the issue

Investigating the issue, I added some debugging to the function `+irc--add-circe-buffer-to-persp-h` (defined in [modules/app/irc/autoload/irc.el](modules/app/irc/autoload/irc.el)) and found that for most of the buffers (but one, as said) the condition `(eq (safe-persp-name persp) +irc--workspace-name)` is `t` and thus the function effectively does nothing, that is it does not execute `persp-add-buffer`.

Indeed, once I rewrote it as
```emacs-lisp
(defun +irc--add-circe-buffer-to-persp-h ()
(when (and (bound-and-true-p persp-mode)
(+workspace-exists-p +irc--workspace-name))
(let ((ws (persp-get-by-name +irc--workspace-name))
(buf (current-buffer)))
;; Add a new circe buffer to irc workspace if not already there
(unless (cl-find buf (safe-persp-buffers ws))
(persp-add-buffer buf ws nil nil)))))
```
the issue disappeared: all the channel buffers now belong to the `*IRC*` workspace.

### Steps to reproduce

The following minimal `circe` setup should exhibit the problem:
```emacs-lisp
(set-irc-server! "irc.libera.chat"
`(:tls t
:port 6697
:nick "somenick"
:channels ("#celery" "#sqlalchemy")))
```
When the connection (`C-c I I`) has been completed, switching buffer with `C-x b` you see a single choice, instead of three as expected.

### System Information

https://pastebin.com/Qa6qGsYx

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.