I have not been able to get the minibuffer-exit-hook
to play nice with read-string
. As far as I can tell, I should no longer be in the minibuffer after finishing up with read-string
. However, the condition (minibufferp)
says I'm still in the minibuffer even though read-string
finished. read-string
is written in C, so I can't add the hook there (i.e., at the tail end of the read-string
function).
"Documentation [minibuffer-exit-hook]: Normal hook run just after exit from minibuffer.
[After thinking a little more about this, I'm pretty sure it's a bug -- so I filed a bug report: bug#16524. As I learn more, I'll update this thread.
(defun test ()
(interactive)
(read-string "Prompt: " "testing"))
(add-hook 'minibuffer-exit-hook (lambda ()
(cond
((minibufferp)
(message "Focus is still in the minibuffer: %s" (buffer-name)))
(t (message "Contragulations -- focus is now in: %s." (buffer-name))))))