From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Weiner Newsgroups: gmane.emacs.devel Subject: Re: select-frame-set-input-focus fails to raise the frame Date: Wed, 13 Dec 2017 19:33:00 -0500 Message-ID: References: <20171213204737.GA1621@breton.holly.idiocy.org> <20171213222634.GA2144@breton.holly.idiocy.org> Reply-To: rswgnu@gmail.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114a7166862852056042081a" X-Trace: blaine.gmane.org 1513211623 23672 195.159.176.226 (14 Dec 2017 00:33:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 14 Dec 2017 00:33:43 +0000 (UTC) Cc: emacs-devel To: Alan Third Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 14 01:33:38 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePHSx-0005nJ-QR for ged-emacs-devel@m.gmane.org; Thu, 14 Dec 2017 01:33:36 +0100 Original-Received: from localhost ([::1]:38510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePHT4-0006Bx-HR for ged-emacs-devel@m.gmane.org; Wed, 13 Dec 2017 19:33:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePHSx-0006Bg-3p for emacs-devel@gnu.org; Wed, 13 Dec 2017 19:33:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePHSt-0005OM-ON for emacs-devel@gnu.org; Wed, 13 Dec 2017 19:33:35 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:46732) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePHSt-0005OF-Ki for emacs-devel@gnu.org; Wed, 13 Dec 2017 19:33:31 -0500 Original-Received: from mail-qk0-f175.google.com ([209.85.220.175]:34540) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ePHSt-0008Bz-4v for emacs-devel@gnu.org; Wed, 13 Dec 2017 19:33:31 -0500 Original-Received: by mail-qk0-f175.google.com with SMTP id d66so4319368qkg.1 for ; Wed, 13 Dec 2017 16:33:31 -0800 (PST) X-Gm-Message-State: AKGB3mJKKoAmHHihy2kywsPcchRJ2AMchc5K+WcrhC5IDiErUzDYTZiD SxzKnDzPCD3W7tPTJhsXas3WVAJAmFMVJMFCtzQ= X-Google-Smtp-Source: ACJfBospRMIAN9KEBq8gs6PjjUQbT15pYBKwkmiGTCso1nB/Y/J06nZedo2/Tw8W/13mZgtaEEgLW5bkzxc8b85Pu1U= X-Received: by 10.55.80.8 with SMTP id e8mr13573072qkb.126.1513211610669; Wed, 13 Dec 2017 16:33:30 -0800 (PST) Original-Received: by 10.200.55.124 with HTTP; Wed, 13 Dec 2017 16:33:00 -0800 (PST) In-Reply-To: <20171213222634.GA2144@breton.holly.idiocy.org> X-Gmail-Original-Message-ID: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221037 Archived-At: --001a114a7166862852056042081a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Dec 13, 2017 at 5:26 PM, Alan Third wrote: > > FWIW, changing sit-for to sleep-for in =E2=80=98test=E2=80=99 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=E2=80=90effect of the way input works on the NS p= ort > where various things that you might not think of as =E2=80=98input=E2=80= =99 are > essentially indistinguishable from keyboard input.) > =E2=80=8BGreat explanations. The combination of (sit-for 0) to cause redisplay followed by a (sleep-for ) solved the problem completely=E2=80=8B 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 =E2=80=8B --001a114a7166862852056042081a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Dec 13, 2= 017 at 5:26 PM, Alan Third <al= an@idiocy.org> w= rote:

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

=C2=A0 =C2=A0 (defun test ()
=C2=A0 =C2=A0 =C2=A0 (let ((depress-frame (selected-frame))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (release-frame (make-frame)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (select-frame-set-input-focus depress-frame)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (sit-for 0)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (sit-for 4)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (select-frame-set-input-focus release-frame)))<= br>
=C2=A0 =C2=A0 (test)

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

(I think this is a side=E2=80=90effect of the way input works on the NS por= t
where various things that you might not think of as =E2=80=98input=E2=80=99= are
essentially indistinguishable from keyboard input.)
=E2=80=8BGreat explanations.=C2=A0 The combination of (sit-for 0) to ca= use
redisplay followed by a (sleep-for <n>) solved the problem
=
comp= letely=E2=80=8B for me.=C2=A0 As you noted, sit-for can return prematurely<= /div>
and seems to in the context in which I am using it, whereas
sleep-for wai= ts the given seconds as desired.

This seems to indicate there is a n= eed to simplify the process for
temporarily showing a frame at the top of = the stack.=C2=A0 The use case
I have right now is putting a particular buf= fer into a newly created
frame but having the previously selected frame re= main the topmost
frame with input focus after the operation completes.=C2= =A0 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.

<= div class=3D"gmail_default" style=3D"font-family:monospace,monospace">Bob
= =E2=80=8B
--001a114a7166862852056042081a--