The key for me is simple, have the proper foods on hand at all times. When it's not readily available, that is when people get sloppy and start eating shit. If you fridge and freezer are packed with the foods you're supposed to eat, you'll eat them. If it's not, you'll jump in your car, or reach for some crap you shouldn't.
Another reason maintaining calorie intake is challenging in this, is because the foods we eat get boring and many of us stick to the same foods, day after day and when food gets boring, you start eating less of it. You have to get creative. I was a chef in my early 20's so for me, it's easy. I know how to buy food, keep it stalked and keep it interesting.