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

Version the .spacemacs template for easier "diffing" #2065

Closed
nwolfe opened this issue Jun 20, 2015 · 6 comments
Closed

Version the .spacemacs template for easier "diffing" #2065

nwolfe opened this issue Jun 20, 2015 · 6 comments
Labels
Discussion Dotfile stale marked as a stale issue/pr (usually by a bot)

Comments

@nwolfe
Copy link
Contributor

nwolfe commented Jun 20, 2015

The short of this is:

  • Replace the file/text-diffing between .spacemacs.template and your .spacemacs with a version-string pairing.

It is a common problem that your .spacemacs gets out of sync with the template, I agree we should ideally do something to help with this.

We kind of started down this path with the recent "template diff" behavior, which just does a naive file diff. This is a step in the right direction, but I don't like that it just does a text diff as I like to re-order and re-word things in that file. What's important is not that the text is the same, but that we have all the variables defined.

I was thinking about this, and something that came to mind was a simple version string that could be hard-coded in two places: in your personal .spacemacs and in Spacemacs core. Whenever something is added to the template, the version in core should be bumped. Then on startup, the version in your .spacemacs is compared to the version in core. If there's a difference, then you need to update your .spacemacs! And when you do, bump the version string in it to match that in core.

I've seen this pattern in things like the new magit, where you have to tell it what version you saw last in your .spacemacs so it will stop bothering you with new feature pop-ups during runtime.

@justbur
Copy link
Contributor

justbur commented Jun 20, 2015

There are two parts to the problem. One is detecting the update in the template and notifying about it. The other is providing a mechanism to deal with the change.

In #2063 I use a change in the template file (not a diff with your personal file) to indicate an update is needed and then provide a link to the diff to accomplish the second step. The two steps are completely independent from one another.

#2063 is a simple solution and the one you provide is another option for dealing with the detection step if I understand correctly.

I guess you could write code to find the missing variables and add them to your personal file but that seems much more involved. Like a diff on the symbols or something.

Anyway I'm interested in fixing this problem

@syl20bnr
Copy link
Owner

@justbur I commented in your PR. While I was for a single .spacemacs file, when I merge your PR to support .spacemacs.d we can start thinking about letting only dotspacemacs variables in .spacemacs and move the user specific stuff in .spacemacs.d/init.el. This way the diff will be even more useful. The downside is that I find this complicated (the user has .emacs.d then .spacemacs.d and `.spacemacs).

@justbur
Copy link
Contributor

justbur commented Jun 21, 2015

@syl20bnr honestly I think the simple diff works fine and is very quick with ediff. If you're going to change the organization of .spacemacs then you're asking for a more complicated merge of new elements in that file. I don't know of a better system for integrating new config files.

@syl20bnr
Copy link
Owner

I agree and I was not saying to remove the diff but more about removing personal configuration from the dotfile to make the diff even more straight forward. I've been thinking about it but it is likely that the .spacemacs.d will remain optional. It's too late to refactor the .spacemacs :-( Another possibility to focus the diff is to narrow the buffer ?

@d12frosted
Copy link
Collaborator

@syl20bnr

The downside is that I find this complicated (the user has .emacs.d then .spacemacs.d and `.spacemacs).

Why not .emacs.d, .spacemacs.d/spacemacs.el, .spacemacs.d/init.el (user.el, config.el)? But yeah, when file contains only dotspacemacs variables, diff is much more valuable. Also I believe it's not that hard to find much more intelligent diff by parsing used variable names in template and user config file - and show what's redundant and what's missing.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Dotfile stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

4 participants