def app_bindings
      @form.bind_key([?\C-x, ?c], 'suspend') { suspend(false) do
        system("tput cup 26 0")
        system("tput ed")
        system("echo Enter C-d to return to application")
        system (ENV['PS1']='\s-\v\$ ')
        system(ENV['SHELL']);
      end
      }
      # this is a very rudimentary default command executer, it does not 
      # allow tab completion. App should use M-x with names of commands
      # as in appgmail
      # NOTE: This is gonna change very soon - 2012-01-8 
      @form.bind_key(?:, 'prompt') { 
        str = get_command_from_user
      }

      # this M-x stuff has to be moved out so it can be used by all. One should be able
      # to add_commands properly to this, and to C-x. I am thinking how to go about this,
      # and what function M-x actually serves.

      @form.bind_key(?\M-x, 'M-x commands'){
        # TODO previous command to be default
        opts = get_all_commands()
        @_command_history ||= Array.new
        # previous command should be in opts, otherwise it is not in this context
        cmd = rb_gets("Command: ", opts){ |q| q.default = @_previous_command; q.history = @_command_history }
        if cmd.nil? || cmd == ""
        else
          @_command_history << cmd unless @_command_history.include? cmd
          cmdline = cmd.split
          cmd = cmdline.shift
          # check if command is a substring of a larger command
          if !opts.include?(cmd)
            rcmd = _resolve_command(opts, cmd) if !opts.include?(cmd)
            if rcmd.size == 1
              cmd = rcmd.first
            elsif !rcmd.empty?
              rb_puts "Cannot resolve #{cmd}. Matches are: #{rcmd} "
            end
          end
          if respond_to?(cmd, true)
            @_previous_command = cmd
            begin
              send cmd, *cmdline
            rescue => exc
              $log.error "ERR EXC: send throwing an exception now. Duh. IMAP keeps crashing haha !! #{exc}  " if $log.debug? 
              if exc
                $log.debug( exc) 
                $log.debug(exc.backtrace.join("\n")) 
                rb_puts exc.to_s
              end
            end
          else
            rb_puts("Command [#{cmd}] not supported by #{self.class} ", :color_pair => $promptcolor)
          end
        end
      }
    end
def app_bindings
      @form.bind_key([?\C-x, ?c], 'suspend') { suspend(false) do
        system("tput cup 26 0")
        system("tput ed")
        system("echo Enter C-d to return to application")
        system (ENV['PS1']='\s-\v\$ ')
        system(ENV['SHELL']);
      end
      }
      # this is a very rudimentary default command executer, it does not 
      # allow tab completion. App should use M-x with names of commands
      # as in appgmail
      # NOTE: This is gonna change very soon - 2012-01-8 
      @form.bind_key(?:, 'prompt') { 
        str = get_command_from_user
      }

      # this M-x stuff has to be moved out so it can be used by all. One should be able
      # to add_commands properly to this, and to C-x. I am thinking how to go about this,
      # and what function M-x actually serves.

      @form.bind_key(?\M-x, 'M-x commands'){
        # TODO previous command to be default
        opts = get_all_commands()
        @_command_history ||= Array.new
        # previous command should be in opts, otherwise it is not in this context
        cmd = rb_gets("Command: ", opts){ |q| q.default = @_previous_command; q.history = @_command_history }
        if cmd.nil? || cmd == ""
        else
          @_command_history << cmd unless @_command_history.include? cmd
          cmdline = cmd.split
          cmd = cmdline.shift
          # check if command is a substring of a larger command
          if !opts.include?(cmd)
            rcmd = _resolve_command(opts, cmd) if !opts.include?(cmd)
            if rcmd.size == 1
              cmd = rcmd.first
            elsif !rcmd.empty?
              rb_puts "Cannot resolve #{cmd}. Matches are: #{rcmd} "
            end
          end
          if respond_to?(cmd, true)
            @_previous_command = cmd
            begin
              send cmd, *cmdline
            rescue => exc
              $log.error "ERR EXC: send throwing an exception now. Duh. IMAP keeps crashing haha !! #{exc}  " if $log.debug? 
              if exc
                $log.debug( exc) 
                $log.debug(exc.backtrace.join("\n")) 
                rb_puts exc.to_s
              end
            end
          else
            rb_puts("Command [#{cmd}] not supported by #{self.class} ", :color_pair => $promptcolor)
          end
        end
      }
    end
Some bindings that were earlier part of App (in the run block), but now optional for an
  app. I would like to move it out, so they can be mapped separately to whatever a user wants
  and be improved. these are very experimental and bare as yet.
 They should also be usable outside of App.