Emacs Org 模式提要不显示来自 gmail Atom 提要的电子邮件正文

发布于 2024-10-18 15:52:52 字数 2364 浏览 2 评论 0原文

我已使用以下代码成功将我的 Gmail Atom 提要提取到 org 文件中

(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"
)))

典型的 Gmail Atom 提要如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#">
<title>Gmail - Inbox for [email protected]</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/[email protected]&amp;message_id=654646578943541&amp;view=conv&amp;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>[email protected]</email>
</author>
</entry>

当我点击 Cc Cx g 并输入我的凭据时,我会在 .org 文件中得到此信息,

** TODO RE: URGENT URGENT
  %summary

而不是来自Atom feed 应该是“立即执行此操作,否则世界将终结”

我已阅读 org-feed.el 中的文档,这一行让我相信我可以使用 % 在我的模板中包含摘要 XML 项摘要

提要项目中的任何字段都可以插入到模板中 %name,例如%title%description%pubDate等。

我错了吗?有没有办法将摘要插入到我的模板中(最好不修改 org-feed.el)

任何帮助者都会受到感谢和彩虹的沐浴

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 [email protected]</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/[email protected]&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>[email protected]</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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

可爱暴击 2024-10-25 15:52:52

问题出在 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))

此外,:item-full-text 不是 org-feed-alist 的正确关键字。它是传递给各个函数的条目 p-list 中使用的键。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文