From: Daniel Semyonov via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: cohen@bu.edu, larsi@gnus.org, Eli Zaretskii <eliz@gnu.org>,
64202@debbugs.gnu.org, monnier@iro.umontreal.ca
Subject: bug#64202: [PATCH] Gnus: Add back end for Atom feeds (nnatom)
Date: Mon, 03 Jul 2023 03:00:14 +0300 [thread overview]
Message-ID: <87pm59984x.fsf@dsemy.com> (raw)
In-Reply-To: <873525udhn.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sun, 02 Jul 2023 15:59:00 -0700")
>>>>> Eric Abrahamsen writes:
> Thanks again for working on this -- I'm getting around to trying
> it out. I have a dumb first question: how do I create a Atom
> group? I wanted to try it out with the US weather.gov feed for my
> state: https://alerts.weather.gov/cap/wa.php?x=0
> I tried with "a" in the *Server* buffer, "G m" in the *Group*
> buffer, but I guess neither allow for prompting the user for a
> URL.
You can use "B nnatom RET <address> RET" in the group buffer for this
purpose.
> I also added
> (nnatom "alerts.weather.gov/cap/wa.php?x=0)
> to my `gnus-secondary-select-methods' variable, but it said
> "Server file alerts.weather.gov/cap/wa.php?x=0 not readable or
> writable" when I restarted Gnus. I guess because we're going
> straight to `nnatom-open-server', which reads a local file,
> without ever fetching the file. We'd have to hit
> `nnatom--parse-feed' to do that, but I don't see how we arrive
> there without already having the server created.
The server should be allowed to open without an existing local file, as
long as that local file is writable, however...
> What am I missing?
You're not missing anything, you actually just reminded me of a bug I
forgot to fix - the directory holding the local feed data isn't
automatically created if it's missing, which causes 'file-writable-p' to
return nil, preventing the server from opening. As a workaround,
manually create an "atom" subdir under 'gnus-directory'. I'll fix this
in the next version.
However, this particular feed still doesn't work since the comment at
the start of the feed changes the structure of the parsed representation
of the feed when libxml is supported (this also made me realize I
accidentally broke parsing without libxml in the last version, oops).
This is very useful info, as this is the first feed I encountered like
this, and I will fix both those issues too in the next version.
As a quick fix, redefine 'nnatom--read-feed' as:
(defun nnatom--read-feed (feed _)
"Return a list structure representing FEED, or nil."
(if (string-match-p "^https?://" feed)
(nnheader-report
nnatom-backend
"Address shouldn't start with \"http://\" or \"https://\"")
(with-temp-buffer
(condition-case e
(if (file-readable-p feed)
(insert-file-contents feed)
(mm-url-insert-file-contents (concat "https://" feed)))
(file-error (nnheader-report nnatom-backend (cdr e)))
(:success (when-let ((data (if (libxml-available-p)
(libxml-parse-xml-region
(point-min) (point-max))
(car (xml-parse-region
(point-min) (point-max)))))
(auth (list 'authors)))
(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) 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))))))))))))
Thanks,
Daniel
next prev parent reply other threads:[~2023-07-03 0:00 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-21 7:08 bug#64202: [PATCH] Gnus: Add back end for Atom feeds (nnatom) Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-21 9:50 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-21 13:02 ` Eli Zaretskii
2023-06-21 14:26 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-25 10:07 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-26 13:26 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-26 14:52 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-01 8:39 ` Eli Zaretskii
2023-07-01 11:33 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-02 22:59 ` Eric Abrahamsen
2023-07-03 0:00 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-07-03 4:01 ` Eric Abrahamsen
2023-07-05 12:36 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-05 17:17 ` Eric Abrahamsen
2023-07-05 18:50 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-05 19:07 ` Eric Abrahamsen
2023-07-15 0:59 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-15 1:26 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-18 17:32 ` Eric Abrahamsen
2023-07-19 4:37 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-19 15:39 ` Eric Abrahamsen
2023-12-08 3:31 ` Husain Alshehhi
2023-12-08 3:31 ` Husain Alshehhi
[not found] ` <875y1974k0.fsf@>
2023-12-08 9:32 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-08 16:01 ` Eric Abrahamsen
2023-12-08 16:26 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-09 11:03 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-09 13:59 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-12 18:08 ` Eric Abrahamsen
2023-12-16 15:14 ` Thomas Fitzsimmons
2023-12-17 0:13 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-17 12:10 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-17 15:55 ` Thomas Fitzsimmons
2023-12-17 16:15 ` Eric Abrahamsen
2023-12-17 20:27 ` Eric Abrahamsen
2024-02-02 1:35 ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-04 12:38 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-07 17:49 ` bug#64202: bug#66188: 29.1; Include Atom feed reader Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-08 4:27 ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-08 11:42 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-09 3:54 ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-09 14:01 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-09 20:06 ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-09 22:34 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-10 0:15 ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-22 2:17 ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-22 17:10 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-23 16:27 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-24 14:49 ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-27 5:02 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-03 2:40 ` James Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-18 16:58 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-24 13:35 ` bug#64202: " Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-06 9:01 ` bug#66188: " Eli Zaretskii
2024-04-18 9:01 ` Eli Zaretskii
2024-04-21 0:46 ` Eric Abrahamsen
2024-04-21 18:41 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22 3:11 ` Eric Abrahamsen
2024-04-22 22:44 ` bug#64202: " Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-23 14:34 ` Eric Abrahamsen
2024-04-23 22:07 ` Daniel Semyonov via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-24 14:19 ` Eric Abrahamsen
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=87pm59984x.fsf@dsemy.com \
--to=bug-gnu-emacs@gnu.org \
--cc=64202@debbugs.gnu.org \
--cc=cohen@bu.edu \
--cc=daniel@dsemy.com \
--cc=eliz@gnu.org \
--cc=eric@ericabrahamsen.net \
--cc=larsi@gnus.org \
--cc=monnier@iro.umontreal.ca \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.