more sophisticated MacOS interface script (mostly for Carbon Emacs);
authorwenzelm
Mon, 22 Dec 2008 14:40:27 +0100
changeset 29149 eae45c2a6811
parent 29148 9b725c8c8ecc
child 29150 8af5ee47f30c
more sophisticated MacOS interface script (mostly for Carbon Emacs); no longer include MacPorts path; simplified default PROOFGENERAL_OPTIONS, removed PROOFGENERAL_EMACS;
Admin/MacOS/script
etc/settings
--- a/Admin/MacOS/script	Sun Dec 21 12:41:09 2008 +0100
+++ b/Admin/MacOS/script	Mon Dec 22 14:40:27 2008 +0100
@@ -5,37 +5,56 @@
 # Isabelle application wrapper
 
 THIS="$(cd "$(dirname "$0")"; pwd)"
-
+THIS_APP="$(cd "$THIS/../.."; pwd)"
+SUPER_APP="$(cd "$THIS/../../.."; pwd)"
 
-# global defaults
-ISABELLE_TOOL=""
-ISABELLE_INTERFACE="emacs"
-#ISABELLE_INTERFACE="jedit"
-
-
-# sane environment defaults
-PATH="$PATH:/opt/local/bin"
 cd "$HOME"
 
 
-# Isabelle location
+# settings support
+
+function choosefrom ()
+{
+  local RESULT=""
+  local FILE=""
+
+  for FILE in "$@"
+  do
+    [ -z "$RESULT" -a -e "$FILE" ] && RESULT="$FILE"
+  done
+
+  [ -z "$RESULT" ] && RESULT="$FILE"
+  echo "$RESULT"
+}
+
 
-if [ -z "$ISABELLE_TOOL" ]; then
-  if [ -e "$THIS/Isabelle/bin/isabelle" ]; then
-    ISABELLE_TOOL="$THIS/Isabelle/bin/isabelle"
-  elif [ -e "$HOME/bin/isabelle" ]; then
-    ISABELLE_TOOL="$HOME/bin/isabelle"
-  else
-    ISABELLE_TOOL=isabelle
-  fi
+# Isabelle
+
+ISABELLE_TOOL="$(choosefrom \
+  "$THIS/Isabelle/bin/isabelle" \
+  "$SUPER_APP/Isabelle/bin/isabelle" \
+  "$HOME/bin/isabelle" \
+  isabelle)"
+
+
+# Proof General / Emacs
+
+PROOFGENERAL_EMACS="$(choosefrom \
+  "$THIS/Emacs.app/Contents/MacOS/Emacs" \
+  "$SUPER_APP/Emacs.app/Contents/MacOS/Emacs" \
+  /Applications/Emacs.app/Contents/MacOS/Emacs \
+  "")"
+
+if [ -n "$PROOFGENERAL_EMACS" ]; then
+  PROOFGENERAL_OPTIONS="-p $PROOFGENERAL_EMACS $PROOFGENERAL_OPTIONS"
 fi
 
 
-# run interface
+# run interface with error feedback
 
 OUTPUT="/tmp/isabelle$$.out"
 
-( "$HOME/bin/isabelle" "$ISABELLE_INTERFACE" "$@" ) > "$OUTPUT" 2>&1
+( "$HOME/bin/isabelle" emacs "$@" ) > "$OUTPUT" 2>&1
 RC=$?
 
 if [ "$RC" != 0 ]; then
@@ -43,10 +62,7 @@
   echo "Return code: $RC" >> "$OUTPUT"
 fi
 
-
-# error feedback
-
-if [ -n "$OUTPUT" ]; then
+if [ $(stat -f "%z" "$OUTPUT") != 0 ]; then
   "$THIS/CocoaDialog.app/Contents/MacOS/CocoaDialog" textbox \
     --title "Isabelle" \
     --informative-text "Isabelle output" \
--- a/etc/settings	Sun Dec 21 12:41:09 2008 +0100
+++ b/etc/settings	Mon Dec 22 14:40:27 2008 +0100
@@ -201,9 +201,8 @@
   "/opt/ProofGeneral" \
   "")
 
-PROOFGENERAL_EMACS=$(choosefrom /Applications/Emacs.app/Contents/MacOS/Emacs emacs22)
-PROOFGENERAL_OPTIONS="-p $PROOFGENERAL_EMACS"
-#PROOFGENERAL_OPTIONS="-m no_brackets -m no_type_brackets -x true -p $PROOFGENERAL_EMACS"
+PROOFGENERAL_OPTIONS=""
+#PROOFGENERAL_OPTIONS="-m no_brackets -m no_type_brackets"
 
 # Automatic setup of remote fonts
 #XSYMBOL_INSTALLFONTS="xset fp+ tcp/isafonts.informatik.tu-muenchen.de:7200"