changeset 622:ccd62d24ac73

Simplify search for executable in PATH.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Mon, 23 Jan 2017 01:01:16 +0200
parents 631acaba551f
children 285855784c5a
files emacs/e.bat
diffstat 1 files changed, 6 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/emacs/e.bat	Mon Jan 23 00:39:35 2017 +0200
+++ b/emacs/e.bat	Mon Jan 23 01:01:16 2017 +0200
@@ -10,22 +10,15 @@
 
 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 (
+for %%X in (emacsclient-w32.exe) do (set FOUND=%%~$PATH:X)
+if defined FOUND (
+  rem Cygwin Emacs-w32.
+  set RUNEMACSARG=
+  set EMACSCLIENT=emacsclient-w32
+) else (
   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