   # {Delegates to: TextBuffer.isModified}
   isModified: -> @buffer.isModified()
 
-  # Identifies if the modified buffer should let you know if it's closing
-  # without being saved.
-  #
-  # Returns a {Boolean}.
+  # Public: Determines if the user should be prompted to save before closing.
   shouldPromptToSave: -> @isModified() and not @buffer.hasMultipleEditors()
 
   # {Delegates to: DisplayBuffer.screenPositionForBufferPosition}

  # {Delegates to: DisplayBuffer.scopesForBufferPosition}
  scopesForBufferPosition: (bufferPosition) -> @displayBuffer.scopesForBufferPosition(bufferPosition)

  bufferRangeForScopeAtCursor: (selector) ->
    @displayBuffer.bufferRangeForScopeAtPosition(selector, @getCursorBufferPosition())

  # {Delegates to: DisplayBuffer.tokenForBufferPosition}
  tokenForBufferPosition: (bufferPosition) -> @displayBuffer.tokenForBufferPosition(bufferPosition)

  # Retrieves the grammar's token scopes for the line with the most recently added cursor.
  #
  # Returns an {Array} of {String}s.
  getCursorScopes: -> @getCursor().getScopes()

  # Inserts text at the current cursor positions
  #
  # text - A {String} representing the text to insert.
  # options - A set of options equivalent to {Selection.insertText}
  insertText: (text, options={}) ->
    options.autoIndentNewline ?= @shouldAutoIndent()
    options.autoDecreaseIndent ?= @shouldAutoIndent()
    @mutateSelectedText (selection) -> selection.insertText(text, options)

  # Inserts a new line at the current cursor positions.
  insertNewline: ->
    @insertText('\n')

  # Inserts a new line below the current cursor positions.
  insertNewlineBelow: ->
    @transact =>
      @moveCursorToEndOfLine()
      @insertNewline()

  # Inserts a new line above the current cursor positions.
  insertNewlineAbove: ->
    @transact =>
      onFirstLine = @getCursorBufferPosition().row is 0

      else
        positions.push(position)

  # Public:
  #
  # FIXME: Not sure how to describe what this does.
  expandSelectionsForward: (fn) ->
    @mergeIntersectingSelections =>
      fn(selection) for selection in @getSelections()

  # Public:
  #
  # FIXME: Not sure how to describe what this does.
  expandSelectionsBackward: (fn) ->
    @mergeIntersectingSelections isReversed: true, =>
      fn(selection) for selection in @getSelections()

  # Public:
  #
  # FIXME: No idea what this does.
  finalizeSelections: ->
    selection.finalize() for selection in @getSelections()

  # Private: Merges intersecting selections. If passed a function, it executes
  # the function with merging suppressed, then merges intersecting selections
  # afterward.
  mergeIntersectingSelections: (args...) ->
    fn = args.pop() if _.isFunction(_.last(args))
    options = args.pop() ? {}
