Emacs Org mode feed does not display email body from gmail atom feed
I have successfully pulled my Gmail Atom feed into a org file with the following code
(setq org-feed-alist
'(("Mail Entries"
"http://mail.google.com/mail/feed/atom"
"~/org/feeds.org" "Mail Entries"
:parse-entry org-feed-parse-atom-entry
:parse-feed org-feed-parse-atom-feed
:item-full-text
:template "* TODO %title\n %summary\n"
)))
A typical Gmail Atom feed looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#">
<title>Gmail - Inbox for mail@gmail.com</title>
<tagline>New messages in your Gmail Inbox</tagline>
<fullcount>1</fullcount>
<link rel="alternate" href="http://mail.google.com/mail" type="text/html" />
<modified>2011-02-22T06:38:03Z</modified>
<entry>
<title>RE: URGENT URGENT</title>
<summary>Do this now or the world will end</summar开发者_如何学编程y>
<link rel="alternate" href="http://mail.google.com/mail?account_id=mail@gmail.com&message_id=654646578943541&view=conv&extsrc=atom" type="text/html" />
<modified>2011-02-21T21:30:18Z</modified>
<issued>2011-02-21T21:30:18Z</issued>
<id>tag:gmail.google.com,2003:104521846321321</id>
<author>
<name>me</name>
<email>mail@gmail.com</email>
</author>
</entry>
When I hit C-c C-x g and enter my credentials, I get this in my .org file
** TODO RE: URGENT URGENT
%summary
Not the actual summary from the Atom feed which should read "Do this now or the world will end"
I have read the documentation in org-feed.el, and this line lead me to believe I can just include the summary XML item in my template with %summary
.
Any fields from the feed item can be interpolated into the template with
%name
, for example%title
,%description
,%pubDate
etc.
Am I mistaken? Is there a way to insert the summary into my template (preferably without modifying org-feed.el)
Any helpers will be showered in thanks and rainbows
The problem is with org-feed-parse-atom-entry. It doesn't provide access to all of the xml elements.
I was successful in enabling the summary with this bit of advice:
(defadvice org-feed-parse-atom-entry (after org-feed-parse-atom-entry-summary activate)
;; Add <summary/> as :summary.
(let* ((entry (ad-get-arg 0))
(xml (car (read-from-string (plist-get entry :item-full-text)))))
(setq entry (plist-put entry :summary
(xml-substitute-special
(car (xml-node-children
(car (xml-get-children xml 'summary)))))))
entry))
Also, :item-full-text is not a proper keyword for org-feed-alist. It is the key used in the entry p-list that is passed to the various functions.
精彩评论