]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/frameset.el (frameset-restore): Make sure last-focus frame has focus.
authorJuri Linkov <juri@linkov.net>
Sat, 17 Aug 2019 22:40:32 +0000 (01:40 +0300)
committerJuri Linkov <juri@linkov.net>
Sat, 17 Aug 2019 22:40:32 +0000 (01:40 +0300)
Call select-frame-set-input-focus to restore focus on the frame
that had last-focus-update frame parameter before saving frameset.
(Bug#36894)

lisp/frameset.el

index 60b6fe38ad947acb746ac409aadfe2938dafd35f..9a7a75f5efc8fad857e12fada7d1427ccc61269a 100644 (file)
@@ -1346,6 +1346,16 @@ All keyword parameters default to nil."
            (error
             (delay-warning 'frameset (error-message-string err) :warning))))))
 
+    ;; Make sure the frame with last-focus-update has focus.
+    (let ((last-focus-frame
+           (catch 'last-focus
+             (maphash (lambda (frame _)
+                        (when (frame-parameter frame 'last-focus-update)
+                          (throw 'last-focus frame)))
+                      frameset--action-map))))
+      (when last-focus-frame
+        (select-frame-set-input-focus last-focus-frame)))
+
     ;; Make sure there's at least one visible frame.
     (unless (or (daemonp)
                (catch 'visible