emacs-devel
[Top][All Lists]
Advanced

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

string in a register


From: Masatake YAMATO
Subject: string in a register
Date: Thu, 05 Dec 2002 17:49:01 +0900 (JST)

Dear Emacs developers,
Could I send a patch here?

I have some interests in register.el.

If the contents of register is an just empty string("") or white 
spaces, `list-registers' doesn't work well. This is a fix for it.

2002-11-20  Masatake YAMATO  <address@hidden>  (tiny change)

        * register.el (describe-register-1): use window-width
        to truncate string in a register. check whether the string
        in a register is an empty string or a sequence of white spaces.

Regards,
Masatake YAMATO

Index: lisp/register.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/register.el,v
retrieving revision 1.42
diff -u -r1.42 register.el
--- lisp/register.el    19 Nov 2002 07:37:59 -0000      1.42
+++ lisp/register.el    19 Nov 2002 16:35:32 -0000
@@ -234,8 +234,15 @@
            (princ "the text:\n")
            (princ val))
        (princ "text starting with\n    ")
-       (string-match "[^ \t\n].\\{,20\\}" val)
-       (princ (match-string 0 val))))
+       (cond 
+        ;; 4 spaces are inserted in above princ. so we cannot use all 
(window-width).
+        ;; abs is needed for the case that (window-width) is less than 6.
+        ((string-match (format "[^ \t\n].\\{,%d\\}" (abs (- (window-width) 
6))) val)
+         (princ (match-string 0 val)))
+        ((string-match "^[ \t\n]+$" val)
+         (princ " <white spaces>"))
+        (t
+         (princ "<empty string>")))))
      (t
       (princ "Garbage:\n")
       (if verbose (prin1 val))))))




reply via email to

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