enko / EmacsChocolateyPackage

source code for the emacs package on chocolatey.org
https://chocolatey.org/packages/Emacs/
8 stars 3 forks source link

Keep emacs in Terminal with -nw #13

Open enko opened 4 years ago

enko commented 4 years ago

From https://chocolatey.org/packages/Emacs#comment-4609931655

Is there a way to have emacs open with -nw flag automatically when when typing 'emacs' only?

michaelmhoffman commented 4 years ago

I've looked in the source code and I don't think there is. On Windows, inhibit_window_system is only set false if the -nw option is used. This differs from the case in X11 where you can also make it happen by not setting the DISPLAY environment variable.

midrare commented 3 years ago

This is entirely possible. We just need to hide the orignal emacs.exe somewhere not on the PATH, and have chocolatey create a shim using Install-BinFile targeting the original emacs.exe. Install-BinFile takes the -Command [<String>] argument, which allow you to embed the -nw argument into the shim, so that it's passed to the original emacs.exe each time it's called.