Subject: Re: 23.0.60; list-processes - please reset focus to original frame when done

From: martin rudalics <[email-masked]>
Date: Sun, 04 Jan 2009 20:35:22 +0100

> Please change `list-processes' so that it calls
 > `select-frame-set-input-focus' at the end to move focus back to the
 > frame that previously had the focus.
 >
 > This is a general problem. Perhaps a general fix could be found.
 >
 > It is at least a problem for functions that might display a buffer for
 > the first time, and especially those that then ask for user input
 > (e.g. `yes-or-no-p'). `list-processes' is a poster child for this kind
 > of function, and it has the added annoyance of being called
 > automatically by `C-x C-c'.

We might be able to make such behavior customizable for the case where
Emacs asks for user input.  Meanwhile you could try using a workaround
like

(defvar my-selected-frame nil)

(add-hook 'temp-buffer-setup-hook
	  (lambda ()
	    (setq my-selected-frame (selected-frame))))

(add-hook 'post-command-hook
	  (lambda ()
	    (when my-selected-frame
	      (select-frame-set-input-focus my-selected-frame)
	      (setq my-selected-frame nil))))

martin