Why "Speak of the devil"?
"Speak of the devil" is the short form of the idiom "Speak of the devil and he doth appear".
The proper use of the phrase "speak of the devil" is not in the context of remembering something or one thing reminding you of something else. That kind of context is where you might say "speaking of groceries" as in your example.
The proper use of "speak of the devil" is when you are speaking about someone - usually having something bad to say or some kind of gossip when that person suddenly comes into earshot. This is appropriate insofar as "speak of the devil" is short for "speak of the devil and he will appear" as was pointed out by Jeff.
It can also be used ironically in a situation where a person joins you in mid conversation, even if this person was not the subject of the conversation. It is an often good-natured jibe on the premise that you may have been gossiping about the person or that you are comparing them to the devil.