From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#64202: [PATCH] Gnus: Add back end for Atom feeds (nnatom) Date: Wed, 05 Jul 2023 10:17:56 -0700 Message-ID: <874jmie0qj.fsf@ericabrahamsen.net> References: <87v8fhmgvw.fsf@dsemy.com> <87y1k76eip.fsf@dsemy.com> <87fs6epd6d.fsf@dsemy.com> <87bkh2p96o.fsf@dsemy.com> <83ilb4qb44.fsf@gnu.org> <87r0prkgsz.fsf@dsemy.com> <873525udhn.fsf@ericabrahamsen.net> <87pm59984x.fsf@dsemy.com> <87a5wdskw8.fsf@ericabrahamsen.net> <87edlm5yc9.fsf@dsemy.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24965"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: daniel@dsemy.com To: 64202@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 05 19:19:31 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qH6A7-0006H3-5f for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 05 Jul 2023 19:19:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qH69f-0001eh-Bw; Wed, 05 Jul 2023 13:19:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qH69d-0001eQ-W6 for bug-gnu-emacs@gnu.org; Wed, 05 Jul 2023 13:19:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qH69d-0003ZK-Nb for bug-gnu-emacs@gnu.org; Wed, 05 Jul 2023 13:19:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qH69d-0004JC-I1 for bug-gnu-emacs@gnu.org; Wed, 05 Jul 2023 13:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Jul 2023 17:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64202 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: Daniel Semyonov via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: 64202@debbugs.gnu.org, Daniel Semyonov Original-Received: via spool by submit@debbugs.gnu.org id=B.168857749616508 (code B ref -1); Wed, 05 Jul 2023 17:19:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Jul 2023 17:18:16 +0000 Original-Received: from localhost ([127.0.0.1]:38893 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qH68t-0004IB-CJ for submit@debbugs.gnu.org; Wed, 05 Jul 2023 13:18:15 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:60610) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qH68r-0004I4-If for submit@debbugs.gnu.org; Wed, 05 Jul 2023 13:18:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qH68o-0001T5-W5 for bug-gnu-emacs@gnu.org; Wed, 05 Jul 2023 13:18:11 -0400 Original-Received: from mail.ericabrahamsen.net ([52.70.2.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qH68m-0002za-TF for bug-gnu-emacs@gnu.org; Wed, 05 Jul 2023 13:18:10 -0400 Original-Received: from localhost (c-71-197-232-41.hsd1.wa.comcast.net [71.197.232.41]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 372A2FA002; Wed, 5 Jul 2023 17:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1688577478; bh=YxC0YX0k8gklCooI/5uWX3n7zRA1Cgfy7otalsMPXQ8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=QqQ1XghSatuPifjRCXW+PWJ0fj7mXoJy8zjoJH9t8dpmzOtyEr59f/7wkY2x90E1s xMDZF1G7W4CpGgEMDyqz5md5Vy2oxKJbUplJPSp92BmnJ/7P75jRRFG84S9JsCILrh roaPbFVqmfvR7JsMSr3z0PfomTHgs1pODvYGqJI4= In-Reply-To: <87edlm5yc9.fsf@dsemy.com> (Daniel Semyonov via's message of "Wed, 05 Jul 2023 15:36:54 +0300") Received-SPF: pass client-ip=52.70.2.18; envelope-from=eric@ericabrahamsen.net; helo=mail.ericabrahamsen.net X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264641 Archived-At: Daniel Semyonov via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > Sorry, I missed this email (I didn't realize debbugs doesn't forward all > messages to the author of the "bug report"). No worries, usually I do a reply all, but sometimes forget. >>>>>> Eric Abrahamsen writes: > > > Huh! In all my years of using and working on Gnus I've never used > > a "foreign" server, nor have I really understood what it means. At > > some point it would be good to make sure this works via other > > entrypoints as well, but so far so good. > > AFAIK it should work for any entry point which allows you to define a > new server or select method (Atom feeds are represented as servers with > a single group, so there is no way to create a group without a > pre-existing corresponding server). > I'll be honest though, I only ever use this method and > 'gnus-secondary-select-methods', so I'm not really sure which other > entry points there are. What I usually start with is "G m", for `gnus-group-make-group'. That prompts for a group name, and also a backend. The viable list of backends includes all your currently-defined servers, plus the generic symbols for all defined backends, in this case a plain 'nnatom. As you point out, that doesn't work for nnatom because each group will need its own server. What *does* work is to create a group this way, then put point on the new group and hit "M-e", for `gnus-group-edit-group-method', put in the actual URL, then "C-c C-c". Obviously this is horribly baroque and it would be better if `gnus-group-make-group' could prompt for the URL. No matter what, it would be good to document the various ways to do this. > > Regarding your earlier question about having this backend handle > > RSS too, I'm not aware of any significant difference between the > > two beyond the format of the XML. Is that true? > > Yes, even the XML format is very similar. > > > If so, it seems like it would make most sense to merge the > > code. Have you looked at nnrss? It would be good to know if there > > was anything in there worth stealing for nnatom -- if one of them > > has a faster parser than the other, for instance, or better logic > > for keeping updates efficient. > > The issue with merging the two is that nnrss saves feed data differently > (both on disk and in memory), and also represents each feed as a group, > with a virtual "server" holding all groups. > I'm not sure if it's possible/a good idea to migrate feed data from > nnrss to a hypothetical merged backend, at least not automatically. > > Stefan floated the idea of adding RSS support, deprecating nnrss and > creating an interactive migration command - so users who wish to migrate > will have to do so manually (which should also potentially allow asking > the user some questions if the migration includes some non-trivial > steps). > > nnrss does do some cool stuff that nnatom doesn't, though (for example, > it tries very hard to find an RSS feed when you provide it with a link > to a website, while nnatom currently requires a direct link to a feed). Right, I should have been more explicit here -- what I was thinking is what Stefan suggests: just deprecate nnrss altogether. If it does anything cool like feed discovery, just steal that code. If you're inclined to be nice enough to provide a migration function, that's a bonus. > > I just subscribed to a feed with nnrss, and noticed that after I > > marked all the items in the feed as read, I couldn't re-enter the > > group and see the old items. It gave me "Can't select group". So > > that's not very encouraging. > > Honestly, from my experience nnrss has many small issues (although I > never encountered this exact issue). It is partly why I developed > nnatom (previously I used a hack documented on the Emacs wiki which > converted Atom feeds to RSS feeds on the fly). > > > If you do want to expand this to be a general "feed" backend, we > > might want to do some boring things like rename it nnfeed.el, > > This is the name I thought of too, and I guess if two people thought of > it independently it's probably fine. Good! > > and add support for ridiculous things like JSON feed[0] (why?!?). I > > assume a derived backend could handle JSON feeds by setting the > > appropriate values for the `nnatom-read-*-function' deffoos? > > I actually attached a derivative "nnjsonfeed" backend I made as an > experiment to one of my previous messages (it doesn't work with the > current version of the patch, but it won't be hard to fix). > > It wasn't 100% conforming to the standard (JSON feeds support some weird > features like pagination, which can actually be supported very well in > theory by nnatom, but I didn't feel like doing that), but it worked and > it was very easy to make. I missed nnjsonfeed, sorry. That's great you're already working in this direction. I don't think we need to support absolutely everything it does (what would pagination look like in Gnus?), just the basics to get started with. > > One of the awkward things about nnrss is that it's never really > > fit well into Gnus' one-server-many-groups paradigm, which you > > allude to in the nnatom Info section. Do you have any further > > ideas in that direction? > > Well, nnatom theoretically supports this paradigm, but it doesn't do > this with Atom feeds, since it doesn't really make sense IMO. > However, there is a standardized way to include links to Atom feeds in > HTML documents, so it might be a good idea to support adding them as > servers which show any linked Atom feeds as groups. It's also perfectly possible that a single website would publish multiple Atom feeds, right? Like weather.gov, for instance. That would have an added benefit of letting us simplify the server name from the full URL (https://alerts.weather.gov/cap/wa.php?x=0) which looks ugly in the Group buffer, to just eg alerts.weather.gov. But I guess I don't know why it would matter, really. The only practical use for wanting multiple feeds under a single server would be to set some configuration at the server level, that would apply to all feeds from that server. And at the moment I don't think there are many such settings (right?). > I also have a (very experimental) derivative backend using the API of > some website, which exposes various categories of content, which I > expose as groups (this is what I use to test support for multiple groups > in a single server). > > As a side note: I had hoped to publish an updated version of the patch > by now, but unfortunately I was a bit under the weather lately, so I > didn't feel like working on it. No rush! Eric