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

Proposal: Split spacemacs layer into spacemacs-core and spacemacs-extra #2546

Closed
justbur opened this issue Aug 5, 2015 · 28 comments
Closed

Comments

@justbur
Copy link
Contributor

justbur commented Aug 5, 2015

I don't mean to over complicate things, but #2523 and #2435 made me think of this. I was wondering if it could make sense to split the spacemacs layer in two, spacemacs-core and spacemacs-extra? The first would be the packages that are absolutely necessary to "the spacemacs experience", while the second would be nice-to-have or recommended but not critical. Anything in -extra could also be available individually the same way package groups work in linux package managers (https://www.archlinux.org/groups/), except this would be a "layer group".

The default could be to use both layers, but the separation would easily allow someone to strip out anything that's not critical in one step. It would also mean that including a package in spacemacs-extra does not mean automatically installing it for everyone. I imagine that I would start with both, and then gradually cherry pick the layers from -extra that I liked and remove -extra, creating a custom installation.

@syl20bnr
Copy link
Owner

syl20bnr commented Aug 5, 2015

I went through the list and except for a few obvious packages that should be moved to proper contrib layers I did not see a lot of eligible packages for an optional Spacemacs-extra layer.

But we can do the exercise of defining what is the "Spacemacs experience" and maybe we can start to see some patterns.

For me the "Spacemacs experience" is (in no specific order) use-package, evil, helm, projectile, powerline, UI improvements (expand-region, iedit, golden-ratio, volatile-highlights, fancy battery...). It seems that from this list we should be able to remove a lot of packages, it ends up harder than expected.

@justbur
Copy link
Contributor Author

justbur commented Aug 5, 2015

Maybe the "spacemacs experience" is not the right phrase or describes -core and -extra together. I think it would be a useful exercise, even if you decide not to change anything afterwards. I will try to come up with better definitions than these, but I was thinking of roughly features that are used throughout vs. features that are easily avoided. I am not thinking of some being more important. It's something like describing a dependency tree. For example, from the ones you mentioned I see them splitting up into

-core: use-package, evil, helm, projectile, powerline, volatile-highlights (maybe -extra)
-extra: expand-region, iedit, golden-ratio, fancy battery

The -extra are ones that I can easily avoid using in any spacemacs session. Again, it's not a value judgement, because I use iedit and expand-region a lot. It's more of a question of does every spacemacs user need this for spacemacs to work for them?

Does that make sense?

In tandem with this, I would suggest subdividing -extra into layers. What's really nice about layers is that they are independent of one another, and I can feel comfortable adding or removing layers. Trying to manipulate the current spacemacs layer through excluding packages is tricky and to some extent requires understanding how the spacemacs layer treats that package throughout.

@syl20bnr
Copy link
Owner

syl20bnr commented Aug 5, 2015

This is the kind of thread where everyone will have a different view on what is extra and what is not, I'm maybe the most biased on this question ;-)

To be more concrete, here is a first list of packages movable right now:

  • to new spell-checking (or a better name regarding word spelling and definition etc...) layer: auto-dictionary, define-word, google-translate
  • to new self-improvement (or a better name, I would like to add typing exercise packages as well): spray
  • to emacs-lisp layer: eval-sexp-fu
  • to be removed: gh-md

That is not so much. Now my understanding of building an extra layer is that it is very hard to achieve since everyone will have a different set in mind, I guess the best is to let people to build their own list by filling dotspacemacs-excluded-packages to their liking.

@justbur
Copy link
Contributor Author

justbur commented Aug 5, 2015

Yes, absolutely and I'm not interested in what people's favorite packages are. That's not an argument I want to start.

To use an analogy, I'm thinking of the "arch linux method" of customizing spacemacs and the "ubuntu method". Under the arch linux method you start from a minimal core set of packages and add layers to your liking. Under the ubuntu method you start with a bigger set of core+recommended packages and make changes from that point.

I personally think there's value to supporting both methods. Ubuntu is for someone who wants something that works off the shelf and doesn't require tweaking beyond maybe adding a layer or two. Arch linux is for someone who wants the "base" packages nicely configured for them (helm, evil, etc) and is willing to invest the time learning about and adding extra layers as they see fit.

I don't know if this matches up with how you think about things. I think spacemacs strikes a good balance as it is now, and you don't need to change it. I opened this issue mostly to see if others saw value in creating a pruned down -core spacemacs layer.

@syl20bnr
Copy link
Owner

syl20bnr commented Aug 5, 2015

Very interesting, thank you. As you said it is a good exercise to do. Just for fun I'll try to do it with the goal to have the strict minimum of packages to be able to edit text and programs. Maybe I'll get surprised about it :-)

@sexptherapy
Copy link

A core, minimal version would allow for work to be concentrated in the core experience and overall stability (which, as I see it, becomes more and more important as the project matures to leave the beta). Also, I believe the experience of slowly customizing with the packages you understand you want is a richer one, where people slowly progress to understand how to add layers and configure Spacemacs.

I'm very new to Spacemacs and the feeling I still have is that it is a rabbit hole way too deep for beginners. Having the extra would allow me to have a better grasp of the basics while at the same time allowing people with more understanding or less patience to jump head first in a full experience.

@justbur
Copy link
Contributor Author

justbur commented Aug 6, 2015

I have one more thought related to this to throw out there. I would like it if the layers in contrib were more "atomic". A simple example is syntax-checking which includes both flyspell and flycheck. It's both convenient that both can be installed together and annoying if you only want one (because then you have to fiddle with excluding packages).

What if we implemented layer groups in a very simple way: There's a folder called !syntax-checking that includes the now independent flyspell and flycheck layers, and I am able to put !syntax-checking in my .spacemacs to get both or just flycheck to install just one.

More generally what I'm suggesting is to break up layers into atomic units, where you'd have to decide what atomic means, and allow people to add folders consisting of multiple layers to their .spacemacs if they want to install every layer in the sub-tree.

Having atomic layers is good because it clearly separates the functionality into independent units (this should also make testing easier). To compensate for there now being many more layers, use the layer grouping to make declaring what you want in .spacemacs easy.

To connect this to the above discussion, imagine that !spacemacs-extra is just a folder with a listing of the layers that recommended, and one can put !spacemacs-extra into .spacemacs to get all of them or pick and choose individual layers from within the folder.

A side benefit is that .spacemacs becomes more explicit about exactly what you want to have. I no longer have to install a big layer and then blacklist components of that layer.

Finally, this would give another way of browsing layers. You just browse the directory tree. You could do this from your phone even (maybe you already do this, because you figured out how to compile emacs for your phone). I would also add an INDEX.org file that included a table of contents linking to each of the layers (another version of SPC feh).

@syl20bnr
Copy link
Owner

syl20bnr commented Aug 6, 2015

I planned to move flyspell to a spell-checking layer with dictionaries and the like, cf. this comment. I will certainly abstract yasnippet into its own layer we can call snippets.

I see another level of abstraction between packages and layers as over-engineering and unnecessary complication. With layer we have already a semantic unit to group packages, then packages can be excluded to refine this semantic and fit anyones need.

Layers have to be smartly defined and they can be easily rearranged to improve their semantic in a practical context.

@justbur
Copy link
Contributor Author

justbur commented Aug 6, 2015

Fair enough. I hope this didn't come across as criticism. I was more just interested in what you and others thought about the idea.

@syl20bnr
Copy link
Owner

syl20bnr commented Aug 6, 2015

BTW, what you want is a tagging system. Which I plan to implement at some point to replace categories (but originally it is more for exploration than addition of layers).

@justbur
Copy link
Contributor Author

justbur commented Aug 6, 2015

Yes, tagging would be the more general implementation. I suppose the value depends on how many layers there are.

To me one of the really valuable (if not most valuable) contributions of a project like this is the work that goes into defining what those semantic units are and constructing them in a way that they can be independent building blocks for your system. There's a lot of great packages out there, but it's a headache having to think about how to set them up and especially how they interact with one another.

@syl20bnr
Copy link
Owner

syl20bnr commented Aug 6, 2015

Fair enough. I hope this didn't come across as criticism. I was more just interested in what you and others thought about the idea.

Criticisms are positively expected as long as their are constructive and all your proposals largely fit into this category :-)

@syl20bnr
Copy link
Owner

syl20bnr commented Aug 6, 2015

the work that goes into defining what those semantic units are and constructing them in a way that they can be independent building blocks for your system.

Indeed 👍

On this subject, I prefere the approach of layers with larger scopes (with very abstract semantic) and then cut them into more concrete layers, syntax-checking and auto-completion are good examples.

To remove neotree from the spacemacs layer I don't want a neotree layer but I would prefer a layer called sidebar to start with then maybe later it could be a layer called filetree with a tag sidebar.

@justbur
Copy link
Contributor Author

justbur commented Aug 6, 2015

I prefere the approach of layers with larger scopes (with very abstract semantic) and then cut them into more concrete layers, syntax-checking and auto-completion are good examples.

I have no problem with that approach and understand it, even if I prefer a slightly different one. I thought there might be a way to support an alternative without adding much in the way of complications (which I don't like either by the way).

@justbur
Copy link
Contributor Author

justbur commented Aug 26, 2015

I don't think this issue needs to stay open

@justbur justbur closed this as completed Aug 26, 2015
@syl20bnr
Copy link
Owner

@justbur I keep this in mind and will try to do it at some point.

@justbur
Copy link
Contributor Author

justbur commented Aug 26, 2015

Ok, I don't think it's a big deal given all of the other stuff to be done

@syl20bnr
Copy link
Owner

syl20bnr commented Sep 8, 2015

@justbur 6b33031 ¯_(ツ)_/¯

@justbur
Copy link
Contributor Author

justbur commented Sep 8, 2015

@syl20bnr Love it! Now we need a way to selectively add parts of the spacemacs layer so that someone can build a super custom version of spacemacs.

I was thinking about adding layers for the packages that are in the difference between spacemacs and spacemacs-core. We can explain in the readme that these layers are included in the spacemacs distribution and only make sense to add if you are using spacemacs-core, as well as printing a warning message to this effect based on the value of the distribution variable. What do you think?

@TheBB
Copy link
Contributor

TheBB commented Sep 8, 2015

@justbur The new configuration-layer/declare-layer function should make that almost trivial. In the end you could imagine spacemacs-distribution being a metalayer that just includes others.

Edit: In fact, I see that's what is done at the moment with spacemacs-core.

@justbur
Copy link
Contributor Author

justbur commented Sep 8, 2015

@TheBB Could you explain a little more? I haven't had time to go through all the new stuff yet.

@TheBB
Copy link
Contributor

TheBB commented Sep 8, 2015

There's a new function called configuration-layer/declare-layer, the effect of which is to enable a layer even if it's not enabled explicitly by the user. That allows a layer to depend on another, since you can call this function in a layer's config.el. So literally all you have to do is

  1. Move a bunch of packages from the spacemacs layer to somewhere else, as well as whatever other code (in funcs.el, say) should be bundled with them.
  2. Make the spacemacs layer depend on your new layer, the same way it already depends on spacemacs-core.

@justbur
Copy link
Contributor Author

justbur commented Sep 8, 2015

@TheBB Nice! Yes, that's exactly what I wanted to do. I didn't want to really introduce full-blown layer dependency graphs, but using it in this case makes perfect sense. And that's the essence of what the original proposal was, to mimic package groups in linux.

@justbur
Copy link
Contributor Author

justbur commented Sep 8, 2015

I tried to come up with some groupings that might work as layers that make up the spacemacs layer. They are far from perfect

Editing (More Functional)

  • aggressive-indent
  • pcre2el
  • clean-aindent-mode
  • move-text
  • smartparens
  • hungry-delete
  • avy
  • iedit
  • eval-sexp-fu
  • expand-region

Editing (More Visual)

  • auto-highlight-symbol
  • rainbow-delimiters
  • adaptive-wrap
  • highlight-indentation
  • highlight-numbers
  • highlight-parentheses
  • (hl-anything :excluded t)
  • linum-relative
  • indent-guide
  • volatile-highlights

Emacs UI (More Functional)

  • ace-link
  • recentf
  • ace-window
  • centered-cursor
  • info+
  • open-junk-file
  • desktop
  • flx-ido
  • buffer-move
  • window-numbering

Emacs UI (More Visual)

  • fancy-battery
  • powerline
  • ido-vertical-mode
  • zoom-frm
  • smooth-scrolling
  • vi-tilde-fringe
  • neotree
  • golden-ratio

Evil Enhancements

  • evil-anzu
  • evil-args
  • evil-exchange
  • evil-iedit-state
  • evil-indent-textobject
  • evil-jumper
  • evil-lisp-state
  • evil-nerd-commenter
  • evil-matchit
  • evil-numbers
  • evil-search-highlight-persist
  • evil-terminal-cursor-changer
  • evil-tutor

Helm Enhancements

  • helm-ag
  • helm-make
  • helm-mode-manager
  • helm-swoop

Language

  • auto-dictionary
  • define-word
  • google-translate
  • spray

Themes

  • helm-themes
  • leuven-theme
  • solarized-theme

?

  • doc-view

@syl20bnr
Copy link
Owner

syl20bnr commented Sep 8, 2015

Very interesting, I don't want to push the concept further for now but the mechanism is in place to start thinking about it. For now it is just transparent for users and I don't think it is necessary to document it in 0.104.0.

@justbur can you open a new discussion with your last comment, it is a great starting point for the topic.

@justbur
Copy link
Contributor Author

justbur commented Sep 8, 2015

@syl20bnr I completely agree, and I was surprised you did this now. There's no need to blow up the spacemacs layer right before a release :-)

@syl20bnr
Copy link
Owner

syl20bnr commented Sep 8, 2015

I guess I was in the mood for it (the moment I chose to be inspired may be not the best though) :-)
But overall I was confident with the changes, this is a lot of moved code but not a really a big deal from a functional point of view.

@justbur
Copy link
Contributor Author

justbur commented Sep 8, 2015

@syl20bnr No complaints from me. spacemacs-core loads a second faster for me and seems to work perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants