view emacs/e @ 648:898e6d98f933

Translated comments into English.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Wed, 19 Dec 2018 01:06:46 +0200
parents a9aa9260f4a2
children
line wrap: on
line source
#!/bin/bash
# Written by Oleksandr Gavenko <gavenkoa@gmail.com>, 2008-2014.

usage() {
  echo "Shortcut for emacsclient. See e(1) man page."
  echo "Usage:"
  echo "  e  file..."
}

case "$1" in
  -h|-help|--help)
    usage
    exit 0
    ;;
  "")
    set "$PWD"
    ;;
esac

if [[ "$MAKECYGEMACSADMIN" = yes ]]; then
    unset MAKECYGEMACSADMIN
    exec cygstart --action=runas run emacs-w32
fi

emacs_cmd="-a emacs"
if [ -n "$COMSPEC" ]; then
    # We probably under Windows. Don't try to start Emacs as fallback.
    emacs_cmd=
fi

case ${0##*/} in
  ew) args="${emacs_cmd}" ;;
  ec) args="-c" ;;
  et) args="-t" ;;
  *) args="${emacs_cmd} -n" ;;
esac

if [ -n "$COMSPEC" ]; then
    exec emacsclient-w32 $args -- "$@"
fi

f=`readlink -f "$1"`
d="${f%/*}"
if [ '(' -f "$f" -a ! -w "$f" ')' -o '(' ! -e "$f" -a -e "$d" -a ! -w "$d" ')' ]; then
    shift
    exec emacsclient $args -- "/sudo::$f" "$@"
fi
exec emacsclient $args -- "$@"