       @updateLineNumberGutterState()
       @updateLineNumbersState()
       @updateCommonGutterState()
-      @updateCustomGutterState()
+      @updateGutterOrderState()
       @updateCustomGutterDecorationState()
     @disposables.add @model.onDidChangeLineNumberGutterVisible =>
       @updateLineNumberGutterState()
       @updateCommonGutterState()
-      @updateCustomGutterState()
+      @updateGutterOrderState()
     @disposables.add @model.onDidAddDecoration(@didAddDecoration.bind(this))
     @disposables.add @model.onDidAddCursor(@didAddCursor.bind(this))
     @disposables.add @model.onDidChangeScrollTop(@setScrollTop.bind(this))

    @updateLineNumberGutterState()
    @updateLineNumbersState()
    @updateCommonGutterState()
    @updateCustomGutterState()
    @updateCustomGutterDecorationState()

  updateFocusedState: -> @batch "shouldUpdateFocusedState", ->

  didAddGutter: (gutter) ->
    gutterDisposables = new CompositeDisposable
    gutterDisposables.add gutter.onDidChangeVisible =>
      @updateGutterOrderState()
      @updateCustomGutterDecorationState()
    gutterDisposables.add gutter.onDidDestroy =>
      @disposables.remove(gutterDisposables)
      gutterDisposables.dispose()
      @updateGutterOrderState()
      # It is not necessary to @updateCustomGutterDecorationState here.
      # The destroyed gutter will be removed from the list of gutters in @state,
      # and thus will be removed from the DOM.
    @disposables.add(gutterDisposables)
    @updateGutterOrderState()
    @updateCustomGutterDecorationState()

  updateGutterOrderState: ->
    @batch "shouldUpdateGutterOrderState", ->
      @state.gutters.sortedDescriptions = []
      if @model.isMini()
        return
