Gnus development mailing list
 help / color / mirror / Atom feed
From: Mark Plaksin <happy@usg.edu>
Cc: emacs-w3m@namazu.org
Subject: Re: [emacs-w3m:08474] Re: nnrss should borrow nnshibmun's RSS date processor...or something
Date: Mon, 02 Jan 2006 09:28:03 -0500	[thread overview]
Message-ID: <8764p2g0wc.fsf@stone.tss.usg.edu> (raw)
In-Reply-To: <b4mirthln12.fsf@jpl.org>

[-- Attachment #1: Type: text/plain, Size: 2682 bytes --]

Katsumi Yamaoka <yamaoka@jpl.org> writes:

>>>>>> In [emacs-w3m : No.08473] Mark Plaksin wrote:
>
>> Some RSS feeds provide the date in ISO 8601 date format.  sb-rss.el from
>> nnshimbun converts from ISO 8601 to a format that Gnus can handle.  nnrss
>> does no conversion so Gnus ends up saying the date is the start of the Unix
>> epoch.
>
> Gnus will be able to handle ISO 8601 date if we replace every
> `parse-time-string' that Gnus uses with `date-to-time' which
> uses timezone.el.  However, it is effective only in Emacs 22,
> because timezone.el distributed with Emacs 21 doesn't understand
> ISO 8601 date.  For instance:
>
> (timezone-parse-date "2005-12-22T13:14:03+09:00")
> ;; Emacs 22.0.50
>  => ["2005" "12" "22" "13:14:03" nil]
> ;; Emacs 21.4
>  => ["0" "0" "0" "0" nil]

The relevant timezone.el differences between 21.4 and 22.0.50 are very
small--just three regexps in timezone-parse-date.  Perhaps Gnus should
switch to date-to-time, include the newer timezone-parse-date and invoke
it when running in Emacs < 22.

Here's one way to include the newer timezone-parse-date but it looks ugly
and the Elisp docs say "In general, well-designed Lisp programs should not
use this feature [eval-after-load]."

(if (< emacs-major-version 22)
    (eval-after-load "timezone" 
      '(defun timezone-parse-date (date)
         ... ;; include definition from Emacs 22
         )))

Is there a better way or a better plan?

>> It would be nice if the conversion function from sb-rss.el were put into
>> some library that nnrss could easily call.  It's not clear to me where the
>> best place for that would be.
>
> I think it should be done in nnrss.el since parse-time.el and
> time-date.el belong to Emacs, not Gnus.

If Gnus switches to date-to-time, then no change will be needed in nnrss,
yes?

>> For the moment, I hacked my copy of nnrss.el to call an un-shimbuned
>> version of shimbun-rss-process-date.
>
> It seems to have to be used before using `message-make-date' in
> the `nnrss-check-group' function.  Could you present it?

I copied shimbun-rss-process-date, changed the first line from this:

(luna-define-method shimbun-rss-process-date ((shimbun shimbun-rss) date)

to this:

(defun map-shimbun-rss-date (date)

and then patched nnrss.el with the attached patch.

> BTW, why do you prefer RFC822 date rather than ISO 8601 date?
> If it is for the bugfix, we should apply it to both the Gnus
> trunk and the v5-10 branch.

I don't know enough to prefer either format :)  I was just trying to find a
way to make nnrss show the correct date all the time.  Making nnrss able to
do this in both the trunk and v5-10 sounds good to me though I only use
trunk.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnrss.el patch --]
[-- Type: text/x-patch, Size: 796 bytes --]

--- nnrss.el.orig	2005-12-21 12:43:03.000000000 -0500
+++ nnrss.el	2005-12-21 22:44:04.000000000 -0500
@@ -599,9 +601,10 @@
 	(setq author (or (nnrss-node-text rss-ns 'author item)
 			 (nnrss-node-text dc-ns 'creator item)
 			 (nnrss-node-text dc-ns 'contributor item)))
-	(setq date (or (nnrss-node-text dc-ns 'date item)
-		       (nnrss-node-text rss-ns 'pubDate item)
-		       (message-make-date)))
+	(setq date (map-shimbun-rss-date
+                    (or (nnrss-node-text dc-ns 'date item)
+                        (nnrss-node-text rss-ns 'pubDate item)
+                        (message-make-date))))
 	(setq comments (nnrss-node-text rss-ns 'comments item))
 	(when (setq enclosure (cadr (assq (intern (concat rss-ns "enclosure")) item)))
 	  (let ((url (cdr (assq 'url enclosure)))

  reply	other threads:[~2006-01-02 14:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-22  3:55 [emacs-w3m:08473] " Mark Plaksin
2005-12-22  5:27 ` [emacs-w3m:08474] " Katsumi Yamaoka
2006-01-02 14:28   ` Mark Plaksin [this message]
2006-01-04  2:13     ` [emacs-w3m:08485] " Katsumi Yamaoka
2006-01-04  2:50       ` [emacs-w3m:08486] " Mark Plaksin
2006-01-04  3:05         ` Katsumi Yamaoka
2006-01-04  3:17           ` Mark Plaksin
2006-01-05  7:09             ` [emacs-w3m:08489] " Katsumi Yamaoka
2006-01-05 14:48               ` [emacs-w3m:08490] " Mark Plaksin
2006-01-05 23:55                 ` [emacs-w3m:08491] " Katsumi Yamaoka
2006-01-06 13:17                   ` [emacs-w3m:08492] " Mark Plaksin
2006-01-10 10:13                     ` [emacs-w3m:08495] " Katsumi Yamaoka
2006-01-14 16:03                       ` [emacs-w3m:08502] " Mark Plaksin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8764p2g0wc.fsf@stone.tss.usg.edu \
    --to=happy@usg.edu \
    --cc=emacs-w3m@namazu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).