I'm looking for a way to map "emacs" to "emacs -nw" in powershell. I tried this (screenshot below), and it adds it as an alias, but it doesn't work. However, the command "emacs -nw" works before setting the alias.

And I also want a way to save that alias for future sessions (restarting the powershell gets me back to square zero)
EDIT:(aditional info)
Also tried creating a function, but when calling that function powershell freezes for a while, then I get the following message (screenshot below)

EDIT2:(aditional info)
At first, function enw {emacs.exe -nw} (changed function name to 'enw' for explanation purposes) seems to work. But then there's a problem. For the standard emacs, I can type emacs -nw filename.txt, and that would open the file filename.txt in emacs -nw. Calling the function enw filename.txt will not open the filename.txt file, providing the same result as just typing enw.
The solution to this is function enw {Param($myparam) emacs.exe -nw $myparam}
Create a function, but within the function explicitly invoke the .exe :
function emacs {emacs.exe -nw}
try creating a function:
function emacs {emacs.exe -nw}
then add it to your powershell profile ( $profile )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With