changeset 2202:081afcef5e85

Make frame configurations start with a distinctive symbol. * frame.el (current-frame-configuration): Return a list as before, but starting with `frame-configuration'. (set-frame-configuration): Check that CONFIGURATION is a list starting with `frame-configuration', strip it off, and do as before. (frame-configuration-p): New function. * register.el (jump-to-register): Use frame-configuration-p, instead of catching an error in set-frame-configuration. Really now.
author Jim Blandy <jimb@redhat.com>
date Mon, 15 Mar 1993 08:51:02 +0000
parents bfe994df6c27
children 12e9bc8a4a7f
files lisp/frame.el lisp/register.el
diffstat 2 files changed, 36 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/frame.el	Mon Mar 15 06:37:33 1993 +0000
+++ b/lisp/frame.el	Mon Mar 15 08:51:02 1993 +0000
@@ -284,25 +284,32 @@
 
 (defun current-frame-configuration ()
   "Return a list describing the positions and states of all frames.
-Each element is a list of the form (FRAME ALIST WINDOW-CONFIG), where
-FRAME is a frame object, ALIST is an association list specifying
-some of FRAME's parameters, and WINDOW-CONFIG is a window
-configuration object for FRAME."
-  (mapcar (function
-	   (lambda (frame)
-	     (list frame
-		   (frame-parameters frame)
-		   (current-window-configuration frame))))
-	  (frame-list)))
+Its car is `frame-configuration'.
+Each element of the cdr is a list of the form (FRAME ALIST WINDOW-CONFIG),
+where
+  FRAME is a frame object,
+  ALIST is an association list specifying some of FRAME's parameters, and
+  WINDOW-CONFIG is a window configuration object for FRAME."
+  (cons 'frame-configuration
+	(mapcar (function
+		 (lambda (frame)
+		   (list frame
+			 (frame-parameters frame)
+			 (current-window-configuration frame))))
+		(frame-list))))
 
 (defun set-frame-configuration (configuration)
   "Restore the frames to the state described by CONFIGURATION.
 Each frame listed in CONFIGURATION has its position, size, window
 configuration, and other parameters set as specified in CONFIGURATION."
-  (let (frames-to-delete)
+  (or (frame-configuration-p configuration)
+      (signal 'wrong-type-argument
+	      (list 'frame-configuration-p configuration)))
+  (let ((config-alist (cdr configuration))
+	frames-to-delete)
     (mapcar (function
 	     (lambda (frame)
-	       (let ((parameters (assq frame configuration)))
+	       (let ((parameters (assq frame config-alist)))
 		 (if parameters
 		     (progn
 		       (modify-frame-parameters frame (nth 1 parameters))
@@ -311,6 +318,13 @@
 	    (frame-list))
     (mapcar 'delete-frame frames-to-delete)))
 
+(defun frame-configuration-p (object)
+  "Return non-nil if OBJECT seems to be a frame configuration.
+Any list whose car is `frame-configuration' is assumed to be a frame
+configuration."
+  (and (consp object)
+       (eq (car object) 'frame-configuration)))
+
 
 ;;;; Convenience functions for accessing and interactively changing
 ;;;; frame parameters.
--- a/lisp/register.el	Mon Mar 15 06:37:33 1993 +0000
+++ b/lisp/register.el	Mon Mar 15 08:51:02 1993 +0000
@@ -72,16 +72,16 @@
 Argument is a character, naming the register."
   (interactive "cJump to register: ")
   (let ((val (get-register char)))
-    (condition-case ()
-	(set-frame-configuration val)
-      (error
-       (if (window-configuration-p val)
-	   (set-window-configuration val)
-	 (if (markerp val)
-	     (progn
-	       (switch-to-buffer (marker-buffer val))
-	       (goto-char val))
-	   (error "Register doesn't contain a buffer position or configuration")))))))
+    (cond
+     ((frame-configuration-p val)
+      (set-frame-configuration val))
+     ((window-configuration-p val)
+      (set-window-configuration val))
+     ((markerp val)
+      (switch-to-buffer (marker-buffer val))
+      (goto-char val))
+     (t
+      (error "Register doesn't contain a buffer position or configuration")))))
 
 ;(defun number-to-register (arg char)
 ;  "Store a number in a register.