1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-03 08:30:09 +00:00

(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.
This commit is contained in:
Richard M. Stallman 2002-12-07 21:29:35 +00:00
parent 239ad97f24
commit 13d6f3028e

View File

@ -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))))))