aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Blandy1993-03-15 08:51:02 +0000
committerJim Blandy1993-03-15 08:51:02 +0000
commit376a7584deb5308cf09bb9b2e1db0d4522c4576e (patch)
tree4d293738f871646c02a4e6962d6b54eb807b02c2
parent797d8537f2effa462cfb7232e1bf48ad44bf4172 (diff)
downloademacs-376a7584deb5308cf09bb9b2e1db0d4522c4576e.tar.gz
emacs-376a7584deb5308cf09bb9b2e1db0d4522c4576e.zip
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.
-rw-r--r--lisp/frame.el38
-rw-r--r--lisp/register.el20
2 files changed, 36 insertions, 22 deletions
diff --git a/lisp/frame.el b/lisp/frame.el
index e52d50de04b..989b3efa2ec 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -284,25 +284,32 @@ additional frame parameters that Emacs recognizes for X window frames."
284 284
285(defun current-frame-configuration () 285(defun current-frame-configuration ()
286 "Return a list describing the positions and states of all frames. 286 "Return a list describing the positions and states of all frames.
287Each element is a list of the form (FRAME ALIST WINDOW-CONFIG), where 287Its car is `frame-configuration'.
288FRAME is a frame object, ALIST is an association list specifying 288Each element of the cdr is a list of the form (FRAME ALIST WINDOW-CONFIG),
289some of FRAME's parameters, and WINDOW-CONFIG is a window 289where
290configuration object for FRAME." 290 FRAME is a frame object,
291 (mapcar (function 291 ALIST is an association list specifying some of FRAME's parameters, and
292 (lambda (frame) 292 WINDOW-CONFIG is a window configuration object for FRAME."
293 (list frame 293 (cons 'frame-configuration
294 (frame-parameters frame) 294 (mapcar (function
295 (current-window-configuration frame)))) 295 (lambda (frame)
296 (frame-list))) 296 (list frame
297 (frame-parameters frame)
298 (current-window-configuration frame))))
299 (frame-list))))
297 300
298(defun set-frame-configuration (configuration) 301(defun set-frame-configuration (configuration)
299 "Restore the frames to the state described by CONFIGURATION. 302 "Restore the frames to the state described by CONFIGURATION.
300Each frame listed in CONFIGURATION has its position, size, window 303Each frame listed in CONFIGURATION has its position, size, window
301configuration, and other parameters set as specified in CONFIGURATION." 304configuration, and other parameters set as specified in CONFIGURATION."
302 (let (frames-to-delete) 305 (or (frame-configuration-p configuration)
306 (signal 'wrong-type-argument
307 (list 'frame-configuration-p configuration)))
308 (let ((config-alist (cdr configuration))
309 frames-to-delete)
303 (mapcar (function 310 (mapcar (function
304 (lambda (frame) 311 (lambda (frame)
305 (let ((parameters (assq frame configuration))) 312 (let ((parameters (assq frame config-alist)))
306 (if parameters 313 (if parameters
307 (progn 314 (progn
308 (modify-frame-parameters frame (nth 1 parameters)) 315 (modify-frame-parameters frame (nth 1 parameters))
@@ -311,6 +318,13 @@ configuration, and other parameters set as specified in CONFIGURATION."
311 (frame-list)) 318 (frame-list))
312 (mapcar 'delete-frame frames-to-delete))) 319 (mapcar 'delete-frame frames-to-delete)))
313 320
321(defun frame-configuration-p (object)
322 "Return non-nil if OBJECT seems to be a frame configuration.
323Any list whose car is `frame-configuration' is assumed to be a frame
324configuration."
325 (and (consp object)
326 (eq (car object) 'frame-configuration)))
327
314 328
315;;;; Convenience functions for accessing and interactively changing 329;;;; Convenience functions for accessing and interactively changing
316;;;; frame parameters. 330;;;; frame parameters.
diff --git a/lisp/register.el b/lisp/register.el
index 885e5c5a0a7..25167cf4abd 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -72,16 +72,16 @@ configuration (all frames), restore that frame or all frames accordingly.
72Argument is a character, naming the register." 72Argument is a character, naming the register."
73 (interactive "cJump to register: ") 73 (interactive "cJump to register: ")
74 (let ((val (get-register char))) 74 (let ((val (get-register char)))
75 (condition-case () 75 (cond
76 (set-frame-configuration val) 76 ((frame-configuration-p val)
77 (error 77 (set-frame-configuration val))
78 (if (window-configuration-p val) 78 ((window-configuration-p val)
79 (set-window-configuration val) 79 (set-window-configuration val))
80 (if (markerp val) 80 ((markerp val)
81 (progn 81 (switch-to-buffer (marker-buffer val))
82 (switch-to-buffer (marker-buffer val)) 82 (goto-char val))
83 (goto-char val)) 83 (t
84 (error "Register doesn't contain a buffer position or configuration"))))))) 84 (error "Register doesn't contain a buffer position or configuration")))))
85 85
86;(defun number-to-register (arg char) 86;(defun number-to-register (arg char)
87; "Store a number in a register. 87; "Store a number in a register.