view emacs/e.bat @ 629:815567721a82

Increase privileges for Cygwin emacs-w32.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Tue, 14 Feb 2017 23:36:32 +0200
parents d7536d442db1
children fcf0302e287e
line wrap: on
line source

@echo off

REM Written by Oleksandr Gavenko <gavenkoa@gmail.com>, 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 e
  set EMACSCLIENT=run --quote emacsclient-w32
  set MAKECYGEMACSADMIN=yes
) 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

:cmd_e
set args=-n
goto invoke
:cmd_ew
set args=
goto invoke
:cmd_ec
set args=-c
goto invoke
:cmd_et
set args=-t
goto invoke

:invoke
if x%1 == x (
  %EMACSCLIENT% %RUNEMACSARG% %args% .
) else (
  %EMACSCLIENT% %RUNEMACSARG% %args% %*
)
goto :eof

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