Fri Dec 4 00:31:30 1992 Jim Blandy (jimb@totoro.cs.oberlin.edu)
[bpt/emacs.git] / lisp / register.el
index a78a046..0921af9 100644 (file)
@@ -2,11 +2,14 @@
 
 ;; Copyright (C) 1985 Free Software Foundation, Inc.
 
+;; Maintainer: FSF
+;; Keywords: internal
+
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 1, or (at your option)
+;; the Free Software Foundation; either version 2, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; along with GNU Emacs; see the file COPYING.  If not, write to
 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
+;;; Code:
 
 (defvar register-alist nil
   "Alist of elements (NAME . CONTENTS), one for each Emacs register.
 NAME is a character (a number).  CONTENTS is a string, number,
-screen configuration, mark or list.
+frame configuration, mark or list.
 A list represents a rectangle; its elements are strings.")
 
 (defun get-register (char)
@@ -40,26 +44,44 @@ A list represents a rectangle; its elements are strings.")
 
 (defun point-to-register (char arg)
   "Store current location of point in register REGISTER.
-With prefix argument, store current screen configuration.
+With prefix argument, store current frame configuration.
 Use \\[jump-to-register] to go to that location or restore that configuration.
 Argument is a character, naming the register."
   (interactive "cPoint to register: \nP")
-  (set-register char (if arg (current-screen-configuration) (point-marker))))
+  (set-register char (if arg (current-frame-configuration) (point-marker))))
+
+(defun window-configuration-to-register (char arg)
+  "Store the window configuration of the selected frame in register REGISTER.
+Use \\[jump-to-register] to restore the configuration.
+Argument is a character, naming the register."
+  (interactive "cPoint to register: \nP")
+  (set-register char (current-window-configuration)))
+
+(defun frame-configuration-to-register (char arg)
+  "Store the window configuration of all frames in register REGISTER.
+Use \\[jump-to-register] to restore the configuration.
+Argument is a character, naming the register."
+  (interactive "cPoint to register: \nP")
+  (set-register char (current-frame-configuration)))
 
 (fset 'register-to-point 'jump-to-register)
 (defun jump-to-register (char)
   "Move point to location stored in a register.
+If the register contains a window configuration (one frame) or a frame
+configuration (all frames), restore that frame or all frames accordingly.
 Argument is a character, naming the register."
   (interactive "cJump to register: ")
   (let ((val (get-register char)))
     (condition-case ()
-       (set-screen-configuration val)
+       (set-frame-configuration val)
       (error
-       (if (markerp val)
-          (progn
-            (switch-to-buffer (marker-buffer val))
-            (goto-char val))
-        (error "Register doesn't contain a buffer position or screen configuration"))))))
+       (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")))))))
 
 ;(defun number-to-register (arg char)
 ;  "Store a number in a register.