Hmm. Damn, I temporarily forgot: Atom is very asynchronous in how it loads packages and there’s no canonical order, so in order to interact with a package in
init.coffee, it’s probably necessary to tell it to wait until all of the packages are loaded.
So I did all that, and it doesn’t work, and I’m not sure why.
if atom.commands.dispatch document.querySelector('atom-text-editor'), 'spell-check:toggle'
console.log "The spell-check package should be toggled off."
console.log "Something's amiss."
As you can see if you use
atom.commands.dispatch(document.querySelector('atom-text-editor'), 'spell-check:toggle') from the console,
true if the command can be executed. So the confirmatory
console.log should show up only if the package is successfully toggled off. Instead, I see the confirmation and I still see red marks in my document. I’m not sure why this is happening.