SystemCrafters / crafted-emacs

A sensible base Emacs configuration.
MIT License
739 stars 117 forks source link

Suggestion: Make examples loadable #383

Closed jvdydev closed 8 months ago

jvdydev commented 1 year ago

I wonder if it would be nice to allow loading the examples using e.g. emacs --init-directory (for Emacs 29). This way, users could try out different example configurations without much hassle.

Would also allow to change some examples to no longer require to use the custom-modules mechanism. The layout would look something like:

. examples
|-- README.md // explaining how the examples work
|-- straight-el
  |-- early-init.el
  |-- init.el
|-- elpaca
  |-- early-init.el
  |-- init.el
|-- evil-escape
  |-- early-init.el
  |-- init.el

Just a thought, open for discussion.

jeffbowman commented 1 year ago

Not a bad idea. The difficulty I can see would be all the extra files Emacs creates in those folders. Essentially, .../examples/elpaca-el becomes user-emacs-directory so the elpaca folder will be created there at a minimum. These are untracked files in the crafted-emacs repository. Not a big deal unless someone runs the appropriate git commands to add and then attempt to push those changes. I might prefer having a nifty elisp file that would basically create a temporary "try it" directory at some place of the user's choosing, copies the early-init.el and init.el to those locations and (maybe) starts an instance of Emacs with that configuration for them to use.

jvdydev commented 1 year ago

I see your point, we could use a simple examples/<example>/.gitignore like:

*
!.gitignore
!init.el
!early-init.el

Although I guess an ELisp script would work too, something like:

emacs --script crafted-emacs-try-example -- elpaca ~/test/trying-out-elpaca
emacs --init-directory ~/test/trying-out-elpaca

This would also allow users for tinkering with the example without tracking those changes in the crafted-emacs git

sthesing commented 1 year ago

I like the idea and the solution with the gitignore file. Seems to fit the bill...