 
   preserveCursorPositionOnBufferReload: ->
     cursorPosition = null
-    @subscribe @buffer.onWillReload =>
+    @disposables.add @buffer.onWillReload =>
       cursorPosition = @getCursorBufferPosition()
-    @subscribe @buffer.onDidReload =>
+    @disposables.add @buffer.onDidReload =>
       @setCursorBufferPosition(cursorPosition) if cursorPosition
       cursorPosition = null
 

Serializable = require 'serializable'
Delegator = require 'delegato'
{includeDeprecatedAPIs, deprecate} = require 'grim'
{Model} = require 'theorist'
EmitterMixin = require('emissary').Emitter
{CompositeDisposable, Emitter} = require 'event-kit'
{Point, Range} = TextBuffer = require 'text-buffer'
LanguageMode = require './language-mode'
DisplayBuffer = require './display-buffer'
Cursor = require './cursor'
Selection = require './selection'
TextMateScopeSelector = require('first-mate').ScopeSelector
{Directory} = require "pathwatcher"


  subscribeToBuffer: ->
    @buffer.retain()
    @disposables.add @buffer.onDidChangePath =>
      unless atom.project.getPaths().length > 0
        atom.project.setPaths([path.dirname(@getPath())])
      @emit "title-changed" if includeDeprecatedAPIs
      @emitter.emit 'did-change-title', @getTitle()
      @emit "path-changed" if includeDeprecatedAPIs
      @emitter.emit 'did-change-path', @getPath()
    @disposables.add @buffer.onDidChangeEncoding =>
      @emitter.emit 'did-change-encoding', @getEncoding()
    @disposables.add @buffer.onDidDestroy => @destroy()

    # TODO: remove these when we remove the deprecations. They are old events.
    if includeDeprecatedAPIs
