plexus / chemacs

Emacs profile switcher
652 stars 45 forks source link

Add support to doom #5

Closed drym3r closed 6 years ago

drym3r commented 6 years ago

Hi! This package seems very interesting, thanks for your work. I'm triying to make it work with doom, but it doesn't. It would be very useful if you could add support for it.

plexus commented 6 years ago

Hi @drym3r,

I appreciate your interest, but your issue is asking me to do free work without providing any meaningful information.

I've never used doom, in fact this is the first I hear of it. I'm not sure what the problem can be since Chemacs is a very general purpose tool, it shouldn't need "support" for specific configs. That said if we can figure out what the problem is, and if it's something that we can fix, then I'll happily consider a pull request from you or someone else.

Meanwhile it would be helpful to add as much relevant information as possible. What steps did you take? What did you expect to happen? What happened instead? Did you get any errors, warnings, or other output? etc.

Thanks, Arne

drym3r commented 6 years ago

Sure, I'll try to add as much information as I can. I'm not an expert, so I'll do what I can. My .emacs-profiles.el is:

(("default" . ((user-emacs-directory . "~/.emacs.d")))
  ("doom" . ((user-emacs-directory . "~/Proyectos/doom/"))))

When I execute emacs --with-profile doom, it fails with:

Warning (initialization): An error occurred while loading ‘/home/ap/.emacs’:

File error: Cannot open load file, The file or directory doesn't exists, core-lib

The ~/Proyectos/doom/init.el file contains, among other:

(require 'core (concat user-emacs-directory "core/core"))

That said, I'll add that the doom is an opiniated emacs configuration which tries with various ways to speed up the emacs startup.

If I can add more information, I'll happily do it.

plexus commented 6 years ago

Thanks, that's helpful. Maybe one of the Doom folks has an idea what's going. It seems they precompile a lot of stuff, maybe you have to make sure that precompilation also happens with the right profile so it refers to the right user-emacs-directory. cc @hlissner

mandarvaze commented 6 years ago

I'm able to get doom working (at least it loaded successfully)

My entry is as follows :

("doom" . ((user-emacs-directory . "~/doom-emacs")))

(This is similar to the entry listed by @drym3r) Steps I followed : (Not different than ones listed here

  1. Cloned doom repo into ~/doom-emacs
  2. Copied example init file to init.el
  3. make install
  4. emacs --with-profile doom &

(I'm on emacs 26.1 if it matters)

hlissner commented 6 years ago

You may want to set doom-private-dir too, since Doom has its own dotfile. e.g.

("doom" . ((user-emacs-directory . "~/doom-emacs")
           (doom-private-dir . "~/doom-config")))

The only caveat is Doom's package management is done externally, through bin/doom (which will eventually replace make). Fortunately, all bin/dooms commands are localized to wherever it is running from, so a Doom install is portable.

I haven't tries chemacs myself, but this should get the two working (assuming the above profile):

git clone https://github.com/hlissner/doom-emacs ~/doom-emacs
~/doom-emacs/bin/doom -p ~/doom-config quickstart
emacs --with-profile doom &

Let me know if that gives you any trouble!


For the curious, bin/doom -p ~/doom-config quickstart is a shortcut for:

mkdir ~/doom-config
cp ~/doom-emacs/init.example.el ~/doom-config/init.el
touch ~/doom-config/config.el
bin/doom install

Also: -p DIR sets doom-private-dir, which defaults to ~/.doom.d (or ~/.config/doom if it exists), and -e DIR sets user-emacs-directory.

plexus commented 6 years ago

Thanks @hlissner for chiming in!

("doom" . ((user-emacs-directory . "~/doom")
           (doom-private-dir . "~/doom-config")))

This won't work, Chemacs doesn't know what doom-private-dir is. If there's enough interest we could add the ability to set arbitrary variables, similar to how env works, but currently that's not there. See the README for what's supported.

hlissner commented 6 years ago

Oh! I assumed incorrectly. In that case, I'll add a DOOMDIR envvar for setting doom-private-dir (been meaning to do this), so I trust this will work instead?

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

EDIT: And done!

plexus commented 6 years ago

Yes, that would be great!

mandarvaze commented 6 years ago

@hlissner How do I update my doom installation with your changes ? (Especially since your changes are in develop branch.

hlissner commented 6 years ago

@mandarvaze Are you already using the develop branch? I'd recommend you do, if not. It is almost 2k commits ahead of master (a result of some bad planning, but it's due to be merged into master by this weekend, after which I'll resume a more sane release schedule).

If you are on develop, use bin/doom upgrade.

If you are far back on develop where this command may not work or exist, then do the following from your Doom directory:

doom clean  # remove elc files, if you've run 'doom compile' before
doom sync

Hope that helps!

drym3r commented 6 years ago

It works very well, thanks @hlissner and @plexus!

plexus commented 6 years ago

Cool! If anyone feels like adding a Doom section to the README, next to the Spacemacs section, that'd be super awesome :)

mandarvaze commented 6 years ago

@plexus Done. See #6

JohnMacIsaac commented 5 years ago

@plexus Ok, I've got it so that I can open/run two versions of emacs (vanilla emacs and spacemacs) in two terminal frames. But how do you open/run two GUI versions of emacs?

It would be great if we could open spotlight and type "emacs" to open a GUI version of (vanilla) emacs, and then open spotlight and type "spacemacs" to open a GUI version of spacemacs.

plexus commented 5 years ago

Add a spacemacs wrapper script to your path

JohnMacIsaac commented 5 years ago

Add a spacemacs wrapper script to your path How do you do that? (I figured it must be some sort of bash scripting, so I worked my way thru this tutorial: https://ryanstutorials.net/bash-scripting-tutorial/ , but I still don't know how to do that.)

plexus commented 5 years ago

Hi @JohnMacIsaac, this is not a support forum. Perhaps consider posting your question to StackOverflow or the like.

cameronwp commented 3 years ago

In case it's not clear from the discussion above, I just wanted to point out that you cannot just migrate an existing doom installation to a different directory. You must do a fresh doom install at a non ~/.emacs.d location for this to work.

Thanks for the great tool, @plexus! You've simplified my daily workflow.

hlissner commented 3 years ago

In case it's not clear from the discussion above, I just wanted to point out that you cannot just migrate an existing doom installation to a different directory. You must do a fresh doom install at a non ~/.emacs.d location for this to work.

Correction: run <new-doom-location>/bin/doom sync after moving your doom config. No need to reinstall it all.

cameronwp commented 3 years ago

Oh interesting. Something must have been misconfigured on my machine then. When I was trying to migrate, I moved the dir, updated my $PATH to include the new doom location, and ran doom sync. I wound up running into a slew of "package not found" type errors (I believe the packages included but were not limited to "core-utils" (maybe?), "annalist", and "magit-todos"). I also saw weird behavior like M+x doom/reload failing silently Sorry, I can't give more details because I quickly gave up and reinstalled doom from scratch at the new location.

...but I was on my first cup of coffee so I easily could have messed something up 😛

Also, @hlissner, thanks for all your hard work on doom!

mandarvaze commented 3 years ago

@cameronwp @hlissner I had .el files under <new-doom-location>/.local/straight/build/<package> symlinked to ~/.emacs.d/.local/straight/repos/<package>/lisp/<some_file>.el

Since I moved existing doom installation to <new-doom-location> there were no files under new ~/.emacs.d (I think chemacs creates empty .emacs.d) So I was getting "No such file or directory"

Yes, I had run doom sync before which should have addressed the symlinks - I have Sep 5th, 2020 version of DOOM

After @hlissner pointed me to .local/straight/build/ on the DOOM discord channel, I deleted the build folder (Actually I renamed, so that I can restore if required) and then executed doom sync - which got things working for me. 💯

plexus commented 3 years ago

Thanks for leaving this info here! If there are things that Doom users in particular should be aware of then we can add those to the README, PRs welcome!

mandarvaze commented 3 years ago

@plexus I'm unclear whether doom sync should have recreated the symlinks in .local/straight/build folders @hlissner can comment.

If doom sync is working as expected, I'll create a documentation PR here for "doom with chemacs" section of the README

korsmakolnikov commented 3 years ago

It seems doom is not compatible with .emacs file. At least for me, when I run doom it won't start

mandarvaze commented 3 years ago

@korsmakolnikov

It seems doom is not compatible with .emacs file. At least for me, when I run doom it won't start

Can you share your .emacs-profiles.el ?

Jerror commented 3 years ago

A very minor quibble, but the name of the config folder (ie DOOMDIR) suggested by the doom docs here for chemacs setup differs slightly from what the chemacs docs suggest is expected.

I glossed over the difference between doom-emacs-config and doom-config and thought for a minute that the rumours that chemacs + doom is broken for the emacs native-comp branch were correct, hah.

plexus commented 3 years ago

Feel free to bring our README more in line with the Doom docs, but please do it on Chemacs2.

AnilJoshi commented 3 years ago

Feel free to bring our README more in line with the Doom docs, but please do it on Chemacs2.

Which one is correct? So the README at Chemacs2 is in line with what is in the Doom docs or not?

Which one should I use?

plexus commented 3 years ago

The Doom people should know what is needed, so start from their docs, but make the change on the Chemacs2 repo, and make sure the instructions use chemacs2.

AnilJoshi commented 3 years ago

I got my setup working. I went through Doom docs.