bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no list-registers command; no Info place marks; rename Info buffer,


From: Ehud Karni
Subject: Re: no list-registers command; no Info place marks; rename Info buffer, mode line unfazed
Date: Wed, 28 Feb 2001 13:43:00 +0200

On 28 Feb 2001 10:19:56 +0000, Matt Hodges
    <pczmph@unix.ccc.nottingham.ac.uk> wrote:
> 
> >>>>> Dan Jacobson writes:
 
>  > Amongst the various register commands, one cannot find one for
>  > listing out all the registers one has been assigning. At least the
>  > info page should mention how to dig this info out of emacs, as all
>  > those single key names are easy to loose track of after two or
>  > three.
> 
> I made a similar feature request a while back. A very quick and very
> dirty hack can be obtained from:
> 
>  http://vegemite.chem.nottingham.ac.uk/~matt/emacs/list-registers.el

I haven't checked your code but here is my code (which has some
enhancement over original register use, because I refined the saved
data, I'll post my enhancement to gnu sources soon):

(defun view-all-registers ()
  "Display what is contained in all the registers"
  (interactive)
       (if (car-safe register-alist)
           (let ((char 0))
               (with-output-to-temp-buffer "*Register Data*"
                   (while (< char 256)
                       (and (get-register char)
                           (view-1-register char))
                       (setq char (1+ char)))))
           (message "No registers saved")))

(defun view-register (register)
  "Display what is contained in register REGISTER."
  (interactive "cDisplay register: ")
       (with-output-to-temp-buffer "*Register Data*"
                   (view-1-register register)))

(defun view-1-register (char) "view one register (internal function)"
       (let ((val (get-register char)))
           (if (null val)
               (message "Register %s is empty" (single-key-description char))
           (progn
               (princ "Register ")
               (princ (single-key-description char))
               (princ " contains ")
               (cond
                   ((integerp val)
                           (princ val))
                   ((markerp val)
                           (let ((buf (marker-buffer val)))
                               (if (null buf)
                                   (princ "a marker in no buffer")
                                   (progn
                                       (princ "a buffer position:\nbuffer ")
                                       (princ (buffer-name buf))
                                       (princ ", position ")
                                       (princ (marker-position val))))))
                   ((window-configuration-p val)
                           (princ "a window configuration."))
;;                 ((frame-configuration-p 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 position (query):\nfile ")
                           (princ (nth 1 val))
                           (princ ", position ")
                           (princ (nth 2 val)))
                   ((consp val)
                           (princ "the block:\n")
                           (while val
                               (princ (car val))
                               (terpri)
                               (setq val (cdr val))))
                   ((stringp val)
                           (princ "the text:\n")
                           (princ val))
                   (t
                            (princ "Garbage:\n")
                            (prin1 val)))
               (terpri)))))


-- 
 @@@@@@ @@@ @@@@@@ @    @   Ehud Karni  Simon & Wiesel  Insurance agency
     @    @      @  @@  @   Tel: +972-3-6212-757    Fax: +972-3-6292-544
     @    @ @    @ @  @@    (USA)  Fax  and  voice  mail:  1-815-5509341
     @    @ @    @ @    @        Better     Safe     Than     Sorry
 http://www.simonwiesel.co.il    mailto:ehud@unix.simonwiesel.co.il



reply via email to

[Prev in Thread] Current Thread [Next in Thread]