]> code.delx.au - gnu-emacs/blobdiff - lisp/frame.el
(vc-directory-18): cd to the directory in question before the file tree walk.
[gnu-emacs] / lisp / frame.el
index b4a403fb5501309242e87f26282df8ecbe68b99e..488fd682cc0ed785d14e234efa53e26bf8a09d79 100644 (file)
@@ -1,6 +1,6 @@
 ;;; frame.el --- multi-frame management independent of window systems.
 
-;;;; Copyright (C) 1990, 1992, 1993 Free Software Foundation, Inc.
+;;;; Copyright (C) 1993 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: internal
@@ -236,7 +236,9 @@ These supercede the values given in `default-frame-alist'.")
                                  (> (minibuffer-depth) 0)
                                  t)))
 
-(defun new-frame (&optional parameters)
+;; Alias, kept temporarily.
+(defalias 'new-frame 'make-frame)
+(defun make-frame (&optional parameters)
   "Create a new frame, displaying the current buffer.
 
 Optional argument PARAMETERS is an alist of parameters for the new
@@ -284,25 +286,32 @@ additional frame parameters that Emacs recognizes for X window frames."
 
 (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 +320,13 @@ configuration, and other parameters set as specified in CONFIGURATION."
            (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)))
+
 \f
 ;;;; Convenience functions for accessing and interactively changing
 ;;;; frame parameters.
@@ -410,8 +426,8 @@ Horizontal scroll bars aren't implemented yet."
 
 \f
 ;;;; Aliases for backward compatibility with Emacs 18.
-(fset 'screen-height 'frame-height)
-(fset 'screen-width 'frame-width)
+(defalias 'screen-height 'frame-height)
+(defalias 'screen-width 'frame-width)
 
 (defun set-screen-width (cols &optional pretend)
   "Obsolete function to change the size of the screen to COLS columns.\n\
@@ -438,7 +454,7 @@ should use `set-frame-width' instead."
 ;;;; Key bindings
 (defvar ctl-x-5-map (make-sparse-keymap)
   "Keymap for frame commands.")
-(fset 'ctl-x-5-prefix ctl-x-5-map)
+(defalias 'ctl-x-5-prefix ctl-x-5-map)
 (define-key ctl-x-map "5" 'ctl-x-5-prefix)
 
 (define-key ctl-x-5-map "2" 'new-frame)