From: Juanma Barranquero Date: Wed, 19 Feb 2014 21:04:06 +0000 (+0100) Subject: lisp/frameset.el (frameset-restore): Remove duplicate ids only when needed. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~11 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=94e5e202d952ac74c6540ed41b1bac957855c5fa;p=emacs.git lisp/frameset.el (frameset-restore): Remove duplicate ids only when needed. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 733c83f467c..94a194bbd99 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-02-19 Juanma Barranquero + + * frameset.el (frameset-restore): Delay removing an old frame's + duplicate id until the new frame has been correctly created. + 2014-02-19 Michael Albinus * net/tramp.el (tramp-handle-make-symbolic-link): New defun. diff --git a/lisp/frameset.el b/lisp/frameset.el index 977cc8433d4..f0d38d911f3 100644 --- a/lisp/frameset.el +++ b/lisp/frameset.el @@ -1116,7 +1116,7 @@ All keyword parameters default to nil." (force-display (if (functionp force-display) (funcall force-display frame-cfg window-cfg) force-display)) - frame to-tty) + frame to-tty duplicate) ;; Only set target if forcing displays and the target display is different. (cond ((frameset-keep-original-display-p force-display) (setq frameset--target-display nil)) @@ -1134,16 +1134,14 @@ All keyword parameters default to nil." (or (eq force-display :delete) (and to-tty (eq (cdr (assq 'minibuffer frame-cfg)) 'only)))) - ;; If keeping non-reusable frames, and the frameset--id of one of them - ;; matches the id of a frame being restored (because, for example, the - ;; frameset has already been read in the same session), remove the - ;; frameset--id from the non-reusable frame, which is not useful anymore. - (when (and other-frames - (or (eq reuse-frames :keep) (consp reuse-frames))) - (let ((dup (frameset-frame-with-id (frameset-cfg-id frame-cfg) - other-frames))) - (when dup - (set-frame-parameter dup 'frameset--id nil)))) + ;; To avoid duplicating frame ids after restoration, we note any + ;; existing frame whose id matches a frame configuration in the + ;; frameset. Once the frame config is properly restored, we can + ;; reset the old frame's id to nil. + (setq duplicate (and other-frames + (or (eq reuse-frames :keep) (consp reuse-frames)) + (frameset-frame-with-id (frameset-cfg-id frame-cfg) + other-frames))) ;; Restore minibuffers. Some of this stuff could be done in a filter ;; function, but it would be messy because restoring minibuffers affects ;; global state; it's best to do it here than add a bunch of global @@ -1177,6 +1175,9 @@ All keyword parameters default to nil." (setq frame (frameset--restore-frame frame-cfg window-cfg (or filters frameset-filter-alist) force-onscreen)) + ;; Now reset any duplicate frameset--id + (when (and duplicate (not (eq frame duplicate))) + (set-frame-parameter duplicate 'frameset--id nil)) ;; Set default-minibuffer if required. (when default (setq default-minibuffer-frame frame)))) (error