Limit the number of segments dynamically to avoid too-long lines.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Thu, 27 Jan 2011 23:34:35 +0000 (15:34 -0800)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Thu, 27 Jan 2011 23:34:35 +0000 (15:34 -0800)
lisp/ChangeLog
lisp/gnus-art.el

index 1cb82c1..0fd2756 100644 (file)
@@ -5,6 +5,8 @@
        (article-update-date-lapsed): Allow updating both the combined lapsed
        and the lapsed headers.
        (article-update-date-lapsed): Skip past all the X-Sent/Date headers.
+       (article-make-date-line): Limit the number of segments dynamically to
+       avoid too-long lines.
 
 2011-01-27  Julien Danjou  <julien@danjou.info>
 
index b7a751e..2960e8f 100644 (file)
@@ -3570,8 +3570,20 @@ should replace the \"Date:\" one, or should be added below it."
          (concat "X-Sent: " (article-lapsed-string time)))
         ;; A combined date/lapsed format.
         ((eq type 'combined-lapsed)
-         (concat (article-make-date-line date 'original)
-                 " (" (article-lapsed-string time 3) ")"))
+         (let ((date-string (article-make-date-line date 'original))
+               (segments 3)
+               lapsed-string)
+           (while (and
+                   (setq lapsed-string
+                         (concat " (" (article-lapsed-string time segments) ")"))
+                   (> (+ (length date-string)
+                         (length lapsed-string))
+                      (+ fill-column 10))
+                   (> segments 0))
+             (setq segments (1- segments)))
+           (if (> segments 0)
+               (concat date-string lapsed-string)
+             date-string)))
         ;; Display the date in proper English
         ((eq type 'english)
          (let ((dtime (decode-time time)))