doomemacs / doomemacs/core

Killing a workspace can mess up another workspace's windows

Open
#8,389 0 comments 0 reactions 0 assignees View on GitHub
:ui workspaces is:bug
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### I confirm that...

- [x] I have searched the [issue tracker](https://github.com/doomemacs/doomemacs/issues), [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [Discourse](https://discourse.doomemacs.org), and [Google](https://google.com), in case this issue has already been reported/resolved.

- [x] I have read "[How to Debug Issues](https://doomemacs.org/d/how2debug)", and will use it to provide as much information about this issue as possible.

- [x] The issue can be reproduced on the **latest** available commit of Doom.

- [x] The issue can be reproduced on a stable release of Emacs, such as 27, 28, 29, or 30. *(Unstable versions end in .50, .60, or .9x)*

### Expected behavior

When I kill the current workspace (`(+workspace/kill)`), I expect to be brought to another (e.g. previous) alive workspace without its windows being touched - i.e. the behavior should be the same as if instead of killing the current workspace, I first jumped to another workspace and then killed that other workspace I was on.

### Current behavior

When I kill the current workspace (`(+workspace/kill)`), I am brought to the previous workspace (✅), but sometimes a window that _was_ present there is gone (❌).

I think this is the culprit:

https://github.com/doomemacs/doomemacs/blob/e614ffbda8b278bc9fd9a9cb3a836d636b1091e6/modules/ui/workspaces/autoload/workspaces.el#L278

... because `(doom-buffer-frame-predicate)` (or rather `(doom-real-buffer-p)`) evaluates to `nil` on temporary buffers (`*new*<123>`) - or at least dropping those two lines gets me "the correct" behavior.

### Steps to reproduce

- create a new buffer (`(evil-buffer-new)`),
- create a new workspace and switch to it (`(+workspace/new)`),
- kill the current workspace (`(+workspace/kill)`),
- you get brought into the previous workspace (✅), but this temporary buffer you had is not visible anymore (❌).

### System Information

https://pastebin.com/11aeFEaL

Contributor guide

Open the contributing guide

Research direction

In modules/ui/workspaces/autoload/workspaces.el around the linked code at line 278, first run the listed reproduction with a temporary buffer and inspect how workspace killing applies doom-buffer-frame-predicate and doom-real-buffer-p. Done means killing the current workspace returns to the previous workspace with its existing temporary-buffer window still visible.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs, emacs-lisp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.