def detect_autoindent input
    _, backmark = BLOCK_REGEXP.find{ |key,  _| input =~ key }
    if backmark # e.g. begin
      [:right, backmark]
    elsif input =~ autoindent_stack.last
      if $1     # e.g. end, }, etc
        [:left_end]
      else      # e.g. elsif, rescue, etc
        [:left_tmp]
      end
    else
      [:stay]
    end
  end
def detect_autoindent input
    _, backmark = BLOCK_REGEXP.find{ |key,  _| input =~ key }
    if backmark # e.g. begin
      [:right, backmark]
    elsif input =~ autoindent_stack.last
      if $1     # e.g. end, }, etc
        [:left_end]
      else      # e.g. elsif, rescue, etc
        [:left_tmp]
      end
    else
      [:stay]
    end
  end
--------------- Plugin API ---------------