Fri Dec 4 00:31:30 1992 Jim Blandy (jimb@totoro.cs.oberlin.edu)
[bpt/emacs.git] / lisp / register.el
index d1870d9..0921af9 100644 (file)
@@ -1,15 +1,15 @@
 ;;; register.el --- register commands for Emacs.
 
-;; Maintainer: FSF
-;; Last-Modified: 9 Jul 1992
-
 ;; 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,
@@ -50,20 +50,38 @@ Argument is a character, naming the register."
   (interactive "cPoint to register: \nP")
   (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-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 frame 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.