diff options
Diffstat (limited to 'bin/proofgeneral')
-rw-r--r-- | bin/proofgeneral | 82 |
1 files changed, 31 insertions, 51 deletions
diff --git a/bin/proofgeneral b/bin/proofgeneral index d6892d8b..0e277bf3 100644 --- a/bin/proofgeneral +++ b/bin/proofgeneral @@ -3,7 +3,6 @@ # Simple shell script for launching Proof General. # # Set EMACS to override choice of Emacs version -# (otherwise script chooses emacs in preference to xemacs) # # PGHOME must be set to the directory where the lisp files of Proof # General are installed. Script checks standard locations in @@ -19,37 +18,17 @@ # The default path should work if you are using the Proof General RPM # or unpack Proof General in your home directory. Otherwise edit below. # NB: no trailing backslash here! +#PGHOMEDEFAULT=/Applications/Emacs.app/Contents/MacOS/Emacs/site-lisp/ProofGeneral PGHOMEDEFAULT=$HOME/ProofGeneral -# Try to find a default Emacs executable -if [ -z "$EMACS" ] || [ ! -x "$EMACS" ]; then - if which emacs > /dev/null; then - EMACS=`which emacs` - else - EMACS=`which xemacs` - fi -fi - -# Try to find Proof General directory -if [ -d $PGHOMEDEFAULT ]; then - PGHOME=$PGHOMEDEFAULT -elif [ -d /usr/share/${EMACSVERSION}/site-lisp/proofgeneral ]; then - PGHOME=/usr/share/${EMACSVERSION}/site-lisp/proofgeneral -else - echo "Cannot find the Proof General lisp files: please edit script to set PGHOMEDEFAULT correctly." - exit 1 -fi - - NAME=`basename $0` HELP="Usage: proofgeneral [OPTION] [FILE]... Launches Emacs Proof General, editing the proof script FILE. Options: - --emacs startup Proof General with emacs (GNU Emacs) - --xemacs startup Proof General with xemacs (XEmacs) - --emacsbin <EMACS> startup Proof General with emacs binary <EMACS> + --emacs <EMACS> startup Proof General with emacs binary <EMACS> + --pghome <PGDIR> startup Proof General from directory PGDIR -h, --help show this help and exit -v, --version output version information and exit @@ -61,11 +40,10 @@ Examples: For documentation and latest versions, visit http://proofgeneral.inf.ed.ac.uk Report bugs at http://proofgeneral.inf.ed.ac.uk/trac" -# VERSIONBLURB='David Aspinall. -Copyright (C) 1998-2005 LFCS, University of Edinburgh, UK. +Copyright (C) 1998-2008 LFCS, University of Edinburgh, UK. This is free software; see the source for copying conditions.' @@ -77,39 +55,42 @@ while --help) echo "$HELP" exit 0;; - -v) - VERSION=`grep proof-general-version $PGHOME/generic/proof-site.el | sed -e 's/.*Version //g' | sed -e 's/\. .*//g'` - echo "$NAME" "($VERSION)" - echo "$VERSIONBLURB" - exit 0;; - --version) - VERSION=`grep proof-general-version $PGHOME/generic/proof-site.el | sed -e 's/.*Version //g' | sed -e 's/\. .*//g'` - echo "$NAME" "($VERSION)" - echo "$VERSIONBLURB" - exit 0;; --emacs) - EMACS=`which emacs`;; - --xemacs) - EMACS=`which xemacs`;; - --emacsbin) EMACS=$2 shift;; + --pghome) + PGHOME=$2 + shift;; + --version|-v) + VERSION=`grep proof-general-version $PGHOME/generic/proof-site.el | head -1 | sed -e 's/.*Version //g' | sed -e 's/\. .*//g'` + echo "$NAME" "--- script to launch Proof General $VERSION" + echo "$VERSIONBLURB" + exit 0;; *) break;; esac do shift; done -if [ ! -x "$EMACS" ]; then - echo "$NAME: cannot find an Emacs or XEmacs executable. Set EMACS or your PATH." 1>&2 - exit 1 +# Try to find Proof General directory +if [ -z "$PGHOME" ] || [ ! -d "$PGHOME" ]; then + # default relative to this script, otherwise PGHOMEDEFAULT + if [ -d ../generic ]; then + PGHOME="../generic" + elif [ -d "$PGHOMEDEFAULT" ]; then + PGHOME="$PGHOMEDEFAULT" + else + echo "Cannot find the Proof General lisp files: Set PGHOME or use --pghome." + exit 1 + fi fi -EMACSVERSION=`basename $EMACS` - -# Deal with UTF issue -if [ `locale | grep LC_CTYPE | grep UTF` ]; then - echo "Warning: detected Unicode LC_CTYPE setting, switched back to C" - echo " See FAQ for more details." - export LC_CTYPE=C +# Try to find an Emacs executable +if [ -z "$EMACS" ] || [ ! -x "$EMACS" ]; then + if which emacs > /dev/null; then + EMACS=`which emacs` + else + echo "$NAME: cannot find an Emacs executable. Change PATH, set EMACS, use --emacs to specify." 1>&2 + exit 1 + fi fi # User may use .proofgeneral in preference to .emacs or .xemacs/init.el @@ -119,5 +100,4 @@ else STARTUP="" fi - exec $EMACS $STARTUP -eval "(or (featurep (quote proof-site)) (load \"$PGHOME/generic/proof-site.el\"))" -f proof-splash-display-screen "$@" |