Run several doom configs in parallel, from same repo?

I am about to try to renovate a doom module (helm). I know about chemacs2. Also about DOOMDIR. Is it possible to run several doom emacs configurations (at the same time) from the same doom repo? That would be convenient for A/B testing. But would require separate .local directories. More to the point: What is the recommended method for running different doom versions in parallel (that is: running at the same time), when doing module development?

:warning: This advice is partially outdated. See this one, below.

Since 5b6b204 (~5 days ago), Doom has its own profile system which can replace Chemacs. I’ve documented it lightly in this gist while we wait for more formal documentation. With it you can have multiple Doom configs living off the same Doom installation. E.g.

;; in ~/.emacs.d/profiles.el
((doomemacs1 (env ("DOOMDIR" . "~/.config/doom1")))
 (doomemacs2 (env ("DOOMDIR" . "~/.config/doom2")))
 (doomemacs3 (env ("DOOMDIR" . "~/.config/doom3"))))
  • To launch a specific one: emacs --profile doomemacs2
  • To sync a specific one: doom sync --profile doomemacs2

Thanks, that looks very promising. What luck that you had implemented it just a few days ago! I will have to test it some more, but so far so good. A couple of points:

  • should remind the user to prepend, say, ~/.config/emacs/bin to PATH, otherwise they risk messing up their old doom directory.
  • should also remind the user to not delete their old doom directory, until they have copied over files like .local/cache/{projectile.projects,recentf,savehist,saveplace,sly-mrepl-history} and .local/etc/bookmarks
  • I had success with the profile for doom and prelude, with doom I could even run exwm with emacs as server (daemon). spacemacs seems to require setting more elisp variables, I will try to debug that.

Now I managed to get spacemacs working. In profiles.el the line (spacemacs (user-emacs-directory . “~/.config/spacemacs”) should be (spacemacs (user-emacs-directory . “~/.config/spacemacs/”) i.e. there was a missing terminating ‘/’.

I created a new profile in profiles.el:

(doomemacs (user-emacs-directory . "~/.config/doomemacs")
            (env ("DOOMDIR"       . "~/.config/doomemacs.d")))
(doomhelm (user-emacs-directory . "~/.config/doomemacs")
            (env ("DOOMDIR"       . "~/.config/doomemacs_helm.d")))

I did not create the directory doomemacs_helm.d. I then ran “doom sync --profile doomhelm”. This ran to conclusion but the directory doomemacs_helm.d was not created.

I now created directory doomemacs_helm.d manually, and populated it from ~/.config/emacs/templates

I then ran “doom sync --profile doomhelm” again. This worked! I now have two independent doom profiles, and can run doom sync on each without disturbing the other.

So until the new DOOMDIR is automatically created and populated, I think it should be pointed out in, that one has to do this manually.

doom version info:

GNU Emacs v28.1 nil Doom core v3.0.0-dev fatal: cannot change to ‘~/.config/doomemacs’: No such file or directory Doom modules v22.07.0-dev HEAD → master, origin/master, origin/HEAD d3f2b4d9c 2022-08-01 22:36:33 +0200

Note the strange (but harmless?) message for Doom core.

Sorry for the awfully late response: the profile system has seen quite some bugfixing and polish in the past few weeks. I’ve documented the profiles system in its current state here, with exhaustive examples of profile config files in docs/

These are the two major differences since my original answer to your question:

  1. There is no longer an env alist. Instead, string bindings are presumed to always be envvars, e.g.

    ;; in ~/.emacs.d/profiles.el
    ((doomemacs1 ("DOOMDIR" . "~/.config/doom1"))
     (doomemacs2 (user-emacs-directory . "~/.config/emacs.doom.d/")
                 ("DOOMDIR" . "~/.config/doom2"))
     (doomemacs3 ("DOOMDIR" . "~/.config/doom3")))
  2. You must run doom sync to reindex your profile configs and regenerate the “profiles loader” file. It will only do so if your profile configs (or Doom version) has changed. This check my not be enough to detect format changes until Doom returns a stable release cycle however, so use doom profiles sync if you need to resync them unconditionally.

After fix(profiles): ensure trailing / on user-emacs-directory · doomemacs/doomemacs@d8d0639 · GitHub I ensure that user-emacs-directory ends in a directory separator, so this should no longer catch anyone by surprise.

It’s doom install that deploys a template $DOOMDIR for you. doom sync won’t do this. I’ll look into documenting this further.

Ah, I’m aware of this and will fix it shortly.