I want an elisp script to highlight a region of text.

Upon exit, the highlighted selection should disappear when a key is pressed.

Everything I've tried results in the highlighting hanging on like the shift key is pressed. What does it need to make the selection transient?

(defun TEST () (interactive) (transient-mark-mode t) ;; I have this true normally anyhow (set-mark (point)) (forward-char 2) (setq mark-active t)) (global-set-key [C-S-f2] 'TEST)