Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New option: auto-generate layout names #7323

Closed
wants to merge 1 commit into from

Conversation

bmag
Copy link
Collaborator

@bmag bmag commented Oct 8, 2016

If spacemacs-auto-generate-layout-names is non-nil, and the user tries to open a layout in a position that doesn't yet have a layout (e.g. with SPC l 2), then create a new layout with an automatically generated name. I tried to choose names that are familiar and easy to remember. To enable the feature, add the following to user-config:

(setq spacemacs-auto-generate-layout-names t)

Known issues:

  • persp-mode doesn't really have a notion of a numbered layout. Because of this, creating a layout with SPC l 7 (7 is only an example) will give it a name suitable for a 7th layout, but the actual position of the layout may be smaller. For example, if the user only had 4 layouts, then the "7th" layout is created in position 5.
  • the new layout is created with a single window, but it doesn't show the home buffer. Instead, it will show the buffer of the previous layout's selected window. This is a difference I do not understand (or researched) between (persp-switch "some-new-name") and (persp-switch nil).

@JAremko
Copy link
Collaborator

JAremko commented Oct 8, 2016

Nice addition. Thanks!

@TheBB
Copy link
Collaborator

TheBB commented Oct 8, 2016

Do you mean grab bag? :-)

@syl20bnr
Copy link
Owner

syl20bnr commented Oct 9, 2016

spacemacs-auto-generate-layout-names could be a dotspacemacs variable, check for the shape of other layout related dsm variables.

If dotspacemacs-auto-generate-layout-names is non-nil, and the user
tries to open a layout in a position that doesn't yet have a layout,
then create a new layout with an automatically generated name.
@bmag bmag force-pushed the auto-generate-layout-names branch from 56fe0e6 to 01002b5 Compare October 9, 2016 17:53
@bmag
Copy link
Collaborator Author

bmag commented Oct 9, 2016

@TheBB lol, of course
@syl20bnr ok, updated accordingly. Original version was modelled after spacemacs-spaceline-additional-segments.

@TheBB
Copy link
Collaborator

TheBB commented May 25, 2017

Thanks! Cherry-picked in develop. You can safely delete your branch.

I had to apply a fix: d4b0044

Bizarrely, by default, persp-get-by-name will not return nil if it can't find a persp, but :nil.

@TheBB TheBB closed this May 25, 2017
@bmag bmag deleted the auto-generate-layout-names branch May 25, 2017 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants