Commit baf8d0ac authored by Juanma Barranquero's avatar Juanma Barranquero
Browse files

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.
parent 1ea22560
2014-03-11 Juanma Barranquero <lekktu@gmail.com>
* frameset.el (frameset--target-display): Remove definition; declare.
(frameset-save, frameset-restore): Let-bind frameset--target-display.
2014-03-11 Stefan Monnier <monnier@iro.umontreal.ca> 2014-03-11 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/nadvice.el (advice--make-1): Fix autoloading avoidance. * emacs-lisp/nadvice.el (advice--make-1): Fix autoloading avoidance.
......
...@@ -417,11 +417,11 @@ Properties can be set with ...@@ -417,11 +417,11 @@ Properties can be set with
;; `frameset-filter-params' can be useful, even if you're not using ;; `frameset-filter-params' can be useful, even if you're not using
;; framesets. The interface of `frameset-filter-params' is generic ;; framesets. The interface of `frameset-filter-params' is generic
;; and does not depend of global state, with one exception: it uses ;; and does not depend of global state, with one exception: it uses
;; the internal variable `frameset--target-display' to decide if, and ;; the dynamically bound variable `frameset--target-display' to decide
;; how, to modify the `display' parameter of FILTERED. But that ;; if, and how, to modify the `display' parameter of FILTERED. That
;; should not represent any problem, because it's only meaningful ;; should not represent a problem, because it's only meaningful when
;; when restoring, and customized uses of `frameset-filter-params' ;; restoring, and customized uses of `frameset-filter-params' are
;; are likely to use their own filter alist and just call ;; likely to use their own filter alist and just call
;; ;;
;; (setq my-filtered (frameset-filter-params my-params my-filters t)) ;; (setq my-filtered (frameset-filter-params my-params my-filters t))
;; ;;
...@@ -522,13 +522,13 @@ It must return: ...@@ -522,13 +522,13 @@ It must return:
Frame parameters not on this alist are passed intact, as if they were Frame parameters not on this alist are passed intact, as if they were
defined with ACTION = nil.") defined with ACTION = nil.")
(defvar frameset--target-display nil ;; Dynamically bound in `frameset-save', `frameset-restore'.
;; Either (minibuffer . VALUE) or nil. (defvar frameset--target-display)
;; This refers to the current frame config being processed inside ;; Either (display . VALUE) or nil.
;; `frameset-restore' and its auxiliary functions (like filtering). ;; This refers to the current frame config being processed with
;; If nil, there is no need to change the display. ;; `frameset-filter-params' and its auxiliary filtering functions.
;; If non-nil, display parameter to use when creating the frame. ;; If nil, there is no need to change the display.
"Internal use only.") ;; If non-nil, display parameter to use when creating the frame.
(defun frameset-switch-to-gui-p (parameters) (defun frameset-switch-to-gui-p (parameters)
"True when switching to a graphic display. "True when switching to a graphic display.
...@@ -760,6 +760,7 @@ PREDICATE is a predicate function, which must return non-nil for frames that ...@@ -760,6 +760,7 @@ PREDICATE is a predicate function, which must return non-nil for frames that
should be saved; if PREDICATE is nil, all frames from FRAME-LIST are saved. should be saved; if PREDICATE is nil, all frames from FRAME-LIST are saved.
PROPERTIES is a user-defined property list to add to the frameset." PROPERTIES is a user-defined property list to add to the frameset."
(let* ((list (or (copy-sequence frame-list) (frame-list))) (let* ((list (or (copy-sequence frame-list) (frame-list)))
(frameset--target-display nil)
(frames (cl-delete-if-not #'frame-live-p (frames (cl-delete-if-not #'frame-live-p
(if predicate (if predicate
(cl-delete-if-not predicate list) (cl-delete-if-not predicate list)
...@@ -1141,16 +1142,15 @@ All keyword parameters default to nil." ...@@ -1141,16 +1142,15 @@ All keyword parameters default to nil."
(force-display (if (functionp force-display) (force-display (if (functionp force-display)
(funcall force-display frame-cfg window-cfg) (funcall force-display frame-cfg window-cfg)
force-display)) force-display))
(frameset--target-display nil)
frame to-tty duplicate) frame to-tty duplicate)
;; Only set target if forcing displays and the target display is different. ;; Only set target if forcing displays and the target display is different.
(cond ((frameset-keep-original-display-p force-display) (unless (or (frameset-keep-original-display-p force-display)
(setq frameset--target-display nil)) (eq (frame-parameter nil 'display)
((eq (frame-parameter nil 'display) (cdr (assq 'display frame-cfg))) (cdr (assq 'display frame-cfg))))
(setq frameset--target-display nil)) (setq frameset--target-display (cons 'display
(t (frame-parameter nil 'display))
(setq frameset--target-display (cons 'display to-tty (null (cdr frameset--target-display))))
(frame-parameter nil 'display))
to-tty (null (cdr frameset--target-display)))))
;; Time to restore frames and set up their minibuffers as they were. ;; Time to restore frames and set up their minibuffers as they were.
;; We only skip a frame (thus deleting it) if either: ;; We only skip a frame (thus deleting it) if either:
;; - we're switching displays, and the user chose the option to delete, or ;; - we're switching displays, and the user chose the option to delete, or
...@@ -1210,9 +1210,6 @@ All keyword parameters default to nil." ...@@ -1210,9 +1210,6 @@ All keyword parameters default to nil."
;; other frames are already visible (discussed in thread for bug#14841). ;; other frames are already visible (discussed in thread for bug#14841).
(sit-for 0 t) (sit-for 0 t)
;; Clean temporary caches
(setq frameset--target-display nil)
;; Clean up the frame list ;; Clean up the frame list
(when cleanup-frames (when cleanup-frames
(let ((map nil) (let ((map nil)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment