     atom.packages.activatePackage('language-julia').catch(->).then =>
       @c.setModes @modes
       @c.reset()
-    @c.onEval (ed) => @eval ed
-    client.onWorking => @c.loading true
-    client.onDone => @c.loading false
+    @subs.add @c.onEval (ed) => @eval ed
+    @subs.add client.onWorking => @c.loading true
+    @subs.add client.onDone => @c.loading false
     atom.views.getView(@c).classList.add 'julia'
     history.read().then (entries) =>
       @c.history.set entries


      input: => @input()

    client.onStdout (s) => @stdout s
    client.onStderr (s) => @stderr s
    client.onInfo   (s) => @info s

  deactivate: ->
    @subs.dispose()
    history.write @c.history.items



module.exports =
  activate: ->
    @subs = new CompositeDisposable

    @create()

    @subs.add atom.config.observe 'julia-client.maximumConsoleSize', (size) =>
      @c.maxSize = size

    client.handle
      info: (msg) =>
