So you just realised:
You are the emotional eater. Whatever bad emotion you feel, you eat
and that makes you feel better and thus you associate food as a
replacement to you dealing with your emotions. Its a vicious
cycle.
Your mind has come to associate food with good feelings, nice
things, friends and such. So this is going to be a mind
reprogramming for you.
One of the things to do is to disassociate food with good feelings
but just something to fill you up for energy. You got to eat well
and with healthy choices. When you feel sad mildly... do not reach
for food. ... go take a walk, or do something nice like facial or
fill your hands with some activity ... this helps keep your mind
away from food.
Its hard work... BTW, you ever hear of food as an addiction...
because of the good feelings it makes people feel.. so people get
addicted... you will experience mild miserable feelings when you
try to quit...