view emacs/e.bat @ 623:285855784c5a

Make possible to start Cygwin Emacs-w32 if it is not yet started.
author Oleksandr Gavenko <>
date Mon, 23 Jan 2017 02:30:10 +0200
parents ccd62d24ac73
children d7536d442db1
line wrap: on
line source

@echo off

REM Written by Oleksandr Gavenko <>, 2008, 2015.
REM File placed by author in public domain.

REM View files in emacs buffer using emacsclientw.
REM If emacs not already running, run it.
REM Put this file (e.bat) in your PATH.
REM Name `e' because `edit'. `ew' wait to `C-x #'. `ec' create new frame.

REM If path to file contain spaces it must be inclosed into quotes.

for %%X in (emacsclient-w32.exe) do (set FOUND=%%~$PATH:X)
if defined FOUND (
  rem Cygwin Emacs-w32.
  set RUNEMACSARG=-a emacs-w32
  set EMACSCLIENT=run emacsclient-w32
) else (
  rem Native Emacs.
  set RUNEMACSARG=-a runemacs
  set EMACSCLIENT=emacsclientw

if x%1 == x-h     goto usage
if x%1 == x-help  goto usage
if x%1 == x--help goto usage

if %~n0 == e goto cmd_e
if %~n0 == ew goto cmd_ew
if %~n0 == ec goto cmd_ec
if %~n0 == et goto cmd_et

echo Unknown command flavor: %~n0, use one of e/ew/ec/et.
exit 1

set args=-n
goto invoke
set args=
goto invoke
set args=-c
goto invoke
set args=-t
goto invoke

if x%1 == x (
) else (
goto :eof

@echo Shortcut for %EMACSCLIENT% for busy people.
@echo Usage:
@echo   e [-h^|--help] file...
goto :eof