aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/frameset.el
diff options
context:
space:
mode:
authorJuanma Barranquero2014-03-11 02:44:51 +0100
committerJuanma Barranquero2014-03-11 02:44:51 +0100
commitbaf8d0ac7d20afa201494540fadde8652560dbee (patch)
tree55d8ab40e826a54cae410d46fabe808f3ac5fdd7 /lisp/frameset.el
parent1ea22560004f69e5e0848234aeba413141982bb4 (diff)
downloademacs-baf8d0ac7d20afa201494540fadde8652560dbee.tar.gz
emacs-baf8d0ac7d20afa201494540fadde8652560dbee.zip
lisp/frameset.el: Let-bind frameset--target-display.
* frameset.el (frameset--target-display): Remove definition; declare. (frameset-save, frameset-restore): Let-bind frameset--target-display.
Diffstat (limited to 'lisp/frameset.el')
-rw-r--r--lisp/frameset.el43
1 files changed, 20 insertions, 23 deletions
diff --git a/lisp/frameset.el b/lisp/frameset.el
index 5cd921d5f17..ca0926ab652 100644
--- a/lisp/frameset.el
+++ b/lisp/frameset.el
@@ -417,11 +417,11 @@ Properties can be set with
417;; `frameset-filter-params' can be useful, even if you're not using 417;; `frameset-filter-params' can be useful, even if you're not using
418;; framesets. The interface of `frameset-filter-params' is generic 418;; framesets. The interface of `frameset-filter-params' is generic
419;; and does not depend of global state, with one exception: it uses 419;; and does not depend of global state, with one exception: it uses
420;; the internal variable `frameset--target-display' to decide if, and 420;; the dynamically bound variable `frameset--target-display' to decide
421;; how, to modify the `display' parameter of FILTERED. But that 421;; if, and how, to modify the `display' parameter of FILTERED. That
422;; should not represent any problem, because it's only meaningful 422;; should not represent a problem, because it's only meaningful when
423;; when restoring, and customized uses of `frameset-filter-params' 423;; restoring, and customized uses of `frameset-filter-params' are
424;; are likely to use their own filter alist and just call 424;; likely to use their own filter alist and just call
425;; 425;;
426;; (setq my-filtered (frameset-filter-params my-params my-filters t)) 426;; (setq my-filtered (frameset-filter-params my-params my-filters t))
427;; 427;;
@@ -522,13 +522,13 @@ It must return:
522Frame parameters not on this alist are passed intact, as if they were 522Frame parameters not on this alist are passed intact, as if they were
523defined with ACTION = nil.") 523defined with ACTION = nil.")
524 524
525(defvar frameset--target-display nil 525;; Dynamically bound in `frameset-save', `frameset-restore'.
526 ;; Either (minibuffer . VALUE) or nil. 526(defvar frameset--target-display)
527 ;; This refers to the current frame config being processed inside 527;; Either (display . VALUE) or nil.
528 ;; `frameset-restore' and its auxiliary functions (like filtering). 528;; This refers to the current frame config being processed with
529 ;; If nil, there is no need to change the display. 529;; `frameset-filter-params' and its auxiliary filtering functions.
530 ;; If non-nil, display parameter to use when creating the frame. 530;; If nil, there is no need to change the display.
531 "Internal use only.") 531;; If non-nil, display parameter to use when creating the frame.
532 532
533(defun frameset-switch-to-gui-p (parameters) 533(defun frameset-switch-to-gui-p (parameters)
534 "True when switching to a graphic display. 534 "True when switching to a graphic display.
@@ -760,6 +760,7 @@ PREDICATE is a predicate function, which must return non-nil for frames that
760should be saved; if PREDICATE is nil, all frames from FRAME-LIST are saved. 760should be saved; if PREDICATE is nil, all frames from FRAME-LIST are saved.
761PROPERTIES is a user-defined property list to add to the frameset." 761PROPERTIES is a user-defined property list to add to the frameset."
762 (let* ((list (or (copy-sequence frame-list) (frame-list))) 762 (let* ((list (or (copy-sequence frame-list) (frame-list)))
763 (frameset--target-display nil)
763 (frames (cl-delete-if-not #'frame-live-p 764 (frames (cl-delete-if-not #'frame-live-p
764 (if predicate 765 (if predicate
765 (cl-delete-if-not predicate list) 766 (cl-delete-if-not predicate list)
@@ -1141,16 +1142,15 @@ All keyword parameters default to nil."
1141 (force-display (if (functionp force-display) 1142 (force-display (if (functionp force-display)
1142 (funcall force-display frame-cfg window-cfg) 1143 (funcall force-display frame-cfg window-cfg)
1143 force-display)) 1144 force-display))
1145 (frameset--target-display nil)
1144 frame to-tty duplicate) 1146 frame to-tty duplicate)
1145 ;; Only set target if forcing displays and the target display is different. 1147 ;; Only set target if forcing displays and the target display is different.
1146 (cond ((frameset-keep-original-display-p force-display) 1148 (unless (or (frameset-keep-original-display-p force-display)
1147 (setq frameset--target-display nil)) 1149 (eq (frame-parameter nil 'display)
1148 ((eq (frame-parameter nil 'display) (cdr (assq 'display frame-cfg))) 1150 (cdr (assq 'display frame-cfg))))
1149 (setq frameset--target-display nil)) 1151 (setq frameset--target-display (cons 'display
1150 (t 1152 (frame-parameter nil 'display))
1151 (setq frameset--target-display (cons 'display 1153 to-tty (null (cdr frameset--target-display))))
1152 (frame-parameter nil 'display))
1153 to-tty (null (cdr frameset--target-display)))))
1154 ;; Time to restore frames and set up their minibuffers as they were. 1154 ;; Time to restore frames and set up their minibuffers as they were.
1155 ;; We only skip a frame (thus deleting it) if either: 1155 ;; We only skip a frame (thus deleting it) if either:
1156 ;; - we're switching displays, and the user chose the option to delete, or 1156 ;; - we're switching displays, and the user chose the option to delete, or
@@ -1210,9 +1210,6 @@ All keyword parameters default to nil."
1210 ;; other frames are already visible (discussed in thread for bug#14841). 1210 ;; other frames are already visible (discussed in thread for bug#14841).
1211 (sit-for 0 t) 1211 (sit-for 0 t)
1212 1212
1213 ;; Clean temporary caches
1214 (setq frameset--target-display nil)
1215
1216 ;; Clean up the frame list 1213 ;; Clean up the frame list
1217 (when cleanup-frames 1214 (when cleanup-frames
1218 (let ((map nil) 1215 (let ((map nil)