* rlogin.el (rlogin): recognise the `-l user' option to rlogin and
[bpt/emacs.git] / lisp / register.el
index 91ef6c4..ccf30c9 100644 (file)
@@ -1,6 +1,6 @@
 ;;; register.el --- register commands for Emacs.
 
-;; Copyright (C) 1985, 1993 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1993, 1994 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: internal
@@ -63,33 +63,38 @@ Argument is a character, naming the register."
   "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")
+  (interactive "cWindow configuration to register: \nP")
   (set-register char (current-window-configuration)))
 
 (defun frame-configuration-to-register (char &optional 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")
+  (interactive "cFrame configuration to register: \nP")
   (set-register char (current-frame-configuration)))
 
 (defalias 'register-to-point 'jump-to-register)
-(defun jump-to-register (char)
+(defun jump-to-register (char &optional delete)
   "Move point to location stored in a register.
 If the register contains a file name, find that file.
  \(To put a file name in a register, you must use `set-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: ")
+First argument is a character, naming the register.
+Optional second arg non-nil (interactively, prefix argument) says to
+delete any existing frames that the frame configuration doesn't mention.
+\(Otherwise, these frames are iconified.)"
+  (interactive "cJump to register: \nP")
   (let ((val (get-register char)))
     (cond
      ((and (fboundp 'frame-configuration-p)
           (frame-configuration-p val))
-      (set-frame-configuration val))
+      (set-frame-configuration val (not delete)))
      ((window-configuration-p val)
       (set-window-configuration val))
      ((markerp val)
+      (or (marker-buffer val)
+         (error "That register's buffer no longer exists"))
       (switch-to-buffer (marker-buffer val))
       (goto-char val))
      ((and (consp val) (eq (car val) 'file))
@@ -141,10 +146,13 @@ REGISTER is a character."
          (princ val))
 
         ((markerp val)
-         (princ "a buffer position:\nbuffer ")
-         (princ (buffer-name (marker-buffer val)))
-         (princ ", position ")
-         (princ (+ 0 val)))
+         (let ((buf (marker-buffer val)))
+           (if (null buf)
+               (princ "a marker in no buffer")
+             (princ "a buffer position:\nbuffer ")
+             (princ (buffer-name buf))
+             (princ ", position ")
+             (princ (marker-position val)))))
 
         ((window-configuration-p val)
          (princ "a window configuration."))
@@ -177,16 +185,20 @@ REGISTER is a character."
 Normally puts point before and mark after the inserted text.
 If optional second arg is non-nil, puts mark before and point after.
 Interactively, second arg is non-nil if prefix arg is supplied."
-  (interactive "cInsert register: \nP")
+  (interactive "*cInsert register: \nP")
   (push-mark)
   (let ((val (get-register char)))
-    (if (consp val)
-       (insert-rectangle val)
-      (if (stringp val)
-         (insert val)
-       (if (or (integerp val) (markerp val))
-           (princ (+ 0 val) (current-buffer))
-         (error "Register does not contain text")))))
+    (cond
+     ((consp val)
+      (insert-rectangle val))
+     ((stringp val)
+      (insert val))
+     ((integerp val)
+      (princ val (current-buffer)))
+     ((and (markerp val) (marker-position val))
+      (princ (marker-position val) (current-buffer)))
+     (t
+      (error "Register does not contain text"))))
   (if (not arg) (exchange-point-and-mark)))
 
 (defun copy-to-register (char start end &optional delete-flag)