Scripts: new elisp script
parent
0ca94724c3
commit
b923d2f6d6
|
@ -0,0 +1,47 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
_printhelp ()
|
||||||
|
{
|
||||||
|
cat<<EOF
|
||||||
|
Usage: ${1##*/} [OPTIONS] SCRIPT
|
||||||
|
|
||||||
|
Run Emacs Lisp SCRIPT.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
-b: Byte-compile before running.
|
||||||
|
-c: Remove byte code once finished.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
OPT_BYTE=false
|
||||||
|
OPT_CLEAN=false
|
||||||
|
while getopts :bc OPT; do
|
||||||
|
case $OPT in
|
||||||
|
b)
|
||||||
|
OPT_BYTE=true ;;
|
||||||
|
c)
|
||||||
|
OPT_CLEAN=true ;;
|
||||||
|
?)
|
||||||
|
_printhelp "$0"
|
||||||
|
exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
shift $(($OPTIND - 1))
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
_printhelp "$0"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $OPT_BYTE && [ "${1##*.}" = "el" ]; then
|
||||||
|
script="${1%.*}.elc"
|
||||||
|
emacs -Q --batch -f batch-byte-compile "$1"
|
||||||
|
else
|
||||||
|
script="$1"
|
||||||
|
OPT_CLEAN=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
emacs -Q --script "$script"
|
||||||
|
|
||||||
|
$OPT_CLEAN && rm "$script"
|
Loading…
Reference in New Issue