Close to panic... I agree... stop, breathe, think, act is the way to go... and most experienced divers will do this almost instinctively. Newer divers may not do so as instinctively... but there is one other element to add for newer divers... that is - Look.
Look for help. The mere action of looking for help may cure the building panic. Look up, look down, look side to side and look behind. If you see others nearby it will give you a sense of calm. In addition, if you see them, you can attempt to signal them that you are having some sort of trouble. Wave them over to you... do something to get their attention. Bang your tank, shake a rattle... do something to alert them.
My best example is that one time I was diving around a boat dock cleaning a boat. The vis was about 2 feet. There was a fishing net snagged on one of the pilings. As Murphy would say... if anything can go wrong... Well Somehow The knob of my cylinder and my first stage got tangled up in that net. When I turned to try to see what I was caught on, the fin buckle on my fin got snagged as well. I was caught at top and bottom and unable to turn around to deal with the problem. I went through the normal processes... stop, breathe, think, act... and decided my best bet was to wiggle out of my BCD, spin around and cut myself out of the mess using my trusty knife. I took the aforementioned action when it dawned on me that my buddy was still somewhere under the pier. By this time I had surfaced, riding my BCD and cutting the last bits of net off as I went. When he finally came up and I told him all the excitement he had missed, he so kindly reminded me that if I would have banged my tank, he would have come and helped. From that point on, I have added the word LOOK to the sequence I teach my students... I think it's a pretty good one.
Ken