/bin/proofgeneral

https://github.com/DavidAspinall/ProofGeneral · Shell · 105 lines · 66 code · 14 blank · 25 comment · 9 complexity · 9a93115190668604ac1fff7b00db4112 MD5 · raw file

  1. #!/bin/sh
  2. #
  3. # Simple shell script for launching Proof General.
  4. #
  5. # Set EMACS to override choice of Emacs version
  6. #
  7. # PGHOME must be set to the directory where the lisp files of Proof
  8. # General are installed. Script checks standard locations in
  9. # /usr/share/emacs/site-lisp, or uses PGHOMEDEFAULT defined at top.
  10. #
  11. # We load ~/.proofgeneral instead of ~/.emacs if it exists.
  12. #
  13. # Thanks to Achim Brucker for suggestions.
  14. #
  15. # $Id: proofgeneral,v 10.7 2009-12-01 10:58:59 da Exp $
  16. #
  17. # The default path should work if you are using the Proof General RPM
  18. # or unpack Proof General in your home directory. Otherwise edit below.
  19. # NB: no trailing backslash here!
  20. # On Mac, maybe:
  21. # /Applications/Emacs.app/Contents/MacOS/Emacs/site-lisp/ProofGeneral
  22. PGHOMEDEFAULT=$HOME/ProofGeneral
  23. NAME=`basename $0`
  24. HELP="Usage: proofgeneral [OPTION] [FILE]...
  25. Launches Emacs Proof General, editing the proof script FILE.
  26. Options:
  27. --emacs <EMACS> startup Proof General with emacs binary <EMACS>
  28. --pghome <PGDIR> startup Proof General from directory PGDIR
  29. -h, --help show this help and exit
  30. -v, --version output version information and exit
  31. Unrecognized options are passed to Emacs, along with file names.
  32. Examples:
  33. $NAME Example.thy Load Proof General editing Isar file Example.thy
  34. $NAME example.v Load Proof General editing Coq file Example.v
  35. For documentation and latest versions, visit http://proofgeneral.inf.ed.ac.uk
  36. Report bugs at http://proofgeneral.inf.ed.ac.uk/trac"
  37. VERSIONBLURB='David Aspinall.
  38. Copyright (C) 1998-2009 LFCS, University of Edinburgh, UK.
  39. This is free software; see the source for copying conditions.'
  40. while
  41. case $1 in
  42. -h)
  43. echo "$HELP"
  44. exit 0;;
  45. --help)
  46. echo "$HELP"
  47. exit 0;;
  48. --emacs)
  49. EMACS="$2"
  50. shift;;
  51. --pghome)
  52. PGHOME="$2"
  53. shift;;
  54. --version|-v)
  55. VERSION=`grep proof-general-version $PGHOME/generic/proof-site.el | head -1 | sed -e 's/.*Version //g' | sed -e 's/\. .*//g'`
  56. echo "$NAME" "--- script to launch Proof General $VERSION"
  57. echo "$VERSIONBLURB"
  58. exit 0;;
  59. *) break;;
  60. esac
  61. do shift; done
  62. # Try to find Proof General directory
  63. if [ -z "$PGHOME" ] || [ ! -d "$PGHOME" ]; then
  64. # default relative to this script, otherwise PGHOMEDEFAULT
  65. MYDIR="`readlink --canonicalize "$0" | sed -ne 's,/bin/proofgeneral$,,p'`"
  66. if [ -d "$MYDIR" ]; then
  67. PGHOME="$MYDIR"
  68. elif [ -d "$PGHOMEDEFAULT" ]; then
  69. PGHOME="$PGHOMEDEFAULT"
  70. else
  71. echo "Cannot find the Proof General lisp files: Set PGHOME or use --pghome."
  72. exit 1
  73. fi
  74. fi
  75. # Try to find an Emacs executable
  76. if [ -z "$EMACS" ] || [ ! -x "$EMACS" ]; then
  77. if which emacs > /dev/null; then
  78. EMACS=`which emacs`
  79. else
  80. echo "$NAME: cannot find an Emacs executable. Change PATH, set EMACS, use --emacs to specify." 1>&2
  81. exit 1
  82. fi
  83. fi
  84. # User may use .proofgeneral in preference to .emacs or .xemacs/init.el
  85. if [ -f $HOME/.proofgeneral ]; then
  86. STARTUP="-q -l $HOME/.proofgeneral"
  87. else
  88. STARTUP=""
  89. fi
  90. exec $EMACS $STARTUP -eval "(or (featurep (quote proof-site)) (load \"$PGHOME/generic/proof-site.el\"))" -f proof-splash-display-screen "$@"