Describe the issue
After cloning the repo, we have to run ~/.emacs.d/bin/doom install. For me (emphasis), under WSL v1 (Ubuntu 18.04), this gives a syntax error
~/.emacs.d/bin/doom: 6: ~/.emacs.d/bin/doom: Syntax error: newline unexpected (expecting ")")
Strangely, when I manually do /usr/bin/env sh and then copy-paste individual top lines of the script, everything appears to run fine. When I try and copy paste the entire script in this way, it borks out on the exec line at the bottom of the ":"; section at the top.
The doom script is way beyond my abilities beyond copy-pasting lines. Given that the exact same script works on OSX (my only other reference), I suspect it is somehow related to either differences in env, sh, or exec due to WSL (but dont' take that for granted).
W10 Enterprise (Build 17763; under corporate control, so old). No other info available because bin/doom doesn't work.
Help :man_shrugging:
For good measure(?) I also tried the deprecated make approacht but that also didn't fly:
```
~/.emacs.d$ make
Using make to manage your Doom config is deprecated
Use the 'bin/doom' script instead. The equivalent of 'make' is 'doom refresh'.
See 'doom help' for a list of commands
Press enter to continue/bin/sh: 1: read: arg count
Makefile:8: recipe for target 'deprecated' failed
make: * [deprecated] Error 2
````
I just deployed a few big updates to bin/doom. Could you update to the latest commit and let me know if this is still a problem?
After git pull --force I again tried bin/doom install but alas still
~/.emacs.d$ bin/doom install
bin/doom: 6: bin/doom: Syntax error: newline unexpected (expecting ")")
I'm currently on commit 58e674d8fb85515e7980c87fc708dabb2b276128.
Are you sure you haven't accidentally modified bin/doom? I cannot reproduce this.
Fairly sure i haven't, but I'll completely remove and clone the repo when
I'm back at work tomorrow. Will get back to you!
On Sun, 10 Nov 2019, 19:55 Henrik Lissner, notifications@github.com wrote:
Are you sure you haven't accidentally modified bin/doom? I cannot
reproduce this.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/hlissner/doom-emacs/issues/2030?email_source=notifications&email_token=ABGUIFVO7I7SOVK6PC5ZQSLQTBKK7A5CNFSM4JKX5SD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDVD7DA#issuecomment-552222604,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABGUIFX7AFTV75NEHRDZEXTQTBKK7ANCNFSM4JKX5SDQ
.
Hi @hlissner, I removed my doom emacs.d and then again cloned as you suggested. Unfortunately it wasn't the magic fix that we might have hoped for.
nlv19419@YY173956:~$ git clone https://github.com/hlissner/doom-emacs ~/.emacs.d
Cloning into '/home/nlv19419/.emacs.d'...
remote: Enumerating objects: 155, done.
remote: Counting objects: 100% (155/155), done.
remote: Compressing objects: 100% (98/98), done.
remote: Total 70409 (delta 94), reused 101 (delta 56), pack-reused 70254
Receiving objects: 100% (70409/70409), 17.59 MiB | 13.47 MiB/s, done.
Resolving deltas: 100% (49274/49274), done.
Checking out files: 100% (688/688), done.
nlv19419@YY173956:~$ ~/.emacs.d/bin/doom install
/home/nlv19419/.emacs.d/bin/doom: 6: /home/nlv19419/.emacs.d/bin/doom: Syntax error: newline unexpected (expecting ")")
I'm now on
commit c297d091bd72c4c3b90ba5f21dbb05ccf3aabdd0 (HEAD -> develop, origin/develop, origin/HEAD)
Author: Henrik Lissner <[email protected]>
Date: Sun Nov 10 23:43:05 2019 -0500
Fix void-function doom-initialize-packages on 'doom upgrade'
I compared the sources.list of my WSL ubuntu with that of another computer running (real, linux) ubuntu and found no meaningful differences.
Then I considered whether that WSL appends the windows path by default at the end of the WSL linux path might result in bin/doom accidentally using a wrong executable; on the windows side I also have a considerable number of linux tools installed and on the path. That also did not solve the matter.
Finally I verified what happens when I try to do the commands in the Reddit post that you link to in Getting started, and I got this:
emacs --batch --eval (setq user-emacs-directory default-directory) -l core/core.el -f doom/packages-install
-bash: syntax error near unexpected token `('
So even in this simple scenario, I'm already getting syntax errors!? Later today i'm going to try to install another distribution under WSL to see if I can get that to work while it still is in a fresh state.
@paullemmens you have to quote the elisp string you are giving to --eval:
~~~elisp
emacs --batch --eval "(setq user-emacs-directory default-directory)" -l core/core.el -f doom/packages-install
emacs --batch --eval '(setq user-emacs-directory default-directory)' -l core/core.el -f doom/packages-install
emacs --batch --eval (setq\ user-emacs-directory\ default-directory) -l core/core.el -f doom/packages-install
~~~
@ckruse Thanks, I think I tried your latter quoting option and again got an error. Trying the reddit code, anyway, was only me trying to be helpful in figuring out what is wrong with my WSL setup so that I get the syntax error that I started writing about.
That is, I'm starting to become fairly confident that this is something very specific to my setup (somehow) and given my lack of understanding of the bin/doom script, I try as many related things to see if that somehow triggers somebody like "oh wait, try this" to see if that works. This way I'm hoping to solve the problem for me and also, possibly, add to this project's knowhow :)
Yes @hlissner as I expected: with a fresh install of Xenial (16.04) the bin/doom script runs as intended. So (presuming 16.04 and 18.04 are not fundamentally different) it must be something on my local system. I'll have to dive into my bashrc etc to see if there's something fishy in there that might trigger the problem. Will keep you updated.
Damn 😠 cried "victory" too soon. When I created a new user in my 18.04 ubuntu, even with a nearly empty home dir, I still get the error that this whole thing started with. Gonna let it rest until later this week.
Ok, couldn't resist. So I changed the bin/doom script to
#!/usr/bin/env sh
set -x
:; ( echo "$EMACS" | grep -q "term" ) && EMACS=emacs || EMACS=${EMACS:-emacs} # -*-emacs-lisp-*-
:; command -v $EMACS >/dev/null || { >&2 echo "Can't find emacs in your PATH"; exit 1; }
:; VERSION=$($EMACS --version | head -n1)
:; case "$VERSION" in *\ 2[0-5].[0-9]) echo "Detected Emacs $VERSION"; echo "Doom only supports Emacs 26.1 and newer"; e
cho; exit 2 ;; esac
:; DOOMBASE="$(dirname "$0")/.."
:; [ "$1" = -d ] || [ "$1" = --debug ] && { shift; export DEBUG=1; }
:; [ "$1" = run ] && { cd "$DOOMBASE"; shift; exec $EMACS -q --no-splash -l bin/doom "$@"; exit 0; }
:; exec $EMACS --script "$0" -- "$@"
:; exit 0
set +x
and then I get this
~/.emacs.d/bin/doom install
/home/nlv19419/.emacs.d/bin/doom: 2: set: Illegal option -
Does that help anything @hlissner ? Or some pointer that could help me proceed myself?
Finally I verified what happens when I try to do the commands in the Reddit post that you link to in Getting started, and I got this:
Don't use the commands found in that post. It is outdated and the doom/packages-install command does not exist anymore.
Does that help anything @hlissner ? Or some pointer that could help me proceed myself?
Sorry to say I am no closer to figuring it out. It seems like something non-standard in WSL's bash, but I don't know WSL enough to offer any more insight into this.
I'm closing this.
Yesterday I tried creating a new and completely clean/empty user and under that account I was able to download and install Doom. Yet when I tried to recreate the (exact) same files and settings in the original user that the problem started with: no joy again. So this is something really finicky in that specific user, not worthwhile spending more of your time on.
I will try to get the new user up and running and otherwise I'll discard the entire WSL and restart afresh when there's less time pressure.
Thanks for bearing with me! 👍
Had the same problem. For some reason the doom script, when cloned in WSL has DOS line endings. Running the following fixed it:
dos2unix .emacs.d/bin/doom
Hello,
For posterity's sake, I figured out the reason this happened. It does indeed have to do with Line endings like mikevas said.
In my case, this was because I had an earlier doom install on Emacs windows (but not by the WSL method), and emacs.d/bin was on PATH (in windows). the PATH environment variables of windows gets picked up by WSL, and so running doom doctor was calling the doom script that was installed beforehand by the non-WSL method, thus having Windows line endings, and therefore was throwing up this error.
Most helpful comment
Had the same problem. For some reason the doom script, when cloned in WSL has DOS line endings. Running the following fixed it:
dos2unix .emacs.d/bin/doom