reddit / emacs

Loading config interactively

maxle0312 · 2022-03-17 17:06
Hi folks. I have an org file in my .emacs.d folder, this file contains my config separated by org-bullet into different sections. In my other init.el file, it loads this org file and untangle it. The problem is my config, the org file, has a lot of sections. If I dont want to use a section, I have to manually open the org file then go to the specfific bullet and do `:noexport`. I am looking to implement some sort of menu that pops up on startup and allows you to choose whichever config you want. For example, I can choose "Essential" and only config under the "Essential" bullet gets loaded. Is this possible? Looking for some pointers, any help is appreciated.
arthurno1 · 2022-03-17 21:18
> If I dont want to use a section, I have to manually open the org file then go to the specfific bullet and do :noexport. What you are doing there, is creating a new configuration (init file) every time you tangle your org file. In essence, you are using multiple configurations, but they exist only one at a time. What you could do is to create those few different configurations you would like to have, each in it's own file, and load Emacs with a different init file. Emacs has among its startup options one to load a library. You can simply alias different Emacs commands in your shell to load different files. Alternatively, you can use something like [chemacs](https://github.com/plexus/chemacs2) to accomplish the same goal, but a bit more robust. I wouldn't do this, but it is an option. > I am looking to implement some sort of menu that pops up on startup and allows you to choose whichever config you want. > Is this possible? Yes, it is possible, but I wouldn't do it. That sounds like an awkward way to start your Emacs, especially if you are using daemon/client (which you should). The normal way to start Emacs is to load a minimal set of functionality you always need and use, and to load everything else lazily, i.e. "on demand", when you need it. There is really no need for different configurations. Most of the time package loading is not noticeable, with exception to few bigger packages like org, helm and maybe few others. Such packages can be loaded on idle timer.
mplscorwin · 2022-04-02 18:22
My configuration isn't literate, but .. I have functionality segregated into different El files, each making a simple package. I then have a command to load those which I don't always want. You can probably accomplish the same by tangling different sections to different files. Here's my conf:. https://git.sr.ht/~mplscorwin/dotfiles