changeset 6336:d7f922a411f9

(view-register, insert-register): Handle dead marker.
author Karl Heuer <kwzh@gnu.org>
date Mon, 14 Mar 1994 21:20:25 +0000
parents fe5cb6ca692a
children 32cb5a7228ab
files lisp/register.el
diffstat 1 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/register.el	Mon Mar 14 17:50:20 1994 +0000
+++ b/lisp/register.el	Mon Mar 14 21:20:25 1994 +0000
@@ -144,10 +144,13 @@
 	  (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."))
@@ -183,13 +186,17 @@
   (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)