     @editorElement.component?.setInputEnabled(false)
     @editorElement.classList.add('read-only')
     @vmpActivateNormalMode() if @vmpIsInsertMode()
+
+  setReadOnly: (readOnly) ->
+    @readOnly = readOnly
+    if @readOnly
+      @editorElement.component?.setInputEnabled(false)
+      @editorElement.classList.add('read-only')
+      @vmpActivateNormalMode() if @vmpIsInsertMode()
+    else
+      @editorElement.component.setInputEnabled(true)
+      @editorElement.classList.remove('read-only')
+      @vmpActivateInsertMode() if @vmpIsNormalMode()
 
   observeStopChangingActivePaneItem: ->
     atom.workspace.onDidStopChangingActivePaneItem (item) =>

  itemsByProvider: null # Used to cache result
  lastNarrowQuery: ''
  modifiedState: null

  isModified: ->
    @modifiedState

    @currentItemIndicator = new CurrentItemIndicator(@editor)
    @grammar = new Grammar(@editor, includeHeaderRules: @provider.includeHeaderGrammar)

    @disposables.add @onDidMoveToItemArea  => @setReadOnly(true)

    @disposables.add(
      @registerCommands()
      @observeChange()
      @observeStopChanging()
