From 2b4fe5a591927e60593e5d8f8ad6c099700ac13d Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Thu, 27 Jan 2011 15:34:35 -0800 Subject: [PATCH] Limit the number of segments dynamically to avoid too-long lines. --- lisp/ChangeLog | 2 ++ lisp/gnus-art.el | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1cb82c106..0fd275616 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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 diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index b7a751ed7..2960e8f8e 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -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))) -- 2.34.1