From: Richard M. Stallman Date: Sat, 7 Dec 2002 21:29:35 +0000 (+0000) Subject: (describe-register-1): Use window-width X-Git-Tag: ttn-vms-21-2-B4~12120 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=13d6f3028e5f4c5504e945d8f7b92aa0ba72e8a4;p=emacs.git (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 --git a/lisp/register.el b/lisp/register.el index d149dee200e..ad65d4b7401 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -233,9 +233,18 @@ The Lisp value REGISTER is a character." (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))))))