Help installing doom with the new profiles feature

What happened?

I tried following these install docs, intending to try Doom alongside spacemacs using the new chemacs-alike functionality of doom:

Following those steps, doom ran fine just by running emacs.

Maybe an hour later, mysteriously, running emacs no longer runs doom, but just vanilla emacs. I don’t know why.

What did you expect to happen?

emacs still runs doom.

Here:

I expected this:

Install Doom there: `$ git clone https://github.com/doomemacs/doomemacs
    ~/.config/emacs`

To be followed by example configuration that runs the emacs configuration that that install step has installed (i.e., runs that install of doom). Then I could try explicitly running:

emacs --profile doom

But the configuration that follows is instead for some other doom installation method that installs to different directories:

(("default"   (user-emacs-directory . "~/.emacs.default")
          (env ("DOOMDIR" . "~/.doom.private")))
...

Because I’m new to doom, I don’t know what the DOOMDIR or user-emacs-directory should be for the git clone install method on this same page.

It would also have helped me if it said right after the installation (git clone) command and the step to create ~/.config/doom/profiles.el that I should next run these commands:

~/.config/emacs/bin/doom install
~/.config/emacs/bin/doom sync
emacs

It’s so frustrating! I’ve tried doom so many times, every time I fail at this same first step: how to install it alongside my old emacs. This is exactly what kept me from using spacemacs for years, now it has kept me from using doom for years.

Steps to reproduce

Yes please ;-) In my mind, the install docs are STR.

System information

generated  Jan 08, 2023 00:10:45
system     Arch Linux Linux 5.15.86-1-lts x86_64
emacs      28.2 ~/.config/emacs/
doom       3.0.0-pre PROFILE=_@0 HEAD -> master, origin/master, origin/HEAD e96624926 2023-01-01 21:55:13 -0500 ~/.config/doom/
shell      /bin/bash
features   ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE
	   XIM XPM GTK3 ZLIB
traits     batch envvar-file
modules    :config use-package :completion company vertico :ui doom doom-dashboard hl-todo modeline ophints (popup +defaults) (vc-gutter +pretty) vi-tilde-fringe workspaces :editor (evil +everywhere) file-templates fold snippets :emacs
	   dired electric undo vc :checkers syntax :tools (eval +overlay) lookup magit :lang emacs-lisp markdown (org +roam2) sh :config (default +bindings +smartparens)
packages   (evil-colemak-basics)

The reason that emacs went back to starting vanilla emacs was that something had created an ~/.emacs.d. Deleting that, doom starts again.

I think for this reason it would be better if these instructions said how to explicitly configure profiles.el to point at the doom just installed.

I still haven’t figured out what to set DOOMDIR and user-emacs-directory to.

I have this from the install instructions referenced above:

ls ~/.config/doom/
config.el  init.el  packages.el  profiles.el
ls ~/.config/emacs/
bin  docs  early-init.el  eln-cache  elpa  LICENSE  lisp  modules  profiles  README.md  shell.nix  templates

So I guessed this might let me start doom with an explicit --profile doom argument to emacs:

((doom (user-emacs-directory . "~/.config/emacs")
       ("DOOMDIR" . "~/.config/doom"))
 (spacemacs (user-emacs-directory . "~/dev/spacemacs")))

But with that configuration in ~/.config/doom/profiles.el, running emacs --profile doom gives me:

Warning (initialization): An error occurred while loading ‘/usr/lib/emacs/28.2/native-lisp/28.2-19f47317/warnings-28e75f4d-870b026e.eln’:

Doom hasn't been initialized yet; did you remember to run 'doom sync' in the shell?: /home/me/.local/share/doom/doom/@/0/init.28.elc

(but running just emacs gives me doom emacs, and emacs --profile spacemacs gives me spacemacs – albeit starting slow enough that something I guess in spacemacs code thinks it’s a good idea to automatically run the profiler)

Just continuing my train of thought here in the hope somebody can see what needs clarifying – I think at least part of what I’m missing is what extra state is involved other than user-emacs-directory and profiles.el (especially for running emacs distros other than doom itself, but I’m also unsure what state doom sync acts on given the behaviour below – in particular it seems it’s not only ~/.config/doom/):

((doom (user-emacs-directory . "~/.config/emacs")
       ("DOOMDIR" . "~/.config/doom"))
 (vanillaspacemacs (user-emacs-directory . "~/dev/spacemacs"))
 (spacemacs (user-emacs-directory . "~/dev/spacemacs")))

That vanillaspacemacs profile I expected to work the same as the spacemacs profile (which successfully runs spacemacs), but it doesn’t: the first one gives me:

Warning (initialization): An error occurred while loading ‘/usr/lib/emacs/28.2/native-lisp/28.2-19f47317/warnings-28e75f4d-870b026e.eln’:

Doom hasn't been initialized yet; did you remember to run 'doom sync' in the shell?: /home/me/.local/share/doom/vanillaspacemacs/@/0/init.28.elc

OK, the two spacemacs profiles as defined in the profiles.el above are identical aside from the spelling of the profile name after all, so whatever state doom sync sets up must be what’s missing? I guess it must iterate through all the profiles, and update some needed state for each profile?

But no, I’m wrong again:

Running ~/.config/emacs/bin/doom sync again despite my confusion, I still get the same error telling me to doom sync. Same result if I first run ~/.config/emacs/bin/doom install again, then ~/.config/emacs/bin/doom sync again.

OK, maybe doom sync has to be run “in a profile”? Looking at doom --help, I try:

env DOOMPROFILE=vanillaspacemacs ~/.config/emacs/bin/doom sync

Now emacs --profile vanillaspacemacs runs doom, not spacemacs! And emacs --profile spacemacs still runs spacemacs! What’s changed on my system?

By the way, if it’s confusing why I have two identical profiles configeured except for the name: what I’m aiming at is something like this:

((doom (user-emacs-directory . "~/.config/emacs")
       ("DOOMDIR" . "~/.config/doom"))
 (vanilla-spacemacs (user-emacs-directory . "~/dev/spacemacs")
                    ("SPACEMACSDIR" . "~/vanilla-spacemacs/"))
 (spacemacs (user-emacs-directory . "~/dev/spacemacs")))

Where emacs --profile doom would run doom, emacs --profile spacemacs would run my normal spacemacs profile, and emacs --profile vanilla-spacemacs would run an out-of-the-box spacemacs configuration for debugging purposes (and I’d likely want a similar vanilla-doom later).

I seemed to have quite similar issue. I don’t completely understand why this solution works, but in your case I would try running.

DOOMPROFILE=doom doom sync --profile doom

and then try again to run emacs as

emacs --profile doom

You could try running the profile sync for spacemacs profiles as well, but I’m not familiar with spacemacs setups.

DOOMPROFILE=vanilla-spacemacs doom sync --profile vanilla-spacemacs
DOOMPROFILE=spacemacs doom sync --profile spacemacs

Yeah, doom sync --profile profile is currently broken, so you have to use DOOMPROFILE=profile doom sync: `doom sync --profile` broken due to `noninteractive` · Issue #7457 · doomemacs/doomemacs · GitHub

This topic was automatically closed after 360 days. New replies are no longer allowed.