         autofold = false
 
     if autofold
-      console.log('fold functions: autofolding')
+      console.log('fold functions: start autofolding')
       @fold('autofold', editor)
 
   # Figure out the number of functions in this file.

      if foldable
        hasFoldableLines = true

      isFunction = @hasScopeAtBufferRow(editor, row,
      'meta.function', 'meta.method',
      'storage.type.arrow', 'entity.name.function.constructor')
      if foldable and isFunction and not isCommented
        if @indentLevel == null
          @indentLevel = thisIndentLevel
        if action == 'toggle'
          editor.toggleFoldAtBufferRow(row)
        else if action == 'unfold' and isFolded
          editor.unfoldBufferRow(row)
        else if !editor.isFoldedAtBufferRow(row)
          editor.foldBufferRow(row)

  toggle: ->
    @fold('toggle')

      editor = atom.workspace.getActiveTextEditor()

    if not editor
      @debugMessage('fold functions: ’no editor, skipping')
      return

    @debugMessage('fold functions: action=', action)
    @indentLevel = @indentLevel || null
    hasFoldableLines = false
    lines = fold = unfold = toggle = 0
    for row in [0..editor.getLastBufferRow()]
      foldable = editor.isFoldableAtBufferRow(row)
      isFolded = editor.isFoldedAtBufferRow(row)
      isCommented = editor.isBufferRowCommented(row)

      lines++

      # check the indent level for this line and make sure it is the same as
      # previous lines where we found functions
      thisIndentLevel = editor.indentationForBufferRow(row)
