Commit Graph

51 Commits

Author SHA1 Message Date
361eec11a4 fix(workspaces): avoid duplicate workspace creation when no frame exists
When Emacs is started as a daemon and no frames exist, `emacsclient -c`
should simply switch to the main workspace. However, before
`+workspaces-associate-frame-fn` is called, the new frame is already
added to the frame list, which causes `persp-frame-list-without-daemon`
to always return a non-empty list. A new workspace will be created
instead of switching to the main one.
2025-06-01 00:45:04 +02:00
722f5a2e18 fix(workspaces): use existing workspace on project switch
A "workspace already exists" error is thrown if trying to switch to
project workspace that already exists. This changes it to switch to the
workspace instead.

Fix: #8368
2025-05-06 00:26:27 -04:00
6f6302d42d fix(workspaces): clobbering pre-existing workspaces on switch-project
If you used `projectile-switch-project`, the workspaces module would
open a new workspace named after the project, but if a  workspace named
after that project already exists, it is hijacked (e.g. two projects in
'some-project/src' and 'another-project/src' would get the same name:
"src"). This commit uniquifies their names so this doesn't happen, and
also embeds a +workspace-project persp parameter in the workspace so
that they can be disamiguated later (this association is lost if you
rename the workspace manually, however).

Fix: #7637
2025-04-01 03:27:03 -04:00
c6f979b4e0 refactor(workspaces): projectile integration
Simplifies +workspaces-switch-to-project-h and refactors out the
dependency on external state.
2025-04-01 03:27:03 -04:00
7941dfa766 fix(workspaces): only trigger projectile-*-switch-project-hook once
Changes upstream made our triggers for these hooks redundant.

Fix: #6559
2025-04-01 03:27:02 -04:00
8f57069dd5 feat(workspaces): add count arg to switch-{left,right} commands 2025-01-08 19:46:08 -05:00
b835e7b6ec fix(workspaces): don't overwrite previously workspaces on save
Otherwise, each time `+workspace-save` is called, all prior saved
workspaces would be deleted from `+workspaces-data-file` before
inserting the new one.
2024-08-22 12:20:17 -04:00
b3bea23331 fix(workspaces): "none" workspace
Doom removes the "none" workspace from persp-mode's default list of
perspectives, because it is a special case that doesn't behave
identically to other persps in the list, making it a pain to deal with.

This worked fine up until a change to `persp-update-names-cache` (in
Bad-ptr/persp-mode.el@0d6cacc) made it re-insert this "none" workspace
into `persp-names-cache` whenever it is called, undoing our hack; this
commit adapts to that change.

Ref: Bad-ptr/persp-mode.el@0d6caccab3
Ref: Bad-ptr/persp-mode.el@b2e68f97cb
Fix: #7986
Amend: 7f3412e317
2024-08-09 15:42:54 -04:00
9cdcfdac36 feat(workspaces): add +workspace/delete
For deleting saved workspaces (saved with `+workspace/save` or
`+workspace-save`).

Also binds `SPC TAB D` (for evil users) and `C-c w K` (for non-evil
users) to it.

Fix: #4399
Close: #7869
Co-authored-by: sriramsk1999 <sriramsk1999@users.noreply.github.com>
2024-07-29 20:57:56 -04:00
5289861109 refactor(workspaces): +workspace/delete: rename to +workspace/kill
To be more consistent with other uses of the verb in the Emacs
ecosystem. Also done in preparation for a new +workspaces/delete command
for #7869.

Ref: #7869
2024-07-05 18:05:15 -04:00
90070c639a fix(workspaces): remove ivy integration
Due to upstream changes in ivy-rich, +workspace/switch-to throws a
`wrong-type-argument listp leaf` error. As I plan to phase out Ivy
support (and the Ivy module) in the long term, I'll simply remove
ivy (and ivy-rich) integration in the workspaces module, rather than
update it.

Fix: #7499
Fix: #7173
2024-03-26 10:11:34 -04:00
1a2789c922 fix(workspaces): check before loading tab configuration
Fix: #7139
2023-10-05 17:46:46 +02:00
fd98b44e6a tweak(workspaces): prefill current name on rename
This change uses completing-read to get the new name from the user when
renaming workspaces, to allow them to more easily make a small change to
the existing name of a workspace.
2023-09-12 21:23:48 +02:00
d12b0ebc80 fix(workspaces): save current tab-bar tabs to file 2023-02-18 01:01:49 -05:00
191745424b feat(workspaces): make tab-bar tabs workspace-local 2022-10-05 15:14:44 +02:00
ad6a3d0f33 refactor: deprecate featurep! for modulep!
featurep! will be renamed modulep! in the future, so it's been
deprecated. They have identical interfaces, and can be replaced without
issue.

featurep! was never quite the right name for this macro. It implied that
it had some connection to featurep, which it doesn't (only that it was
similar in purpose; still, Doom modules are not features). To undo such
implications and be consistent with its namespace (and since we're
heading into a storm of breaking changes with the v3 release anyway),
now was the best opportunity to begin the transition.
2022-08-14 20:43:35 +02:00
06392a723f refactor: rename orig-fn arg in advice to fn
A minor tweak to our naming conventions for the first argument of an
:around advice.
2021-08-04 01:53:12 -04:00
3aeb0c060f Fix #5195: workspace is killed on magit commit
Due to magit now using server-done instead of server-edit as of
magit/magit@5c02910, which calls server-done-hook, which the workspaces
module has a hook on to kill auto-generated, daemon-spawned frames,
causing workspaces to be prematurely killed when commiting in magit.
2021-07-10 16:32:53 -04:00
42ff369142 SPC TAB N binding (#5173)
* Introduce `SPC TAB N` binding

* Add vanilla Emacs binding
2021-07-09 01:13:13 -04:00
87e209badc Remove vestigial mentions of the :feature category
It was removed long, long ago.
2021-03-06 00:49:36 -05:00
ea35023765 Fix prefix arg for +workspace/new 2020-10-04 23:17:50 -04:00
60ca118eb2 Fix #3166 and #3288: over-eager project-root caching
And prevent explicit projectile-project-root interfering with project
switching.
2020-06-04 19:43:20 -04:00
031dc5eb1d Fix +workspaces-switch-project-function not respecting dir local vars 2020-03-10 01:47:34 -04:00
505ca8712d Prevent 'not in valid workspace' error on switch project 2020-02-25 14:13:07 -05:00
8049914e0e Fix #2591: fix project switch hooks not running
When :ui workspaces was enabled.
2020-02-24 20:47:57 -05:00
3ab70d78eb Add +workspace/swap-{left,right} commands
For changing the order of workspaces.

Relevant to #2488, #2487
2020-02-06 15:20:42 -05:00
5eeb362610 Ensure workspace in insertion order
Closes #2488
Fixes #2487
2020-02-06 15:20:42 -05:00
9fce4d5106 Remove +workspace-buffer-list return order #2315
I cannot guarantee this. We simply return was `persp-buffers PERSP`
returns. How buffers are ordered is up to persp-mode.
2020-01-06 00:58:08 -05:00
195dfda045 Minor refactors & comment revision 2020-01-02 21:16:02 -05:00
adc8cba14b Revise docstrings & minor reformatting 2019-12-26 01:41:44 -05:00
a49c0b6691 Output feedback from buffer/session kill commands 2019-12-21 03:30:44 -05:00
35ce37532b ui/workspaces: merge +ivy/workspace/switch-to into +workspace/switch-to
Relevant to #2127
Closes #2130
2019-12-01 15:41:28 -05:00
4b77b413c5 Add ivy command for workspace switching 2019-12-01 16:13:40 +07:00
dd004dea79 Easier creation of named workspaces
When a user tries to switch to a named workspace that doesn't exist,
creat it, instead of just failing.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
2019-12-01 15:10:51 +07:00
4ccb69dbd0 ui/workspaces: fix unrenamed workspace on project-switch #1942 2019-10-25 02:42:54 -04:00
a3fa1e07b1 Refactor doom/kill-*-buffer commands 2019-10-10 16:11:42 -04:00
d297dc6934 Minor refactor & comment revision across the board 2019-10-03 23:33:59 -04:00
3f7e0fd103 Fix +workspace/delete changing workspaces
...when deleting other workspaces.
2019-09-29 23:12:43 -04:00
060f6a36d3 Fix +workspace/delete initially filtering workspaces
SPC u SPC TAB d will prompt you for the workspace you want to delete,
with the name of the current workspace prefilled into the the
minibuffer. This filters out all other workspaces from the get go, which
may fool you into thinking you can only delete the current workspace.

Now it only selects the current workspace by default, without filtering
them.
2019-09-29 12:50:20 -04:00
525193f94b ui/workspaces: fset -> defalias
Allows these commands to be advised.
2019-09-26 17:55:33 -04:00
e10cd8cf2e Insult byte-compiler's mom
Yeah, that shut him up.
2019-09-20 23:10:53 -04:00
5e0177d667 ui/workspaces: conform to new hook/advice conventions 2019-07-22 02:37:47 +02:00
9a02bd8ac8 Minor refactors across the board
- when-let* -> when-let
- Fix projectile-locate-dominating-file for connected remote files
2019-06-26 14:31:06 +02:00
80958c0c17 Ensure non-dedicated window is active on workspace creation
Otherwise, workspaces are left in a broken state where they only contain
dedicated/side-windows, which Emacs can't handle well.

Indirectly fixes #1492
2019-06-14 12:34:23 +02:00
bc6c4b3e37 Add +workspace/other #1480
- Rename +workspace/switch-to-last to +workspace/switch-to-final, to
  avoid ambiguity.
- Add +workspace/switch-to-N commands
2019-06-11 16:12:06 +02:00
e7c12b1bb6 ui/workspace: minibuffer-message -> message
minibuffer-message adds 2 seconds to emacsclient calls that create new
workspaces.
2019-06-10 09:38:55 +02:00
2214c3175e Minor tweaks across the board 2019-05-21 00:34:32 -04:00
928ec16242 ui/workspaces: remove unused function 2019-05-19 02:17:59 -04:00
d1c9c3fc91 A more reliable +workspace-list-names
In case the cache goes stale.
2019-05-05 14:25:03 -04:00
fc511ed701 ui/workspaces: minor refactors 2019-04-24 18:27:40 -04:00