From: yamaoka Date: Mon, 25 Apr 2005 06:35:57 +0000 (+0000) Subject: Synch to No Gnus 200504250634. X-Git-Tag: t-gnus-6_17_4-quimby-~498 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d28cba2a6cb5103dd21483ae410ba1748fedc7ee;p=elisp%2Fgnus.git- Synch to No Gnus 200504250634. (article-update-date-lapsed): Check for mime-preview-original-major-mode as well. (gnus-article-save-original-date): New macro. (gnus-article-prepare-mime-display): Use it. (gnus-article-prepare-display): Use it. --- diff --git a/ChangeLog b/ChangeLog index 908e922..bc1baaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-04-25 Katsumi Yamaoka + + * lisp/gnus-art.el (article-update-date-lapsed): Check for + mime-preview-original-major-mode as well. + (gnus-article-save-original-date): New macro. + (gnus-article-prepare-mime-display): Use it. + (gnus-article-prepare-display): Use it. + 2005-03-16 Katsumi Yamaoka * lisp/dgnushack.el: Use configure-package-path instead of diff --git a/lisp/ChangeLog b/lisp/ChangeLog index eab7c90..cc0f801 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2005-04-25 Katsumi Yamaoka + + * gnus-art.el (article-date-ut): Don't delete X-Sent header when + gnus-article-date-lapsed-new-header is t if date timer is active; + skip headers in which the original date value is empty. + (gnus-article-date-value): New function. + (gnus-article-save-original-date): Abolish. + (gnus-display-mime): Save original date after doing all treatments. + 2005-04-22 Katsumi Yamaoka * gnus-art.el (article-date-ut): Support converting date in diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 48816b1..5a4c15f 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -3015,10 +3015,14 @@ how much time has lapsed since DATE. For `lapsed', the value of should replace the \"Date:\" one, or should be added below it." (interactive (list 'ut t)) (let* ((tdate-regexp "^Date:[ \t]\\|^X-Sent:[ \t]") - (date-regexp (if (and gnus-article-date-lapsed-new-header - (eq type 'lapsed)) - "^X-Sent:[ \t]" - tdate-regexp)) + (date-regexp (cond ((not gnus-article-date-lapsed-new-header) + tdate-regexp) + ((eq type 'lapsed) + "^X-Sent:[ \t]") + (article-lapsed-timer + "^Date:[ \t]") + (t + tdate-regexp))) (case-fold-search t) (inhibit-read-only t) (inhibit-point-motion-hooks t) @@ -3027,23 +3031,15 @@ should replace the \"Date:\" one, or should be added below it." (save-restriction (widen) (goto-char (point-min)) - (while (and (or (setq date (get-text-property (setq pos (point)) - 'original-date)) - (and (setq pos (next-single-property-change - (point) 'original-date)) - (setq date (get-text-property pos - 'original-date)))) - (not (string-equal date ""))) - (goto-char (or (text-property-any pos (point-max) - 'original-date nil) - (point-max))) - ;; Skip Face or X-Face. - (unless (bolp) - (end-of-line) - (goto-char (or (text-property-any pos (point-max) - 'original-date nil) - (point-max)))) - (narrow-to-region pos (point)) + (while (or (setq date (get-text-property (setq pos (point)) + 'original-date)) + (when (setq pos (next-single-property-change + (point) 'original-date)) + (setq date (get-text-property pos 'original-date)) + t)) + (narrow-to-region pos (or (text-property-any pos (point-max) + 'original-date nil) + (point-max))) (goto-char (point-min)) (when (re-search-forward tdate-regexp nil t) (setq bface (get-text-property (point-at-bol) 'face) @@ -3225,7 +3221,10 @@ function and want to see what the date was before converting." (walk-windows (lambda (w) (set-buffer (window-buffer w)) - (when (eq major-mode 'gnus-article-mode) + (when (or (and (eq major-mode 'mime-view-mode) + (eq (mime-preview-original-major-mode) + 'gnus-original-article-mode)) + (eq major-mode 'gnus-article-mode)) (let ((mark (point-marker))) (goto-char (point-min)) (when (re-search-forward "^X-Sent:" nil t) @@ -3263,21 +3262,25 @@ This format is defined by the `gnus-article-time-format' variable." (interactive (list t)) (article-date-ut 'iso8601 highlight)) -(defun gnus-article-save-original-date () +(defun gnus-article-date-value () + "Return the value of the date header. +The buffer is expected to be narrowed to just the header of the article." + (goto-char (point-min)) + (let* ((case-fold-search t) + (start (when (and (re-search-forward "^date:[\t\n ]+" nil t) + (not (bolp))) + (match-end 0)))) + (when (and start + (re-search-forward "[\t ]*\n\\(?:[^\t ]\\|\\'\\)" nil t)) + (buffer-substring-no-properties start (match-beginning 0))))) + +(defmacro gnus-article-save-original-date (&rest forms) "Save the original date as a text property." - ;;(goto-char (point-max)) - (skip-chars-backward "\n") - (let (start - (end (point)) - (case-fold-search t)) - (goto-char (point-min)) - (when (and (re-search-forward "^date:[\t\n ]+" nil t) - (progn - (setq start (match-end 0)) - (re-search-forward "[\t ]*\n\\(?:[^\t ]\\|\\'\\)" nil t))) - (put-text-property - (point-min) end 'original-date - (buffer-substring-no-properties start (match-beginning 0)))))) + `(let ((date (,(symbol-function 'gnus-article-date-value)))) + ,@forms + (goto-char (point-max)) + (skip-chars-backward "\n") + (put-text-property (point-min) (point) 'original-date date))) ;; (defun article-show-all () ;; "Show all hidden text in the article buffer." @@ -4217,8 +4220,7 @@ If ALL-HEADERS is non-nil, no headers are hidden." (if (search-forward "\n\n" nil t) (point) (point-max))) - (gnus-article-save-original-date) - (gnus-treat-article 'head) + (gnus-article-save-original-date (gnus-treat-article 'head)) (put-text-property (point-min) (point-max) 'article-treated-header t) (goto-char (point-max))) (while (and (not (eobp)) entity) @@ -4313,8 +4315,7 @@ If ALL-HEADERS is non-nil, no headers are hidden." (if (search-forward "\n\n" nil t) (point) (point-max))) - (gnus-article-save-original-date) - (gnus-treat-article 'head) + (gnus-article-save-original-date (gnus-treat-article 'head)) (put-text-property (point-min) (point-max) 'article-treated-header t) (goto-char (point-max)) (widen) @@ -5034,7 +5035,7 @@ N is the numerical prefix." (set-window-point window point))) (let ((handles ihandles) (inhibit-read-only t) - handle name type b e display) + handle date) (cond (handles) ((setq handles (mm-dissect-buffer nil gnus-article-loose-mime)) (when gnus-article-emulate-mime @@ -5073,8 +5074,8 @@ N is the numerical prefix." (save-restriction (article-goto-body) (narrow-to-region (point-min) (point)) - (gnus-article-save-original-date) - (gnus-treat-article 'head)))))))) + (gnus-article-save-original-date + (gnus-treat-article 'head))))))))) (defcustom gnus-mime-display-multipart-as-mixed nil "Display \"multipart\" parts as \"multipart/mixed\".