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: Fri, 15 Dec 2017 10:53:59 -0500

On Thu, Dec 14, 2017 at 4:03 PM, Robert Weiner <address@hidden> wrote:
On Wed, Dec 13, 2017 at 7:33 PM, Robert Weiner <address@hidden> wrote:
The combination of (sit-for 0) to cause
redisplay followed by a (sleep-for <n>) solved the problem
completely​ for me.

​Well, one more problem remains here.  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 ​when the new frame is temporarily displayed (buffer1 is).
Not until after Emacs becomes idle agai
​n​
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


reply via email to

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