A want to be in a place or not be in a place, does not indicate a display of emotion. I have a corn snake that always wants to stay out of his enclosure. I think it might be the act of placing him down into an enclosed space is frightening to him so he tries to stay on my hand. Does this means he has a preference to stay with me. No! This snake does not tolerate handling at all.

Snakes having a preference for where they are or where they want to go is usually, again, based on instinct. The need to be in a place that feels secure and warm. He was probably roaming all over the keyboard because he was stressed out.