Commit 92840a31 authored by Richard M. Stallman's avatar Richard M. Stallman

(list-registers): New command.

(describe-register-1): New subroutine, taken out of view-register.
parent 3be4340f
...@@ -168,54 +168,77 @@ The Lisp value REGISTER is a character." ...@@ -168,54 +168,77 @@ The Lisp value REGISTER is a character."
(if (null val) (if (null val)
(message "Register %s is empty" (single-key-description register)) (message "Register %s is empty" (single-key-description register))
(with-output-to-temp-buffer "*Output*" (with-output-to-temp-buffer "*Output*"
(princ "Register ") (describe-register-1 register t)))))
(princ (single-key-description register))
(princ " contains ") (defun list-registers ()
(cond "Display a list of nonempty registers saying briefly what they contain."
((numberp val) (interactive)
(princ val)) (let ((list (copy-sequence register-alist)))
(setq list (sort list (lambda (a b) (< (car a) (car b)))))
((markerp val) (with-output-to-temp-buffer "*Output*"
(let ((buf (marker-buffer val))) (dolist (elt list)
(if (null buf) (when (get-register (car elt))
(princ "a marker in no buffer") (describe-register-1 (car elt))
(princ "a buffer position:\nbuffer ") (terpri))))))
(princ (buffer-name buf))
(princ ", position ") (defun describe-register-1 (register &optional verbose)
(princ (marker-position val))))) (princ "Register ")
(princ (single-key-description register))
((and (consp val) (window-configuration-p (car val))) (princ " contains ")
(princ "a window configuration.")) (cond
((numberp val)
((and (consp val) (frame-configuration-p (car val))) (princ val))
(princ "a frame configuration."))
((markerp val)
((and (consp val) (eq (car val) 'file)) (let ((buf (marker-buffer val)))
(princ "the file ") (if (null buf)
(prin1 (cdr val)) (princ "a marker in no buffer")
(princ ".")) (princ "a buffer position:\n buffer ")
(princ (buffer-name buf))
((and (consp val) (eq (car val) 'file-query)) (princ ", position ")
(princ "a file-query reference:\nfile ") (princ (marker-position val)))))
(prin1 (car (cdr val)))
(princ ",\nposition ") ((and (consp val) (window-configuration-p (car val)))
(princ (car (cdr (cdr val)))) (princ "a window configuration."))
(princ "."))
((and (consp val) (frame-configuration-p (car val)))
((consp val) (princ "a frame configuration."))
((and (consp val) (eq (car val) 'file))
(princ "the file ")
(prin1 (cdr val))
(princ "."))
((and (consp val) (eq (car val) 'file-query))
(princ "a file-query reference:\n file ")
(prin1 (car (cdr val)))
(princ ",\n position ")
(princ (car (cdr (cdr val))))
(princ "."))
((consp val)
(if verbose
(princ "the rectangle:\n") (princ "the rectangle:\n")
(while val (while val
(princ " ")
(princ (car val)) (princ (car val))
(terpri) (terpri)
(setq val (cdr val)))) (setq val (cdr val))))
(princ "a rectangle starting with ")
(princ (car val))))
((stringp val) ((stringp val)
(if verbose
(princ "the text:\n") (princ "the text:\n")
(princ val)) (princ val))
(princ "text starting with\n ")
(t (string-match "[^ \t\n].\\{,20\\}" val)
(princ "Garbage:\n") (princ (match-string 0 val))))
(prin1 val))))))) (t
(princ "Garbage:\n")
(if verbose (prin1 val)))))
(defun insert-register (register &optional arg) (defun insert-register (register &optional arg)
"Insert contents of register REGISTER. (REGISTER is a character.) "Insert contents of register REGISTER. (REGISTER is a character.)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment