Require user init script path after user keymaps

Previously the user init script path was required before the
packages and user keymaps were loaded which could override
config and keymap settings set by the user init script path.
This commit is contained in:
Kevin Sawicki & Nathan Sobo 2013-02-25 11:35:57 -08:00
parent 86f39f8a1a
commit 969327e822
3 changed files with 8 additions and 8 deletions

View File

@ -179,3 +179,10 @@ _.extend atom,
getUpdateStatus: (callback) ->
@sendMessageToBrowserProcess('getUpdateStatus', [], callback)
requireUserInitScript: ->
userInitScriptPath = fs.join(config.configDirPath, "user.coffee")
try
require userInitScriptPath if fs.isFile(userInitScriptPath)
catch error
console.error "Failed to load `#{userInitScriptPath}`", error.stack, error

View File

@ -3,7 +3,6 @@ _ = require 'underscore'
EventEmitter = require 'event-emitter'
configDirPath = fs.absolute("~/.atom")
userInitScriptPath = fs.join(configDirPath, "user.coffee")
bundledPackagesDirPath = fs.join(resourcePath, "src/packages")
bundledThemesDirPath = fs.join(resourcePath, "themes")
vendoredPackagesDirPath = fs.join(resourcePath, "vendor/packages")
@ -53,7 +52,6 @@ class Config
load: ->
@initializeConfigDirectory()
@loadUserConfig()
@requireUserInitScript()
loadUserConfig: ->
if fs.exists(@configFilePath)
@ -100,10 +98,4 @@ class Config
save: ->
fs.writeObject(@configFilePath, @settings)
requireUserInitScript: ->
try
require userInitScriptPath if fs.exists(userInitScriptPath)
catch error
console.error "Failed to load `#{userInitScriptPath}`", error.stack, error
_.extend Config.prototype, EventEmitter

View File

@ -49,6 +49,7 @@ window.startup = ->
atom.loadThemes()
atom.loadPackages()
keymap.loadUserKeymaps()
atom.requireUserInitScript()
$(window).on 'beforeunload', -> shutdown(); false
$(window).focus()