bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#64202: bug#66188: 29.1; Include Atom feed reader


From: James Thomas
Subject: bug#64202: bug#66188: 29.1; Include Atom feed reader
Date: Thu, 22 Feb 2024 07:47:15 +0530
User-agent: Gnus/5.13 (Gnus v5.13)

James Thomas wrote:

> Daniel Semyonov wrote:
>
>>>>>>> James Thomas writes:
>>
>>     >> If the posts appear in a chronological order, it should end up
>>     >> being correct.  I think what's happening is that the feed you're
>>     >> testing actually uses a reverse chronological order for posts.
>>     >> If not, send me the feed, I might be misunderstanding something.
>>
>>     > Hmm.. It seems to be happening that way for every server I used:
>>
>>     > git.savannah.gnu.org/cgit/emacs.git/atom/?h=master
>>
>>     > rss.slashdot.org/Slashdot/slashdotMainatom:Slashdot
>>
>>     > github.com/emacs-mirror/emacs/commits.atom
>>
>> These feeds (except for the second one which I can't access) are in
>> reverse-chronological order.
>
> Right. I was hoping that that could be made the default.
>
> But I think the patch is fine to be included as it is; from my 1-2 weeks
> of testing.
>
> Cheers,
> James

This doesn't seem to work for some feeds such as:

en.wikipedia.org/w/index.php?title=Special:RecentChanges&feed=atom
thehackernews.com/feeds/posts/default

In the first one above, is the colon character to blame?

Another thing: I've been using your branch also with my addition below
for assuming reverse-chronological as a default (Sorry! But it was
really bugging me! :-)).

diff --git a/lisp/gnus/nnatom.el b/lisp/gnus/nnatom.el
index 2fcf59c1441..9f2b9c359aa 100644
--- a/lisp/gnus/nnatom.el
+++ b/lisp/gnus/nnatom.el
@@ -64,14 +64,16 @@ nnatom--read-feed
                     (when (eq (car data) 'top)
                       (setq data (assq 'feed data)))
                     (dom-add-child-before data auth)
-                    (catch :stop ; Collect feed authors, stop at first entry.
-                      (dolist (child (cdddr data))
-                        (let ((tag (car-safe child)))
-                          (if (eq tag 'entry)
-                              (throw :stop data)
-                            (and (or (eq tag 'author)
-                                     (eq tag 'contributor))
-                                 (dom-add-child-before auth child)))))
+                    (let ((prev (cddr data)))
+                      (while-let ((next (cdr prev))
+                                  (child (car-safe next))
+                                  (tag (car-safe child))
+                                  (_ (not (eq tag 'entry))))
+                        (and (or (eq tag 'author)
+                                 (eq tag 'contributor))
+                             (dom-add-child-before auth child))
+                        (setq prev next))
+                      (setcdr prev (nreverse (cdr prev)))
                       data)))))))
 (defvoo nnatom-read-feed-function #'nnatom--read-feed
   nil nnfeed-read-feed-function)


My case for such a change:

- Reverse-chronological makes sense as a default because a feed link
  only guarantees to provide the latest updates, not an unbroken chain
  of all events since the beginning.

- nnrss.el does it that way: see the 'nreverse' in line #643.

- Performance impact should be minimal because nreverse is O(n) and
  perhaps having to sort by date afterward (rather than simply use the
  existing number) would more than compensate for that.

- Running -catchup-to-here (on a datetime-sorted Summary buffer) will
  only have to record a single article number range in the newsrc.

(My code is probably not as beautiful as many would like it to be)

Would like to know your thoughts.

Regards,
James





reply via email to

[Prev in Thread] Current Thread [Next in Thread]