aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-12-07 21:29:35 +0000
committerRichard M. Stallman2002-12-07 21:29:35 +0000
commit13d6f3028e5f4c5504e945d8f7b92aa0ba72e8a4 (patch)
treeb089e8ab88130c9c4186b4d37e73a7f21dbb849d
parent239ad97f246b937d91a26569e03f96716178fb58 (diff)
downloademacs-13d6f3028e5f4c5504e945d8f7b92aa0ba72e8a4.tar.gz
emacs-13d6f3028e5f4c5504e945d8f7b92aa0ba72e8a4.zip
(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.
-rw-r--r--lisp/register.el15
1 files changed, 12 insertions, 3 deletions
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."
233 (progn 233 (progn
234 (princ "the text:\n") 234 (princ "the text:\n")
235 (princ val)) 235 (princ val))
236 (princ "text starting with\n ") 236 (cond
237 (string-match "[^ \t\n].\\{,20\\}" val) 237 ;; Extract first N characters starting with first non-whitespace.
238 (princ (match-string 0 val)))) 238 ((string-match (format "[^ \t\n].\\{,%d\\}"
239 ;; Deduct 6 for the spaces inserted below.
240 (min 20 (max 0 (- (window-width) 6))))
241 val)
242 (princ "text starting with\n ")
243 (princ (match-string 0 val)))
244 ((string-match "^[ \t\n]+$" val)
245 (princ "whitespace"))
246 (t
247 (princ "the empty string")))))
239 (t 248 (t
240 (princ "Garbage:\n") 249 (princ "Garbage:\n")
241 (if verbose (prin1 val)))))) 250 (if verbose (prin1 val))))))