function _updateFromPrefs(pref) {
        var newMapping = PreferencesManager.get(pref),
            newNames = Object.keys(newMapping),
            state = _prefState[pref],
            last = state.last,
            overridden = state.overridden;

        // Look for added and changed names (extensions or filenames)
        newNames.forEach(function (name) {
            var language;
            if (newMapping[name] !== last[name]) {
                if (last[name]) {
                    language = getLanguage(last[name]);
                    if (language) {
                        language[state.remove](name);

                        // If this name that was previously mapped was overriding a default
                        // restore it now.
                        _restoreOverriddenDefault(name, state);
                    }
                }

                language = exports[state.get](name);
                if (language) {
                    language[state.remove](name);

                    // We're removing a name that was defined in Brackets or an extension,
                    // so keep track of how it used to be mapped.
                    if (!overridden[name]) {
                        overridden[name] = language.getId();
                    }
                }
                language = getLanguage(newMapping[name]);
                if (language) {
                    language[state.add](name);
                }
            }
            if(!getLanguage(newMapping[name])) {
                
                // If the language doesn't exist, restore any overrides and remove it
                // from the state.
                if(overridden[name]) {
                    _restoreOverriddenDefault(name, state);
                }
                delete newMapping[name];
            }
        });

        // Look for removed names (extensions or filenames)
        _.difference(Object.keys(last), newNames).forEach(function (name) {
            var language = getLanguage(last[name]);
            if (language) {
                language[state.remove](name);
                _restoreOverriddenDefault(name, state);
            }
        });
        state.last = newMapping;
    }
@private

Updates extension and filename mappings from languages based on the current preferences values.

The preferences look like this in a prefs file:

Map *.foo to javascript, *.vm to html

    "language.fileExtensions": {
        "foo": "javascript",
        "vm": "html"
    }

Map "Gemfile" to ruby:

    "language.fileNames": {
        "Gemfile": "ruby"
    }