         syntax.addProperties(selector, properties)
 
   activate: ->
+    keymap.add(map) for map in @keymaps
+
     if @deferActivation
       @subscribeToActivationEvents()
     else
-      try
-        if @requireMainModule()
-          config.setDefaults(@name, @mainModule.configDefaults)
-          atom.activateAtomPackage(this)
-      catch e
-        console.warn "Failed to activate package named '#{@name}'", e.stack
+      @activateNow()
+
+  activateNow: ->
+    try
+      if @requireMainModule()
+        config.setDefaults(@name, @mainModule.configDefaults)
+        atom.activateAtomPackage(this)
+    catch e
+      console.warn "Failed to activate package named '#{@name}'", e.stack
 
   requireMainModule: ->
     return @mainModule if @mainModule

    activateHandler = (event) =>
      bubblePathEventHandlers = @disableEventHandlersOnBubblePath(event)
      @deferActivation = false
      @activate()
      $(event.target).trigger(event)
      @restoreEventHandlersOnBubblePath(bubblePathEventHandlers)
      @unsubscribeFromActivationEvents(activateHandler)

module.exports =
class AtomPackage extends Package
  metadata: null
  keymaps: null
  mainModule: null
  deferActivation: false

