detained before Yahweh
"for some work before Yahweh" or "because Yahweh had detained him there"
Doeg ... shepherds
"Doeg ... herdsmen, and he saw what Ahimelech did". You may need to say clearly that Doeg saw what David did.
Doeg the Edomite
This is the name of a man from the land of Edom.