fix typeset_functions

typeset_functions relies on a hack to determine the shell it is running
under. this hack fails on some versions of bash. if the $SHELL variable
is set, prefer that instead.

fix bug in draft()
diff --git a/lib/composure.sh b/lib/composure.sh
index 8ca66d6..beaf13a 100644
--- a/lib/composure.sh
+++ b/lib/composure.sh
@@ -145,13 +145,19 @@
     # unfortunately, there does not seem to be a easy, portable way to list just the
     # names of the defined shell functions...
 
-    # here's a hack I modified from a StackOverflow post:
-    # we loop over the ps listing for the current process ($$), and print the last column (CMD)
-    # stripping any leading hyphens bash sometimes throws in there
-
-    typeset x ans
-    typeset this=$(for x in $(ps -p $$); do ans=$x; done; printf "%s\n" $ans | sed 's/^-*//')
-    typeset shell=$(basename $this)  # e.g. /bin/bash => bash
+    # first, determine our shell:
+    typeset shell
+    if [ -n "$SHELL" ]; then
+        shell=$(basename $SHELL)  # we assume this is set correctly!
+    else
+        # we'll have to try harder
+        # here's a hack I modified from a StackOverflow post:
+        # we loop over the ps listing for the current process ($$), and print the last column (CMD)
+        # stripping any leading hyphens bash sometimes throws in there
+        typeset x ans
+        typeset this=$(for x in $(ps -p $$); do ans=$x; done; printf "%s\n" $ans | sed 's/^-*//')
+        typeset shell=$(basename $this)  # e.g. /bin/bash => bash
+    fi
     case "$shell" in
         bash)
             typeset -F | awk '{print $3}'
@@ -229,7 +235,7 @@
     fi
 
     # aliases bind tighter than function names, disallow them
-    if [ -n "$(type -a $func | grep 'is.*alias')" ]; then
+    if [ -n "$(type -a $func 2>/dev/null | grep 'is.*alias')" ]; then
         printf '%s\n' "sorry, $(type -a $func). please choose another name."
         return
     fi