# HG changeset patch # User Richard M. Stallman # Date 1039296575 0 # Node ID 1e0c7ad65f055ad355ef3c644a594d805dec41bb # Parent 59758725d2cf6f5aea6dd315dda1ca31fc62caef (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. diff -r 59758725d2cf -r 1e0c7ad65f05 lisp/register.el --- a/lisp/register.el Sat Dec 07 20:57:53 2002 +0000 +++ b/lisp/register.el Sat Dec 07 21:29:35 2002 +0000 @@ -233,9 +233,18 @@ (progn (princ "the text:\n") (princ val)) - (princ "text starting with\n ") - (string-match "[^ \t\n].\\{,20\\}" val) - (princ (match-string 0 val)))) + (cond + ;; Extract first N characters starting with first non-whitespace. + ((string-match (format "[^ \t\n].\\{,%d\\}" + ;; Deduct 6 for the spaces inserted below. + (min 20 (max 0 (- (window-width) 6)))) + val) + (princ "text starting with\n ") + (princ (match-string 0 val))) + ((string-match "^[ \t\n]+$" val) + (princ "whitespace")) + (t + (princ "the empty string"))))) (t (princ "Garbage:\n") (if verbose (prin1 val))))))