From cbd4993c584af7aed3a3a48db4d5af7231759efc Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Mon, 14 Mar 1994 21:20:25 +0000 Subject: [PATCH] (view-register, insert-register): Handle dead marker. --- lisp/register.el | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/lisp/register.el b/lisp/register.el index 34e64bf6ca3..76f05284c7b 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -144,10 +144,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.")) @@ -183,13 +186,17 @@ Interactively, second arg is non-nil if prefix arg is supplied." (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)