It is much better to throw away food like that than to try to keep it around when it's starting to seriously call your name. You did good.
You picked those chocolate almonds up in an attempt to comfort yourself. I think that many times, these choices happen on a non-verbal level, which is why it's so confusing when we get to thinking about it.
The trick is to catch yourself when you are in the act of picking up the package and carrying it to the checkout counter. Just a simple question like "Why am I buying this?" can be enough to give you a moment of choice to work with. You may still buy it, or not--but at least you have had a chance to THINK about it and make a conscious decision.
You can also use the "hunger test." Basically, if you think you're hungry and a friend offers you an apple, you'll eat the apple if you're really hungry. If you're not really hungry but having a craving, then the apple won't do--you'll want that "other" food. Again, this just gives you time to evaluate what's going on.
Good luck! Hang in there!