From 31143f9f9e9bd46a411fd9032ecce52a62f8d8b5 Mon Sep 17 00:00:00 2001 From: Josh Seba Date: Thu, 12 Jul 2018 15:13:19 -0700 Subject: [PATCH 1/5] Fix a couple errors in doom.cmd - Properly stringize the optional first argument - Use correct path to init.el (relative to script directory) --- bin/doom.cmd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/doom.cmd b/bin/doom.cmd index 810f3fb06..000e811c7 100644 --- a/bin/doom.cmd +++ b/bin/doom.cmd @@ -3,12 +3,12 @@ @ECHO OFF PUSHD "%~dp0" >NUL -IF %1=="run" ( +IF "%1"=="run" ( SHIFT - emacs -Q %* -l init.el -f "doom|run-all-startup-hooks" + emacs -Q %* -l ..\init.el -f "doom|run-all-startup-hooks" ) ELSE ( - emacs --quick --script ./doom -- %* + emacs --quick --script .\doom -- %* ) POPD >NUL -ECHO ON +ECHO ON \ No newline at end of file From a0604e3febb453742a9e34ed1e72f104e3066846 Mon Sep 17 00:00:00 2001 From: Josh Seba Date: Thu, 12 Jul 2018 15:45:37 -0700 Subject: [PATCH 2/5] Tweak the command used for the "run" argument - Using "start" will allow the batch script to return immediately, rather than waiting for the command to finish. - Using "runemacs" (instead of plain "emacs") will hide the console window that is displayed while Emacs is running --- bin/doom.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/doom.cmd b/bin/doom.cmd index 000e811c7..7d9e6179b 100644 --- a/bin/doom.cmd +++ b/bin/doom.cmd @@ -5,10 +5,10 @@ PUSHD "%~dp0" >NUL IF "%1"=="run" ( SHIFT - emacs -Q %* -l ..\init.el -f "doom|run-all-startup-hooks" + start runemacs -Q %* -l ..\init.el -f "doom|run-all-startup-hooks" ) ELSE ( emacs --quick --script .\doom -- %* ) POPD >NUL -ECHO ON \ No newline at end of file +ECHO ON From 58b723bc54e4729b70fa2e2eafff6fec276acf10 Mon Sep 17 00:00:00 2001 From: Josh Seba Date: Thu, 12 Jul 2018 16:32:07 -0700 Subject: [PATCH 3/5] Load early-init.el if early-init-file is not bound *and* true For Emacs 27, the symbol is still bound when using -Q, which means it won't be loaded from bin/doom. --- init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.el b/init.el index 0b3b905e0..07e42f0a2 100644 --- a/init.el +++ b/init.el @@ -27,7 +27,7 @@ ;; ;;; License: MIT -(unless (boundp 'early-init-file) +(unless (bound-and-true-p early-init-file) (load (concat (file-name-directory load-file-name) "early-init") nil t)) From 92b8222529a2da7ebe6f9dc7f5075763759a1fa0 Mon Sep 17 00:00:00 2001 From: Josh Seba Date: Fri, 13 Jul 2018 15:51:22 -0700 Subject: [PATCH 4/5] %* doesn't behave as expected %* is unaffected by SHIFT, so using it results in Emacs loading a buffer named "run" on startup. In order to preserve running all supported commands directly with the bin/doom script, change the magic string in doom.cmd to one that is unused ("runemacs") --- bin/doom.cmd | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/doom.cmd b/bin/doom.cmd index 7d9e6179b..8097a37bd 100644 --- a/bin/doom.cmd +++ b/bin/doom.cmd @@ -3,9 +3,8 @@ @ECHO OFF PUSHD "%~dp0" >NUL -IF "%1"=="run" ( - SHIFT - start runemacs -Q %* -l ..\init.el -f "doom|run-all-startup-hooks" +IF "%1"=="runemacs" ( + start runemacs --quick --no-splash -l ..\init.el -f "doom|run-all-startup-hooks" ) ELSE ( emacs --quick --script .\doom -- %* ) From bc5621adb678ee1a40b7c1abede650e4928e2d8a Mon Sep 17 00:00:00 2001 From: Josh Seba Date: Mon, 16 Jul 2018 16:35:05 -0700 Subject: [PATCH 5/5] Add ability to pass additional args to 'doom run' --- bin/doom.cmd | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/doom.cmd b/bin/doom.cmd index 8097a37bd..132691e4b 100644 --- a/bin/doom.cmd +++ b/bin/doom.cmd @@ -1,10 +1,22 @@ :: Forward the ./doom script to Emacs @ECHO OFF +SETLOCAL ENABLEDELAYEDEXPANSION + PUSHD "%~dp0" >NUL -IF "%1"=="runemacs" ( - start runemacs --quick --no-splash -l ..\init.el -f "doom|run-all-startup-hooks" +SET args= +SET command=%1 + +:LOOP +SHIFT /1 +IF NOT [%1]==[] ( + SET args=%args% %1 + GOTO :LOOP +) + +IF [%command%]==[run] ( + start runemacs -Q %args% -l ..\init.el -f "doom|run-all-startup-hooks" ) ELSE ( emacs --quick --script .\doom -- %* )