emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113761: lisp/frameset.el (frameset-save): Check val


From: Juanma Barranquero
Subject: [Emacs-diffs] trunk r113761: lisp/frameset.el (frameset-save): Check validity of the resulting frameset.
Date: Thu, 08 Aug 2013 15:59:28 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113761
revision-id: address@hidden
parent: address@hidden
committer: Juanma Barranquero <address@hidden>
branch nick: trunk
timestamp: Thu 2013-08-08 17:59:14 +0200
message:
  lisp/frameset.el (frameset-save): Check validity of the resulting frameset.
  (frameset-valid-p): Doc fix.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/frameset.el               frameset.el-20130802043218-tfwraxv1c2zlibpw-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-08-08 14:03:56 +0000
+++ b/lisp/ChangeLog    2013-08-08 15:59:14 +0000
@@ -1,3 +1,8 @@
+2013-08-08  Juanma Barranquero  <address@hidden>
+
+       * frameset.el (frameset-valid-p): Doc fix.
+       (frameset-save): Check validity of the resulting frameset.
+
 2013-08-08  Xue Fuqiao  <address@hidden>
 
        * ido.el (ido-record-command): Add doc string.

=== modified file 'lisp/frameset.el'
--- a/lisp/frameset.el  2013-08-08 10:44:07 +0000
+++ b/lisp/frameset.el  2013-08-08 15:59:14 +0000
@@ -136,8 +136,12 @@
 
 ;;;###autoload
 (defun frameset-valid-p (object)
-  "Return non-nil if OBJECT is a valid frameset, nil otherwise."
+  "Return non-nil if OBJECT is a valid frameset, nil otherwise.
+
+The return value is nil if OBJECT is not a frameset, or not
+a valid one, and the frameset version if it is valid."
   (and (vectorp object)                   ; a vector
+       (>= (length object) 8)             ; of the right length (future-proof)
        (eq (aref object 0) 'frameset)     ; tagged as `frameset'
        (integerp (aref object 1))         ; VERSION is an int
        (consp (aref object 2))            ; TIMESTAMP is a non-null list
@@ -307,7 +311,7 @@
 ;; the roundtrip though tty-land.  The answer is to add "stashing
 ;; parameters", working in pairs, to shelve the GUI-specific contents and
 ;; restore it once we're back in pixel country.  That's what functions
-;; `frameset-filter-shelve-param' and `frameset-unshelve-param' do.
+;; `frameset-filter-shelve-param' and `frameset-filter-unshelve-param' do.
 ;;
 ;; Basically, if you set `frameset-filter-shelve-param' as the filter for
 ;; a parameter P, it will detect when it is restoring a GUI frame into a
@@ -346,8 +350,8 @@
 ;; URL).  So the probability of a collision with existing or future
 ;; symbols is quite insignificant.
 ;;
-;; Now, what about the filter alists? There are three of them, though
-;; only two sets of parameters:
+;; Now, what about the filter alist variables? There are three of them,
+;; though only two sets of parameters:
 ;;
 ;; - `frameset-session-filter-alist' contains these filters that allow to
 ;;   save and restore framesets in-session, without the need to serialize
@@ -361,7 +365,7 @@
 ;;   disk without loss of information.  That's the format used by the
 ;;   desktop.el package, for example.
 ;;
-;; IMPORTANT: These variables share structure and should never be modified.
+;; IMPORTANT: These variables share structure and should NEVER be modified.
 ;;
 ;; - `frameset-filter-alist': The value of this variable is the default
 ;;   value for the FILTERS arguments of `frameset-save' and
@@ -745,21 +749,25 @@
         (frames (cl-delete-if-not #'frame-live-p
                                   (if predicate
                                       (cl-delete-if-not predicate list)
-                                    list))))
+                                    list)))
+        fs)
     (frameset--record-minibuffer-relationships frames)
-    (make-frameset :app app
-                  :name name
-                  :description description
-                  :properties properties
-                  :states (mapcar
-                           (lambda (frame)
-                             (cons
-                              (frameset-filter-params (frame-parameters frame)
-                                                      (or filters
-                                                          
frameset-filter-alist)
-                                                      t)
-                              (window-state-get (frame-root-window frame) t)))
-                           frames))))
+    (setq fs (make-frameset
+             :app app
+             :name name
+             :description description
+             :properties properties
+             :states (mapcar
+                      (lambda (frame)
+                        (cons
+                         (frameset-filter-params (frame-parameters frame)
+                                                 (or filters
+                                                     frameset-filter-alist)
+                                                 t)
+                         (window-state-get (frame-root-window frame) t)))
+                      frames)))
+    (cl-assert (frameset-valid-p fs))
+    fs))
 
 
 ;; Restoring framesets


reply via email to

[Prev in Thread] Current Thread [Next in Thread]