Commit 376a7584 authored by Jim Blandy's avatar Jim Blandy

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.
parent 797d8537
...@@ -284,25 +284,32 @@ additional frame parameters that Emacs recognizes for X window frames." ...@@ -284,25 +284,32 @@ additional frame parameters that Emacs recognizes for X window frames."
(defun current-frame-configuration () (defun current-frame-configuration ()
"Return a list describing the positions and states of all frames. "Return a list describing the positions and states of all frames.
Each element is a list of the form (FRAME ALIST WINDOW-CONFIG), where Its car is `frame-configuration'.
FRAME is a frame object, ALIST is an association list specifying Each element of the cdr is a list of the form (FRAME ALIST WINDOW-CONFIG),
some of FRAME's parameters, and WINDOW-CONFIG is a window where
configuration object for FRAME." FRAME is a frame object,
(mapcar (function ALIST is an association list specifying some of FRAME's parameters, and
(lambda (frame) WINDOW-CONFIG is a window configuration object for FRAME."
(list frame (cons 'frame-configuration
(frame-parameters frame) (mapcar (function
(current-window-configuration frame)))) (lambda (frame)
(frame-list))) (list frame
(frame-parameters frame)
(current-window-configuration frame))))
(frame-list))))
(defun set-frame-configuration (configuration) (defun set-frame-configuration (configuration)
"Restore the frames to the state described by CONFIGURATION. "Restore the frames to the state described by CONFIGURATION.
Each frame listed in CONFIGURATION has its position, size, window Each frame listed in CONFIGURATION has its position, size, window
configuration, and other parameters set as specified in CONFIGURATION." 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 (mapcar (function
(lambda (frame) (lambda (frame)
(let ((parameters (assq frame configuration))) (let ((parameters (assq frame config-alist)))
(if parameters (if parameters
(progn (progn
(modify-frame-parameters frame (nth 1 parameters)) (modify-frame-parameters frame (nth 1 parameters))
...@@ -311,6 +318,13 @@ configuration, and other parameters set as specified in CONFIGURATION." ...@@ -311,6 +318,13 @@ configuration, and other parameters set as specified in CONFIGURATION."
(frame-list)) (frame-list))
(mapcar 'delete-frame frames-to-delete))) (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 ;;;; Convenience functions for accessing and interactively changing
;;;; frame parameters. ;;;; frame parameters.
......
...@@ -72,16 +72,16 @@ configuration (all frames), restore that frame or all frames accordingly. ...@@ -72,16 +72,16 @@ configuration (all frames), restore that frame or all frames accordingly.
Argument is a character, naming the register." Argument is a character, naming the register."
(interactive "cJump to register: ") (interactive "cJump to register: ")
(let ((val (get-register char))) (let ((val (get-register char)))
(condition-case () (cond
(set-frame-configuration val) ((frame-configuration-p val)
(error (set-frame-configuration val))
(if (window-configuration-p val) ((window-configuration-p val)
(set-window-configuration val) (set-window-configuration val))
(if (markerp val) ((markerp val)
(progn (switch-to-buffer (marker-buffer val))
(switch-to-buffer (marker-buffer val)) (goto-char val))
(goto-char val)) (t
(error "Register doesn't contain a buffer position or configuration"))))))) (error "Register doesn't contain a buffer position or configuration")))))
;(defun number-to-register (arg char) ;(defun number-to-register (arg char)
; "Store a number in a register. ; "Store a number in a register.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment