King David was a prolific poet and songwriter, and some of his work has been passed down to us through the psalms. Many of these have no event recorded with them, so at the end of David’s life, we have a large group of ‘unallocated’ psalms.
Psalm 139 was written by someone who knew there was nothing God didn’t know about him. With the only enemies being God’s enemies(rather than people trying to kill or depose David), there’s a view that David wrote it while he was still a young, idealistic shepherd (before he gained enemies of his own), or when he was very old and had not only secured his throne from enemies and rebellious children/people, but had also learned from personal experience that he could “never escape” God’s spirit.
O Lord, you have examined my heart
and know everything about me.
You know when I sit down or stand up.
You know my thoughts even when I’m far away.
You see me when I travel
and when I rest at home.
You know everything I do.
You know what I am going to say
even before I say it, Lord.
You go before me and follow me.
You place your hand of blessing on my head.
Such knowledge is too wonderful for me,
too great for me to understand!
I can never escape from your Spirit!
I can never get away from your presence!
If I go up to heaven, you are there;
if I go down to the grave, you are there.
If I ride the wings of the morning,
if I dwell by the farthest oceans,
even there your hand will guide me,
and your strength will support me.
I could ask the darkness to hide me
and the light around me to become night—
but even in darkness I cannot hide from you.
To you the night shines as bright as day.
Darkness and light are the same to you.
You made all the delicate, inner parts of my body
and knit me together in my mother’s womb.
Thank you for making me so wonderfully complex!
Your workmanship is marvelous—how well I know it.
You watched me as I was being formed in utter seclusion,
as I was woven together in the dark of the womb.
You saw me before I was born.
Every day of my life was recorded in your book.
Every moment was laid out
before a single day had passed.
How precious are your thoughts about me, O God.
They cannot be numbered!
I can’t even count them;
they outnumber the grains of sand!
And when I wake up,
you are still with me!
O God, if only you would destroy the wicked!
Get out of my life, you murderers!
They blaspheme you;
your enemies misuse your name.
O Lord, shouldn’t I hate those who hate you?
Shouldn’t I despise those who oppose you?
Yes, I hate them with total hatred,
for your enemies are my enemies.
Search me, O God, and know my heart;
test me and know my anxious thoughts.
Point out anything in me that offends you,
and lead me along the path of everlasting life.