   format: (editor, force) ->
     if not (editor.getGrammar().scopeName in @markdownGrammarScopes)
       return
-
-    @pll = atom.config.get('editor.preferredLineLength')
 
     selectionsRanges = editor.getSelectedBufferRanges()
 

      @subscriptions.add editor.getBuffer().onWillSave =>
        @format editor, true if @formatOnSave

  readConfig: (key, callback) ->
    key = 'markdown-table-formatter.' + key
    @subscriptions.add atom.config.onDidChange key, callback
    callback
      newValue: atom.config.get(key)
      oldValue: undefined

  initConfig: ->
    @readConfig "autoSelectEntireDocument", ({newValue}) =>
      @autoSelectEntireDocument = newValue
    @readConfig "spacePadding", ({newValue}) =>
      @spacePadding = newValue
    @readConfig "keepFirstAndLastPipes", ({newValue}) =>
      @keepFirstAndLastPipes = newValue
    @readConfig "formatOnSave", ({newValue}) =>
      @formatOnSave = newValue
    @readConfig "defaultTableJustification", ({newValue}) =>
      @defaultTableJustification = newValue
    @readConfig "markdownGrammarScopes", ({newValue}) =>
      @markdownGrammarScopes = newValue
    @readConfig "limitLastColumnPadding", ({newValue}) =>
      @limitLastColumnPadding = newValue

  destroy: ->
    @subscriptions.dispose()

    if @limitLastColumnPadding
      sum = (arr) -> arr.reduce (x, y) -> x + y
      wsum = sum(widths)
      if widths.length and wsum > @preferredLineLength
        prewsum = sum(widths[...-1])
        widths[widths.length - 1] = Math.max (@preferredLineLength -
          prewsum -
          widths.length - 1), 3
          # Need at least :-- for github to recognize a column
