     doAutoCompact() if autoCompact and idx > scheme.next
     scheme.next = parseInt(_.max(_.keys(scheme.slots))) + 1
     schemeMsg "#{chalk.green 'saving'} slot #{chalk.yellow idx} as #{chalk.grey _path}"
-    saveSchemes()
+    saveCurrentScheme()
     programDone()
 
   saveSlotsRecurse: (_path) ->

cmds = require("../commands")
util = require("../util")

{fatalError, infoMsg, programDone, runCommand, callCommand, confirmPrompt} = util
colors = data = schemes = schemesFile = scheme = currentScheme = autoCompact = recurseWarn = undefined

#
# load schemes and configuation
#

saveSchemes = () ->
  util.saveJsonFile(schemesFile, data)

initSchemesObj = () ->
  return {
    currentScheme: "default"
    autoCompact: true
    recurseWarn: 10
    schemes: {
      default:
        next: 0
        slots: {}
    }
  }

initalizeScheme = (scheme) ->
  schemes[scheme] =
    next: 0
    slots: {}
  saveSchemes()

loadSchemes = () ->
  data = util.loadJsonFile(schemesFile, initSchemesObj)
  {currentScheme, autoCompact, recurseWarn, schemes} = data
  scheme = schemes[currentScheme]
  return if _.isObject(scheme)
  console.error chalk.yellow "currentScheme is missing from schemes.json, setting to 'default' scheme"
  initalizeScheme "default" unless _.isObject(schemes["default"])
  currentScheme = "default"
  scheme = schemes[currentScheme]

util.emitter.on "config:loaded", (config, dataDir) ->
  schemesFile = path.join(dataDir, "schemes.json")
  {colors} = config

#

    schemeMsg chalk.yellow "clearing all slots"
    scheme.slots = {}
    scheme.next = 0
    saveCurrentScheme()
    programDone()

  compactSlots: () ->
