doomemacs / doomemacs/core

+workspace/load incorrectly loads multiple workspaces

Open
#7,544 0 comments 0 reactions 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

### 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, or 29. *(Unstable versions end in .50, .60, or .9x)*

### Expected behavior

When there are more than one workspace similarly named (example: `test1`, `test2`, `test3`), when either of the three workspaces are loaded via `+workspace/load`, only one workspace should be opened.

### Current behavior

Given the **Expected behavior**, because of `persp-load-from-file-by-names` taking a list, the argument passed matches all three workspaces (`test1`, `test2`, `test3`) which results in all three workspaces loaded.

The documentation for `+workspace/load` states:
```
Loads a single workspace (named NAME) into the current session. Can only
retrieve perspectives that were explicitly saved with `+workspace-save'.

Returns t if successful, nil otherwise.
```

I believe the solution is to call: `persp-load-state-from-file` directly. That is,
```
(persp-load-state-from-file
(expand-file-name +workspaces-data-file persp-save-dir)
*persp-hash*
"^test1$"
t)
```

### Steps to reproduce

1. There are more than one saved workspaces in `~/.emacs.d/.local/etc/workspaces/_workspaces`: `test1`, `test2`, `test3`.
2. `M-x +workspace/load`
3. Select `test3`
4. `M-x +workspace/display`

Expected result: Display `test3`, but not `test1`, and `test2`.

### System Information

https://pastebin.com/raw/VPBtrPcT

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.