mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Add an event for after the user keymap has loaded.
This commit is contained in:
@@ -8,6 +8,9 @@ bundledKeymaps = require('../package.json')?._atomKeymaps
|
||||
KeymapManager::onDidLoadBundledKeymaps = (callback) ->
|
||||
@emitter.on 'did-load-bundled-keymaps', callback
|
||||
|
||||
KeymapManager::onDidLoadUserKeymap = (callback) ->
|
||||
@emitter.on 'did-load-user-keymap', callback
|
||||
|
||||
KeymapManager::loadBundledKeymaps = ->
|
||||
keymapsPath = path.join(@resourcePath, 'keymaps')
|
||||
if bundledKeymaps?
|
||||
@@ -32,8 +35,10 @@ KeymapManager::loadUserKeymap = ->
|
||||
return unless fs.isFileSync(userKeymapPath)
|
||||
|
||||
try
|
||||
errorLoading = false
|
||||
@loadKeymap(userKeymapPath, watch: true, suppressErrors: true, priority: 100)
|
||||
catch error
|
||||
errorLoading = true
|
||||
if error.message.indexOf('Unable to watch path') > -1
|
||||
message = """
|
||||
Unable to watch path: `#{path.basename(userKeymapPath)}`. Make sure you
|
||||
@@ -49,6 +54,9 @@ KeymapManager::loadUserKeymap = ->
|
||||
stack = error.stack
|
||||
@notificationManager.addFatalError(error.message, {detail, stack, dismissable: true})
|
||||
|
||||
@emitter.emit 'did-load-user-keymap' unless errorLoading
|
||||
|
||||
|
||||
KeymapManager::subscribeToFileReadFailure = ->
|
||||
@onDidFailToReadFile (error) =>
|
||||
userKeymapPath = @getUserKeymapPath()
|
||||
|
||||
Reference in New Issue
Block a user