text/gemini
# Use Emacs with Different Profiles
As you may know, Iβm maintaining different little packages for Gnu Emacs[1]:
* dracula[2] theme, a dark and pink theme;
* flycheck-grammalecte[3], which integrate the french grammar checker Grammalecte[4] with Flycheck[5];
* Elpher[6], a Gemini[7] browser;
* Aeronaut[8], a little file browser.
When it comes to testing with various configuration environment, Emacs is not very flexible. The main idea is to be able to test completely different user settings, without polluting my own preferences.
I know about Chemacs[9], but I was looking for a more simple solution, for example to embed it easily in a Makefile.
The first path I follow was to prevent Emacs to load my init file. This is clearly documented in its man page, and as easy as doing:
```shell
emacs -Q -l custom_profile.el
```
The `-Q' here means "Similar to '-q --no-site-file --no-splash'". `-q', in turn, means "Do not load an init file". Said otherwise, with this lone parameter, we load nothing and prevent Emacs to follow its traditional startup process.
Then, `-l' is used to load a specific lisp file, which can be seen as a profile replacement.
For most of my tests, it did the trick and I was happy with that. However, as Emacs does not really start as expected, a lot of thing may not work as we are used to. Packaging, or `customize' for example. And if you forgot to deactivate some features, you will still be polluting your own settings (yes, Iβm looking at you `auto-save-list').
And I finally found an answer on StackOverflow[10] to literally /chroot/ Emacs in a fake home environment. It is a bit weird to write, but it does the job:
```shell
HOME=/path/to/my/fakehome emacs
```
All we have to do to make it works as expected, is to put our new settings file inside this fake home directory. Meaning either to put there a `.emacs' file, or a `.emacs.d/init.el' file, or a `.config/emacs/init.el' one.
And now, as Emacs will start as usually, we benefit from all its features, and it even lets us easily install new packages without breaking anything on our own profile.
To conclude, both methods are valid, but they answer different use-cases:
* the `-Q' method is useful for quick or light tests. I also use it a lot with the `--batch' and `-nw' switches when it comes to achieve headless tasks. In my case, I still use it to quickly test the dracula theme I maintain.
* the fake home method is useful for more complex test cases, with a lot of dependencies involved. Or to debug other users settings files. I now use this method to work on Flycheck Grammalecte.
Make your choice π
=> https://www.gnu.org/software/emacs/ [1] Gnu Emacs (HTTPS)
=> https://github.com/dracula/emacs [2] dracula (HTTPS)
=> https://git.umaneti.net/flycheck-grammalecte [3] flycheck-grammalecte (HTTPS)
=> https://grammalecte.net/ [4] Grammalecte (HTTPS)
=> https://www.flycheck.org/en/latest/ [5] Flycheck (HTTPS)
=> https://git.umaneti.net/elpher [6] Elpher (HTTPS)
=> https://gemini.circumlunar.space/ [7] Gemini (HTTPS)
=> https://git.umaneti.net/aeronaut/ [8] Aeronaut (HTTPS)
=> https://github.com/plexus/chemacs2 [9] Chemacs (HTTPS)
=> https://emacs.stackexchange.com/a/4255 [10] an answer on StackOverflow (HTTPS)
--
π
mardi 6 juillet 2021 Γ 19:55
π Γtienne Pflieger with GNU/Emacs 29.4 (Org mode 9.7.11)
=> gemini://alltext.umaneti.net/gemlog/tags/emacs.gmi π·οΈ Emacs
=> gemini://alltext.umaneti.net/gemlog/tags/bidouille.gmi π·οΈ Bidouille
=> gemini://alltext.umaneti.net/gemlog π Back to gemlog
=> gemini://alltext.umaneti.net π‘ Back to home
=> gemini://alltext.umaneti.net/fronde/README.gmi π Propelled by fronde
This content has been proxied by September (3851b).