aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/gnus/gnus-art.el
diff options
context:
space:
mode:
authorGnus developers <[email protected]>2011-01-27 23:42:38 +0000
committerKatsumi Yamaoka <[email protected]>2011-01-27 23:42:38 +0000
commit19cc66979d336c0b62cf770ecb5863a86cfd510e (patch)
tree148a3f6d63e4f10bb46bc2c03b2c9913e24a5b27 /lisp/gnus/gnus-art.el
parentb1ab31aeec46fdd1c9f69a54b58800539b15b289 (diff)
Merge changes made in Gnus trunk.
mml2015.el (mml2015-epg-sign): Add and use mml2015-sign-with-sender. (mml2015-epg-encrypt): Use mml2015-sign-with-sender. gnus-art.el (article-update-date-lapsed): Ensure that point stays at the "same place" even if point is on the line being replaced. (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.
Diffstat (limited to 'lisp/gnus/gnus-art.el')
-rw-r--r--lisp/gnus/gnus-art.el40
1 files changed, 33 insertions, 7 deletions
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 327250e327..2960e8f8e2 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/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)))
@@ -3674,19 +3686,33 @@ function and want to see what the date was before converting."
"Function to be run from a timer to update the lapsed time line."
(save-match-data
(let (deactivate-mark)
- (save-excursion
+ (save-window-excursion
(ignore-errors
(walk-windows
(lambda (w)
(set-buffer (window-buffer w))
(when (eq major-mode 'gnus-article-mode)
- (let ((mark (point-marker)))
+ (let ((mark (point-marker))
+ (old-point (point)))
(goto-char (point-min))
(when (re-search-forward "^X-Sent:\\|^Date:" nil t)
- (if gnus-treat-date-combined-lapsed
- (article-date-combined-lapsed t)
+ ;; If the point is on the Date line, then use that
+ ;; absolute position. Otherwise, use the mark.
+ ;; This will ensure that point stays at the "same
+ ;; place".
+ (when (or (< old-point (match-beginning 0))
+ (> old-point (progn
+ (forward-line 1)
+ (while (and (not (eobp))
+ (looking-at "X-Sent:\\|Date:"))
+ (forward-line))
+ (point))))
+ (setq old-point nil))
+ (when gnus-treat-date-combined-lapsed
+ (article-date-combined-lapsed t))
+ (when gnus-treat-date-lapsed
(article-date-lapsed t)))
- (goto-char (marker-position mark))
+ (goto-char (or old-point (marker-position mark)))
(move-marker mark nil))))
nil 'visible))))))