 {CompositeDisposable} = require 'atom'
 path = require 'path'
 
-disposable = new CompositeDisposable
+disposable = undefined
 
 # terrible hack to use the editor font
 setupLogCss = ->

module.exports =
class LTConsole
  constructor: (state) ->
    setupLogCss()

    unless state?.messagePanelView?

    # don't display a summary
    @messages.setSummary summary: ''

    # close the console if we switch to a non-LaTeX view
    disposable.add atom.workspace.onDidStopChangingActivePaneItem (item) =>
      @messages.close() unless item?.getGrammar?().scopeName is 'text.tex.latex'

  destroy: ->
    @messages.panel?.destroy()
    @messages.panel = undefined
    disposable.dispose()

  serialize: ->
    messagePanelView:
