emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: select-frame-set-input-focus fails to raise the frame


From: Robert Weiner
Subject: Re: select-frame-set-input-focus fails to raise the frame
Date: Wed, 13 Dec 2017 19:33:00 -0500

On Wed, Dec 13, 2017 at 5:26 PM, Alan Third <address@hidden> wrote:

FWIW, changing sit-for to sleep-for in ‘test’ results in 4 seconds of
a blank frame, but otherwise behaves as expected. This seems to work,
though:

    (defun test ()
      (let ((depress-frame (selected-frame))
            (release-frame (make-frame)))
        (select-frame-set-input-focus depress-frame)
        (sit-for 0)
        (sit-for 4)
        (select-frame-set-input-focus release-frame)))

    (test)

Presumably the first sit-for clears any pending input which then means
the second sit-for can actually do its thing.

(I think this is a side‐effect of the way input works on the NS port
where various things that you might not think of as ‘input’ are
essentially indistinguishable from keyboard input.)

​Great explanations.  The combination of (sit-for 0) to cause
redisplay followed by a (sleep-for <n>) solved the problem
completely​ for me.  As you noted, sit-for can return prematurely
and seems to in the context in which I am using it, whereas
sleep-for waits the given seconds as desired.

This seems to indicate there is a need to simplify the process for
temporarily showing a frame at the top of the stack.  The use case
I have right now is putting a particular buffer into a newly created
frame but having the previously selected frame remain the topmost
frame with input focus after the operation completes.  To show that
the buffer has been put into the frame, I want to show it temporarily
and then move it beneath the original top frame.

Bob

reply via email to

[Prev in Thread] Current Thread [Next in Thread]