aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2013-08-08 17:59:14 +0200
committerJuanma Barranquero2013-08-08 17:59:14 +0200
commitc03c02eea4978cd6d11bc605aa988b99756b5a51 (patch)
treedda6b899e8664102ae813dfcedc644d3db70e18b
parent656202640dc8857da0373ba690ea193394352ddb (diff)
downloademacs-c03c02eea4978cd6d11bc605aa988b99756b5a51.tar.gz
emacs-c03c02eea4978cd6d11bc605aa988b99756b5a51.zip
lisp/frameset.el (frameset-save): Check validity of the resulting frameset.
(frameset-valid-p): Doc fix.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/frameset.el46
2 files changed, 32 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6ab96b11327..4a2712fdd21 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12013-08-08 Juanma Barranquero <lekktu@gmail.com>
2
3 * frameset.el (frameset-valid-p): Doc fix.
4 (frameset-save): Check validity of the resulting frameset.
5
12013-08-08 Xue Fuqiao <xfq.free@gmail.com> 62013-08-08 Xue Fuqiao <xfq.free@gmail.com>
2 7
3 * ido.el (ido-record-command): Add doc string. 8 * ido.el (ido-record-command): Add doc string.
diff --git a/lisp/frameset.el b/lisp/frameset.el
index c3fdfa52886..b1ad9f7702a 100644
--- a/lisp/frameset.el
+++ b/lisp/frameset.el
@@ -136,8 +136,12 @@ FRAMESET is copied with `copy-tree'."
136 136
137;;;###autoload 137;;;###autoload
138(defun frameset-valid-p (object) 138(defun frameset-valid-p (object)
139 "Return non-nil if OBJECT is a valid frameset, nil otherwise." 139 "Return non-nil if OBJECT is a valid frameset, nil otherwise.
140
141The return value is nil if OBJECT is not a frameset, or not
142a valid one, and the frameset version if it is valid."
140 (and (vectorp object) ; a vector 143 (and (vectorp object) ; a vector
144 (>= (length object) 8) ; of the right length (future-proof)
141 (eq (aref object 0) 'frameset) ; tagged as `frameset' 145 (eq (aref object 0) 'frameset) ; tagged as `frameset'
142 (integerp (aref object 1)) ; VERSION is an int 146 (integerp (aref object 1)) ; VERSION is an int
143 (consp (aref object 2)) ; TIMESTAMP is a non-null list 147 (consp (aref object 2)) ; TIMESTAMP is a non-null list
@@ -307,7 +311,7 @@ Properties can be set with
307;; the roundtrip though tty-land. The answer is to add "stashing 311;; the roundtrip though tty-land. The answer is to add "stashing
308;; parameters", working in pairs, to shelve the GUI-specific contents and 312;; parameters", working in pairs, to shelve the GUI-specific contents and
309;; restore it once we're back in pixel country. That's what functions 313;; restore it once we're back in pixel country. That's what functions
310;; `frameset-filter-shelve-param' and `frameset-unshelve-param' do. 314;; `frameset-filter-shelve-param' and `frameset-filter-unshelve-param' do.
311;; 315;;
312;; Basically, if you set `frameset-filter-shelve-param' as the filter for 316;; Basically, if you set `frameset-filter-shelve-param' as the filter for
313;; a parameter P, it will detect when it is restoring a GUI frame into a 317;; a parameter P, it will detect when it is restoring a GUI frame into a
@@ -346,8 +350,8 @@ Properties can be set with
346;; URL). So the probability of a collision with existing or future 350;; URL). So the probability of a collision with existing or future
347;; symbols is quite insignificant. 351;; symbols is quite insignificant.
348;; 352;;
349;; Now, what about the filter alists? There are three of them, though 353;; Now, what about the filter alist variables? There are three of them,
350;; only two sets of parameters: 354;; though only two sets of parameters:
351;; 355;;
352;; - `frameset-session-filter-alist' contains these filters that allow to 356;; - `frameset-session-filter-alist' contains these filters that allow to
353;; save and restore framesets in-session, without the need to serialize 357;; save and restore framesets in-session, without the need to serialize
@@ -361,7 +365,7 @@ Properties can be set with
361;; disk without loss of information. That's the format used by the 365;; disk without loss of information. That's the format used by the
362;; desktop.el package, for example. 366;; desktop.el package, for example.
363;; 367;;
364;; IMPORTANT: These variables share structure and should never be modified. 368;; IMPORTANT: These variables share structure and should NEVER be modified.
365;; 369;;
366;; - `frameset-filter-alist': The value of this variable is the default 370;; - `frameset-filter-alist': The value of this variable is the default
367;; value for the FILTERS arguments of `frameset-save' and 371;; value for the FILTERS arguments of `frameset-save' and
@@ -745,21 +749,25 @@ PROPERTIES is a user-defined property list to add to the frameset."
745 (frames (cl-delete-if-not #'frame-live-p 749 (frames (cl-delete-if-not #'frame-live-p
746 (if predicate 750 (if predicate
747 (cl-delete-if-not predicate list) 751 (cl-delete-if-not predicate list)
748 list)))) 752 list)))
753 fs)
749 (frameset--record-minibuffer-relationships frames) 754 (frameset--record-minibuffer-relationships frames)
750 (make-frameset :app app 755 (setq fs (make-frameset
751 :name name 756 :app app
752 :description description 757 :name name
753 :properties properties 758 :description description
754 :states (mapcar 759 :properties properties
755 (lambda (frame) 760 :states (mapcar
756 (cons 761 (lambda (frame)
757 (frameset-filter-params (frame-parameters frame) 762 (cons
758 (or filters 763 (frameset-filter-params (frame-parameters frame)
759 frameset-filter-alist) 764 (or filters
760 t) 765 frameset-filter-alist)
761 (window-state-get (frame-root-window frame) t))) 766 t)
762 frames)))) 767 (window-state-get (frame-root-window frame) t)))
768 frames)))
769 (cl-assert (frameset-valid-p fs))
770 fs))
763 771
764 772
765;; Restoring framesets 773;; Restoring framesets