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: Fri, 15 Dec 2017 10:53:59 -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="001a114a71660d172005606304d9" X-Trace: blaine.gmane.org 1513353322 6511 195.159.176.226 (15 Dec 2017 15:55:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 15 Dec 2017 15:55:22 +0000 (UTC) Cc: emacs-devel To: Alan Third Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 15 16:55:15 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 1ePsKN-00013t-Mm for ged-emacs-devel@m.gmane.org; Fri, 15 Dec 2017 16:55:12 +0100 Original-Received: from localhost ([::1]:47271 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePsKU-0001LW-S7 for ged-emacs-devel@m.gmane.org; Fri, 15 Dec 2017 10:55:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePsJm-0000v4-Jy for emacs-devel@gnu.org; Fri, 15 Dec 2017 10:54:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePsJi-0004rp-N2 for emacs-devel@gnu.org; Fri, 15 Dec 2017 10:54:34 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePsJi-0004rb-JM for emacs-devel@gnu.org; Fri, 15 Dec 2017 10:54:30 -0500 Original-Received: from mail-qk0-f171.google.com ([209.85.220.171]:41265) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ePsJi-0001fh-4I for emacs-devel@gnu.org; Fri, 15 Dec 2017 10:54:30 -0500 Original-Received: by mail-qk0-f171.google.com with SMTP id r184so3188939qke.8 for ; Fri, 15 Dec 2017 07:54:29 -0800 (PST) X-Gm-Message-State: AKGB3mKBhb8Lk7b8MzCeym6e0g5zIzs1KqasABy6yTn//ECulq7inxx9 aUPhELOzPD7M22wG/pLSQOKmvzmYwGB1O8LZRJg= X-Google-Smtp-Source: ACJfBov3GbL49fOngsO9VPWrGYktz2ekIVKYkFFX/pk3k9x00A68Dp6zCCwHGghI+mOCD2FSsc0kvvOhnWehRakZ72M= X-Received: by 10.55.80.8 with SMTP id e8mr21952933qkb.126.1513353269546; Fri, 15 Dec 2017 07:54:29 -0800 (PST) Original-Received: by 10.200.55.124 with HTTP; Fri, 15 Dec 2017 07:53:59 -0800 (PST) In-Reply-To: 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:221100 Archived-At: --001a114a71660d172005606304d9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Dec 14, 2017 at 4:03 PM, Robert Weiner wrote: > On Wed, Dec 13, 2017 at 7:33 PM, Robert Weiner wrote: > >> The combination of (sit-for 0) to cause >> redisplay followed by a (sleep-for ) solved the problem >> completely=E2=80=8B for me. >> > > =E2=80=8BWell, one more problem remains here. If the new frame is create= d with > its window showing buffer1 and then set-window-buffer is used to > change it to buffer2 (or even if switch-to-buffer is used), buffer2 is > not displayed =E2=80=8Bwhen the new frame is temporarily displayed (buffe= r1 is). > Not until after Emacs becomes idle agai > =E2=80=8Bn=E2=80=8B > is buffer2 displayed in this new > frame. > Although from the function doc strings, it seems a force-window-update followed by a (sit-for 0) should force redisplay of the chosen window, it did not (see the test2 function in the prior message). Is that a bug? An explicit call to redisplay with a 'force' argument does the trick, however. So the following works as expected, showing the result of the 'set-window-buffer' while temporarily displaying the new frame. (defun select-window-set-input-focus (window) "Select WINDOW, give input focus to its frame and force display of any window changes." (select-window window) (select-frame-set-input-focus (window-frame window)) ;; Force immediate redisplay of any changes to window, e.g. if its ;; buffer has changed (redisplay t)) (defun test3 () (let* ((depress-frame (selected-frame)) (depress-window (frame-selected-window depress-frame)) (release-frame (make-frame)) (release-window (frame-selected-window release-frame))) (set-window-buffer release-window "*scratch*") (select-window-set-input-focus release-window) (sleep-for 2) (select-window-set-input-focus depress-window) (sleep-for 2) (select-window-set-input-focus release-window))) (test3) ;; Bob --001a114a71660d172005606304d9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Dec 14, 2= 017 at 4:03 PM, Robert Weiner <rsw= @gnu.org> wrote:=
On Wed, Dec 13, 2017 at 7:33 PM, Robert Weiner= <rsw@gnu.org> wrote:
The combination of (sit-for 0) to cause
redisplay followed by a (sleep-for <n>) s= olved the problem
compl= etely=E2=80=8B for me.

<= /span>
=E2=80=8BWell, one mor= e problem remains here.=C2=A0 If the new frame is created with
its window showing buffer1 and then= set-window-buffer is used to
change it to buffer2 (or even if switch-to-buffer is used), buffer2 = is
not displayed =E2=80= =8Bwhen the new frame is temporarily displayed (buffer1 is).
Not until after Emacs becomes idle ag= ai
=E2=80=8Bn=E2=80=8B
is buffer2 displayed in this new
frame.

Although from the function doc strings, it seem= s a force-window-update
followed by a (sit-for 0) should force redisplay o= f the chosen window, it did
not (see the test2 function in the prior messa= ge).=C2=A0 Is that a bug?

An explicit call to redisplay with a '= force' argument does the trick,
however.=C2=A0 So the following works = as expected, showing the result of the
'set-window-buffer' while t= emporarily displaying the new frame.

(defun s= elect-window-set-input-focus (window)
=C2=A0 "Select WINDOW, give in= put focus to its frame and force display of any window changes."
=C2= =A0 (select-window window)
=C2=A0 (select-frame-set-input-focus (window-f= rame window))
=C2=A0 ;; Force immediate redisplay of any changes to windo= w, e.g. if its
=C2=A0 ;; buffer has changed
=C2=A0 (redisplay t))
(defun test3 ()
=C2=A0 (let* ((depress-frame (selected-frame))=
(depress-window (frame-selected-window= depress-frame))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(release-frame (make-f= rame))
(release-window (frame-se= lected-window release-frame)))
=C2=A0 =C2=A0 (set-window-buffer release-w= indow "*scratch*")
=C2=A0 =C2=A0 (select-window-set-input-focus= release-window)
=C2=A0 =C2=A0 (sleep-for 2)
=C2=A0 =C2=A0 (select-wind= ow-set-input-focus depress-window)
=C2=A0 =C2=A0 (sleep-for 2)
=C2=A0 = =C2=A0 (select-window-set-input-focus release-window)))

=
(test3)
=
;; Bob

--001a114a71660d172005606304d9--