From 14c1d690cf8018230689dd8dbf4e83408a9a0c06 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 27 Jan 2021 18:00:21 -0600 Subject: Fancify Windows batch files --- config.org | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/config.org b/config.org index 6ddbb0b..242ba86 100644 --- a/config.org +++ b/config.org @@ -2438,20 +2438,27 @@ into the multiple settings available for w32 systems. **** Common variables #+begin_src bat :noweb-ref w32-bat-common -set HOME=%~dp0..\.. -set EMACS=%HOME%\Applications\Emacs\bin\runemacs.exe -chdir %HOME% + if not exist %HOME% (set HOME=%~dp0..\..) + set EMACS=%HOME%\Applications\Emacs\bin\runemacs.exe + set EMACSC=%HOME%\Applications\Emacs\bin\emacsclientw.exe + set GIT=%HOME%\Applications\Git\bin\git.exe #+end_src -**** Emacs Daemon +**** Emacs Autostart Either run this once at startup, or put a shortcut of it in the Startup folder: =%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup=. -#+begin_src bat :tangle (if (eq system-type 'windows-nt) "~/Applications/cmd/Emacs Daemon.cmd" "") -<> -%EMACS% --daemon +#+begin_src bat :tangle (if (eq system-type 'windows-nt) "~/Applications/cmd/Emacs Autostart.cmd" "") + <> + REM git pull the config + start "git" /wait %GIT% -C %HOME%\.emacs.d pull + + REM start emacs + chdir %HOME% + start "emacs-daemon" %EMACS% --daemon=autostart + start "emacs" %EMACSC% -n -c --server-file=autostart %* #+end_src **** Emacs Client @@ -2463,8 +2470,14 @@ run =runemacs.exe=. #+begin_src bat :tangle (if (eq system-type 'windows-nt) "~/Applications/cmd/Emacs.cmd" "") <> -set EMACSC=%HOME%\Applications\Emacs\bin\emacsclientw.exe -"%EMACSC%" -n -c -a "%EMACS%" %* +start "emacs" "%EMACSC%" -n -c -a "%EMACS%" %* +#+end_src + +**** Emacs Daemon + +#+begin_src bat :tangle (if (eq system-type 'windows-nt) "~/Applications/cmd/Emacs Daemon.cmd" "") +<> +start "emacs-daemon" %EMACS% --daemon #+end_src **** Emacs Safe Start @@ -2473,7 +2486,7 @@ This runs Emacs with the factory settings. #+begin_src bat :tangle (if (eq system-type 'windows-nt) "~/Applications/cmd/Emacs Safe Start.cmd" "") <> -"%EMACS%" -Q %* +start "emacs-safe" "%EMACS%" -Q %* #+end_src **** Emacs Debug @@ -2482,7 +2495,7 @@ This runs Emacs with the =--debug-init= option enabled. #+begin_src bat :tangle (if (eq system-type 'windows-nt) "~/Applications/cmd/Emacs Debug.cmd" "") <> -"%EMACS%" --debug-init %* +start "emacs-debug" "%EMACS%" --debug-init %* #+end_src * Appendices -- cgit 1.4.1-21-gabe81