changeset 621:631acaba551f

Switched to use Cygwin Emacs-w32 instead of native.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Mon, 23 Jan 2017 00:39:35 +0200
parents 0ddf939eeae3
children ccd62d24ac73
files emacs/e.bat
diffstat 1 files changed, 25 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/emacs/e.bat	Sun Jan 22 22:59:56 2017 +0200
+++ b/emacs/e.bat	Mon Jan 23 00:39:35 2017 +0200
@@ -10,6 +10,24 @@
 
 REM If path to file contain spaces it must be inclosed into quotes.
 
+goto skip_which
+:which
+  setlocal
+  endlocal & set WHICH=%~$PATH:1
+goto :eof
+:skip_which
+
+call :which emacsclient-w32.exe
+if x%WHICH% == x (
+  rem Native Emacs.
+  set RUNEMACSARG=-a runemacs
+  set EMACSCLIENT=emacsclientw
+) else (
+  rem Cygwin Emacs-w32.
+  set RUNEMACSARG=
+  set EMACSCLIENT=emacsclient-w32
+)
+
 if x%1 == x-h     goto usage
 if x%1 == x-help  goto usage
 if x%1 == x--help goto usage
@@ -23,28 +41,28 @@
 exit 1
 
 :cmd_e
-set args=-a runemacs -n
+set args=-n
 goto invoke
 :cmd_ew
-set args=-a runemacs
+set args=
 goto invoke
 :cmd_ec
-set args=-a runemacs -c
+set args=-c
 goto invoke
 :cmd_et
-set args=-a runemacs -t
+set args=-t
 goto invoke
 
 :invoke
 if x%1 == x (
-  emacsclientw %args% .
+  %EMACSCLIENT% %RUNEMACSARG% %args% .
 ) else (
-  emacsclientw %args% %*
+  %EMACSCLIENT% %RUNEMACSARG% %args% %*
 )
 goto :eof
 
 :usage
-@echo Shortcut for emacsclientw for busy people.
+@echo Shortcut for %EMACSCLIENT% for busy people.
 @echo Usage:
 @echo   e [-h^|--help] file...
 goto :eof