After years of this I know lots of things set off cravings, including, but not limited to:
1) See a TV commercial of something I used to eat.
2) Smelling cinnamon buns at the shopping center.
3) Having recent straying off course
4) Walking down the chip aisle and being reminded of Doritos
5) Seeing the words "French Fries" on a menu
6) Being bored, overly tired, or upset
7) Being hungry and having the wrong sort of food around
8) Reminiscing about my childhood and eating XYZZY
Cravings happen for a huge number of reasons, in my experience. They aren't always linked to something I ate earlier in the day, unless it was something purely awful, like M&M's or popcorn. It is MUCH harder for me to ignore them if I don't plan on a way to deal with them or if I've recently caved.
In fact, this is a good reminder for me that today I may face challenges due to my recent bad behavior.