       if isFunction and not (foldable and isFunction and not isCommented)
         @debugMessage('fold functions: line is a function, but cannot be folded', foldable, isCommented)
       if foldable and isFunction and not isCommented
+        foldableLines++
         if @indentLevel == null
           @indentLevel = thisIndentLevel
         if action == 'toggle'

    @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++


          editor.foldBufferRow(row)
          fold++
    @debugMessage('fold functions: done scanning ' + lines + ' lines (' + fold + ':' + unfold + ':' + toggle + ')')
    @debugMessage('foldable lines: ' + foldableLines)

  toggle: ->
    @fold('toggle')
