mclear-tools / tabspaces

GNU General Public License v3.0
233 stars 15 forks source link

[SUGGESTION] Enable tabspace duplication only when `tabspaces-open-or-create-project-and-workspace` is called with C-u prefix #43

Closed sethidden closed 12 months ago

sethidden commented 1 year ago

This is related to #42

In the issue, the reporter says:

Also, the tabspaces--generate-unique-tab-name function causes opening the same project twice to create two tabs with names "project" and "project<1>".

And Colin replied:

Note though that the duplicate tab function is a feature not a bug. Some folks might want two different workspaces for the same project.


While the change supports a valid usecase, I miss how tabspaces-open-or-create-project-and-workspace could've been used mindlessly, without having to think if the tabspace is already open. Sure, you can use C-C TAB s now instead, but as I said, the "mindlessness" was a nice bonus imo. I frequently have so many tabspaces open that it's not immediately clear if the tabspace is already there or not.

Here are some ideas:

  1. I was wondering if it'd be possible to have two modes of operation for tabspaces-open-or-create-project-and-workspace. If a prefix C-u (https://www.emacswiki.org/emacs/PrefixArgument) is used, use the new "duplicate tabspace if already existing". If no prefix, use old "switch to tabspace if already exists". So: C-u C-c TAB o -> duplicate tabspace always; C-c TAB o -> switch to tabspace if it exists

  2. (nitpick) If you prefer the current behavior to stay, the docstring at https://github.com/mclear-tools/tabspaces/blob/main/tabspaces.el#L399 should be changed to say that the function will duplicate the tabspace if it exists, not switch to it. I can do that if you want

This may be a case of https://xkcd.com/1172/, so if I'm being a baby about it and should now just use C-c TAB s instead of C-C TAB o I'll oblige :P

mclearc commented 1 year ago

I'm pretty sympathetic as I too like to be mindless. I was trying to balance simplicity in the code (and time taken by me to code it) with resolving the real problem of namespace conflicts (or cases where you want two spaces for one project). But I'd be happy to see pull requests if you can keep things simple while accomplishing the behavior you describe!

Otherwise I'll think about it for the future when I have a bit more time.

sethidden commented 12 months ago

I made a small change in #44