       catch e
         return false
 
-    if @get(keyPath) isnt value
-      defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
-      value = undefined if _.isEqual(defaultValue, value)
-
-      oldValue = _.clone(@get(keyPath))
-      _.setValueForKeyPath(@settings, keyPath, value)
-      newValue = @get(keyPath)
-      @update({oldValue, newValue, keyPath}) unless _.isEqual(oldValue, newValue)
+    @setRawValue(keyPath, value)
+    @save() unless @configFileHasErrors
     true
 
   # Extended: Restore the key path to its default value.


    try
      userConfig = CSON.readFileSync(@configFilePath)
      @setAllRecursive(userConfig)
      @configFileHasErrors = false
      @emit 'updated'
      @emitter.emit 'did-change'
    catch error
      @configFileHasErrors = true
      console.error "Failed to load user config '#{@configFilePath}'", error.message

    @watchSubscription?.close()
    @watchSubscription = null

  save: ->
    CSON.writeFileSync(@configFilePath, @settings)

  setRawValue: (keyPath, value) ->
    if @get(keyPath) isnt value
      defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
      value = undefined if _.isEqual(defaultValue, value)

      oldValue = _.clone(@get(keyPath))
      _.setValueForKeyPath(@settings, keyPath, value)
      newValue = @get(keyPath)
      @emitter.emit 'did-change', {oldValue, newValue, keyPath}

  setRawDefault: (keyPath, value) ->
    oldValue = _.clone(@get(keyPath))
    _.setValueForKeyPath(@defaultSettings, keyPath, value)
    newValue = @get(keyPath)
    @emitter.emit 'did-change', {oldValue, newValue, keyPath} if newValue isnt oldValue

  setRecursive: (keyPath, value) ->
    if value? and isPlainObject(value)
      keys = if keyPath? then keyPath.split('.') else []
      for key, childValue of value
        continue unless value.hasOwnProperty(key)
        @setRecursive(keys.concat([key]).join('.'), childValue)
    else
      try
        value = @makeValueConformToSchema(keyPath, value)
        @setRawValue(keyPath, value)
      catch e
        console.warn("'#{keyPath}' could not be set. Attempted value: #{JSON.stringify(value)}; Schema: #{JSON.stringify(@getSchema(keyPath))}")

    return

  setDefaults: (keyPath, defaults) ->
    if defaults? and isPlainObject(defaults)
      keys = if keyPath? then keyPath.split('.') else []
      for key, childValue of defaults
        continue unless defaults.hasOwnProperty(key)
        @setDefaults(keys.concat([key]).join('.'), childValue)
    else
      try
        defaults = @makeValueConformToSchema(keyPath, defaults)
        @setRawDefault(keyPath, defaults)
      catch e
        console.warn("'#{keyPath}' could not set the default. Attempted default: #{JSON.stringify(defaults)}; Schema: #{JSON.stringify(@getSchema(keyPath))}")

  setSchema: (keyPath, schema) ->
    unless isPlainObject(schema)
