Subject: Re: bug#17589: 24.3.91; lisp/frameset.el

From: Juanma Barranquero <[email-masked]>
Date: Wed, 28 May 2014 00:34:49 +0200

On Tue, May 27, 2014 at 7:14 PM, martin rudalics <[email-masked]> wrote:

> Probably `frameset-save' could use a WRITABLE argument too (passing it
> on to `window-state-get') and `frameset-to-register' would call
> `frameset-save' with WRITABLE nil.

Yep, that's the only way I see to solve this. That, or some horrible
hack in frameset-to-register which I don't even want to start thinking
about.

Arash, could you please try with Martin's proposed change to window.el
plus the attached patch to frameset.el?

TIA,

    J
=== modified file 'lisp/frameset.el'
--- lisp/frameset.el	2014-03-27 01:01:36 +0000
+++ lisp/frameset.el	2014-05-27 22:31:49 +0000
@@ -748,7 +748,8 @@
 ;;;###autoload
 (cl-defun frameset-save (frame-list
 			 &key app name description
-			      filters predicate properties)
+			      filters predicate properties
+			      in-session)
   "Return a frameset for FRAME-LIST, a list of frames.
 Dead frames and non-frame objects are silently removed from the list.
 If nil, FRAME-LIST defaults to the output of `frame-list' (all live frames).
@@ -758,13 +759,16 @@
 `frameset-filter-alist' is used instead.
 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.
-PROPERTIES is a user-defined property list to add to the frameset."
+PROPERTIES is a user-defined property list to add to the frameset.
+IN-SESSION, if non-nil, means that the resulting frameset is meant to be
+used in the current Emacs session and not serialized to an external store."
   (let* ((list (or (copy-sequence frame-list) (frame-list)))
 	 (frameset--target-display nil)
 	 (frames (cl-delete-if-not #'frame-live-p
 				   (if predicate
 				       (cl-delete-if-not predicate list)
 				     list)))
+	 (writable (not in-session))
 	 fs)
     (frameset--record-minibuffer-relationships frames)
     (setq fs (frameset--make
@@ -779,7 +783,7 @@
 						  (or filters
 						      frameset-filter-alist)
 						  t)
-			  (window-state-get (frame-root-window frame) t)))
+			  (window-state-get (frame-root-window frame) writable)))
 		       frames)))
     (cl-assert (frameset-valid-p fs))
     fs))
@@ -1277,7 +1281,8 @@
 		(registerv-make
 		 (vector (frameset-save nil
 					:app 'register
-					:filters frameset-session-filter-alist)
+					:filters frameset-session-filter-alist
+					:in-session t)
 			 ;; frameset-save does not include the value of point
 			 ;; in the current buffer, so record that separately.
 			 (frameset-frame-id nil)