       @editor.getSession().setMode new Mode
       @syntaxMode = mode
 
-  setUseSoftTabs:(value)->
+  setTheme:(themeName, save = yes)->
+    themeName or= @appStorage.getValue('theme') or 'merbivore_soft'
+    require ["ace/theme/#{themeName}"], (callback) =>
+      @editor.setTheme "ace/theme/#{themeName}"
+      return  unless save
+      @appStorage.setValue 'theme', themeName, =>
+        callback
+
+  setUseSoftTabs:(value, save = yes)->
 
     @editor.getSession().setUseSoftTabs value
+    return  unless save
     @appStorage.setValue 'useSoftTabs', value
 
-  setShowGutter:(value)->
+  setShowGutter:(value, save = yes)->
 
     @editor.renderer.setShowGutter value
+    return  unless save
     @appStorage.setValue 'showGutter', value
 
-  setShowPrintMargin:(value)->
+  setShowPrintMargin:(value, save = yes)->
 
     @editor.setShowPrintMargin value
+    return  unless save
     @appStorage.setValue 'showPrintMargin', value
 
-  setHighlightActiveLine:(value)->
+  setHighlightActiveLine:(value, save = yes)->
 
     @editor.setHighlightActiveLine value
+    return  unless save
     @appStorage.setValue 'highlightActiveLine', value
 
   # setHighlightSelectedWord:(value)-> @editor.setHighlightActiveLine value
 
-  setShowInvisibles:(value)->
+  setShowInvisibles:(value, save = yes)->
 
     @editor.setShowInvisibles value
+    return  unless save
     @appStorage.setValue 'showInvisibles', value
 
-  setFontSize:(value, store = yes)->
+  setFontSize:(value, save = yes)->
 
     @$("#editor#{@getId()}").css 'font-size', "#{value}px"
-    if store
-      @appStorage.setValue 'fontSize', value
-
-  setTabSize:(value)->
+    return  unless save
+    @appStorage.setValue 'fontSize', value
+
+  setTabSize:(value, save = yes)->
+
     @editor.getSession().setTabSize +value
+    return  unless save
     @appStorage.setValue 'tabSize', value
 
-  setUseWordWrap:(value)->
+  setUseWordWrap:(value, save = yes)->
 
     @editor.getSession().setUseWrapMode value
+    return  unless save
     @appStorage.setValue 'useWordWrap', value
 
-  setSoftWrap:(value)->
+  setSoftWrap:(value, save = yes)->
     softWrapValueMap =
       'off'  : [ null, 80 ]
       '40'   : [ 40,   40 ]

    @editor.renderer.setPrintMarginColumn margin
    @setUseWordWrap no if value is "off"

    @appStorage.setValue 'softWrap', value

  focus: -> @editor?.focus()


  setContents:(contents)-> @editor.getSession().setValue contents

  setSyntax:(mode)->

    file = @getData()
