Gam*_*mbo 1 emacs org-mode atom-feed
我已使用以下代码成功将我的Gmail Atom Feed添加到组织文件中
(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"
)))
Run Code Online (Sandbox Code Playgroud)
典型的Gmail Atom Feed如下所示:
<?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</summary>
<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>
Run Code Online (Sandbox Code Playgroud)
当我点击Cc Cx g并输入我的凭据时,我会在我的.org文件中找到它
** TODO RE: URGENT URGENT
%summary
Run Code Online (Sandbox Code Playgroud)
不是Atom提要的实际摘要,应该写着"立即行动或世界将结束"
我已经阅读了org-feed.el中的文档,这一行让我相信我可以在我的模板中包含摘要XML项目%summary
.
从进料项的任何字段可以被内插到模板与
%name
,例如%title
,%description
,%pubDate
等.
我错了吗?有没有办法将摘要插入我的模板(最好不要修改org-feed.el)
任何帮手都会在谢谢和彩虹中淋浴
问题在于org-feed-parse-atom-entry.它不提供对所有xml元素的访问.
我通过以下建议成功地启用了摘要:
(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))
Run Code Online (Sandbox Code Playgroud)
另外,:item-full-text不是org-feed-alist的正确关键字.它是传递给各种函数的条目p列表中使用的键.
归档时间: |
|
查看次数: |
792 次 |
最近记录: |