[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nnrss should borrow nnshibmun's RSS date processor...or something
Katsumi Yamaoka <yamaoka@xxxxxxx> writes:
(B>>>>>> In [emacs-w3m : No.08473] Mark Plaksin wrote:
(B>> Some RSS feeds provide the date in ISO 8601 date format. sb-rss.el from
(B>> nnshimbun converts from ISO 8601 to a format that Gnus can handle. nnrss
(B>> does no conversion so Gnus ends up saying the date is the start of the Unix
(B> Gnus will be able to handle ISO 8601 date if we replace every
(B> `parse-time-string' that Gnus uses with `date-to-time' which
(B> uses timezone.el. However, it is effective only in Emacs 22,
(B> because timezone.el distributed with Emacs 21 doesn't understand
(B> ISO 8601 date. For instance:
(B> (timezone-parse-date "2005-12-22T13:14:03+09:00")
(B> ;; Emacs 22.0.50
(B> => ["2005" "12" "22" "13:14:03" nil]
(B> ;; Emacs 21.4
(B> => ["0" "0" "0" "0" nil]
(BThe relevant timezone.el differences between 21.4 and 22.0.50 are very
(Bsmall--just three regexps in timezone-parse-date. Perhaps Gnus should
(Bswitch to date-to-time, include the newer timezone-parse-date and invoke
(Bit when running in Emacs < 22.
(BHere's one way to include the newer timezone-parse-date but it looks ugly
(Band the Elisp docs say "In general, well-designed Lisp programs should not
(Buse this feature [eval-after-load]."
(B(if (< emacs-major-version 22)
(B (eval-after-load "timezone"
(B '(defun timezone-parse-date (date)
(B ... ;; include definition from Emacs 22
(BIs there a better way or a better plan?
(B>> It would be nice if the conversion function from sb-rss.el were put into
(B>> some library that nnrss could easily call. It's not clear to me where the
(B>> best place for that would be.
(B> I think it should be done in nnrss.el since parse-time.el and
(B> time-date.el belong to Emacs, not Gnus.
(BIf Gnus switches to date-to-time, then no change will be needed in nnrss,
(B>> For the moment, I hacked my copy of nnrss.el to call an un-shimbuned
(B>> version of shimbun-rss-process-date.
(B> It seems to have to be used before using `message-make-date' in
(B> the `nnrss-check-group' function. Could you present it?
(BI copied shimbun-rss-process-date, changed the first line from this:
(B(luna-define-method shimbun-rss-process-date ((shimbun shimbun-rss) date)
(B(defun map-shimbun-rss-date (date)
(Band then patched nnrss.el with the attached patch.
(B> BTW, why do you prefer RFC822 date rather than ISO 8601 date?
(B> If it is for the bugfix, we should apply it to both the Gnus
(B> trunk and the v5-10 branch.
(BI don't know enough to prefer either format :) I was just trying to find a
(Bway to make nnrss show the correct date all the time. Making nnrss able to
(Bdo this in both the trunk and v5-10 sounds good to me though I only use
--- nnrss.el.orig 2005-12-21 12:43:03.000000000 -0500
(B+++ nnrss.el 2005-12-21 22:44:04.000000000 -0500
(B@@ -599,9 +601,10 @@
(B (setq author (or (nnrss-node-text rss-ns 'author item)
(B (nnrss-node-text dc-ns 'creator item)
(B (nnrss-node-text dc-ns 'contributor item)))
(B- (setq date (or (nnrss-node-text dc-ns 'date item)
(B- (nnrss-node-text rss-ns 'pubDate item)
(B+ (setq date (map-shimbun-rss-date
(B+ (or (nnrss-node-text dc-ns 'date item)
(B+ (nnrss-node-text rss-ns 'pubDate item)
(B (setq comments (nnrss-node-text rss-ns 'comments item))
(B (when (setq enclosure (cadr (assq (intern (concat rss-ns "enclosure")) item)))
(B (let ((url (cdr (assq 'url enclosure)))