org-mode:如何正确捕获电子邮件地址?

发布于 2024-12-14 06:01:09 字数 1082 浏览 1 评论 0原文

我想使用组织模式捕获联系人(姓名、电子邮件地址等)并进行设置 .emacs 中的以下内容:

(setq org-capture-templates
      '(("t" "TODO in ~/org/agenda.org -> Tasks" entry (file+headline 
"~/org/agenda.org" "Tasks")
         "* TODO %?\nSCHEDULED: %^t\n%U %a")
        ("c" "Contact in ~/org/contacts.org -> Contact" entry (file+headline 
"~/org/contacts.org" "Contact")
         "* %?%(org-contacts-template-name) %^g
:PROPERTIES:
:EMAIL: %(org-contacts-template-email)
:URL:
:WORK:
:HOME:
:MOBILE:
:LOCATION:
:BIRTHDAY: 
:NOTE:
:END:")))

我可以使用抄送抄送轻松捕获联系人,它会提示输入姓名、标签和 电子邮件地址。但是,而不是像我获得的输出

* My contact                         :my.tag:
  :PROPERTIES:
  :EMAIL: address@hidden
  :URL:
  :WORK:
  :HOME:
  :MOBILE:
  :LOCATION:
  :BIRTHDAY: 
  :NOTE:
  :END:

* My contact                         :my.tag:
  :PROPERTIES:
  :EMAIL:
  :URL:
  :WORK:
  :HOME:
  :MOBILE:
  :LOCATION:
  :BIRTHDAY: 
  :NOTE:
  :EMAIL: address@hidden
  :END:

所以问题是第一个 :EMAIL: 被忽略,而是第二个 :EMAIL: 插入在 :END: 之前。我怎样才能获得正确的输出(如 如上所述)?

I would like to capture contacts (name, email address,..) with org-mode and thus setup
the following in .emacs:

(setq org-capture-templates
      '(("t" "TODO in ~/org/agenda.org -> Tasks" entry (file+headline 
"~/org/agenda.org" "Tasks")
         "* TODO %?\nSCHEDULED: %^t\n%U %a")
        ("c" "Contact in ~/org/contacts.org -> Contact" entry (file+headline 
"~/org/contacts.org" "Contact")
         "* %?%(org-contacts-template-name) %^g
:PROPERTIES:
:EMAIL: %(org-contacts-template-email)
:URL:
:WORK:
:HOME:
:MOBILE:
:LOCATION:
:BIRTHDAY: 
:NOTE:
:END:")))

I can easily capture contacts with C-c c c, it prompts for the name, a tag, and
the email address. However, instead of an output like

* My contact                         :my.tag:
  :PROPERTIES:
  :EMAIL: address@hidden
  :URL:
  :WORK:
  :HOME:
  :MOBILE:
  :LOCATION:
  :BIRTHDAY: 
  :NOTE:
  :END:

I obtain:

* My contact                         :my.tag:
  :PROPERTIES:
  :EMAIL:
  :URL:
  :WORK:
  :HOME:
  :MOBILE:
  :LOCATION:
  :BIRTHDAY: 
  :NOTE:
  :EMAIL: address@hidden
  :END:

So the problem is that the first :EMAIL: is ignored and instead a second
:EMAIL: is inserted before :END:. How can I obtain the correct output (as
described above)?

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

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

发布评论

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

评论(1

╰◇生如夏花灿烂 2024-12-21 06:01:09

sexp %(org-contacts-template-email) 在调用时实际上会创建一个 :EMAIL: 属性。如果将捕获模板更改为:

"* %?%(org-contacts-template-name) %^g
%(org-contacts-template-email)
:PROPERTIES:
:URL:
:WORK:
:HOME:
:MOBILE:
:LOCATION:
:BIRTHDAY: 
:NOTE:
:END:"

您将获得所需的输出。您也不需要 %? 除非您特别希望在退出捕获时将光标放置在联系人姓名之前。

The sexp %(org-contacts-template-email) will actually create a :EMAIL: property when called. If you change your capture template to:

"* %?%(org-contacts-template-name) %^g
%(org-contacts-template-email)
:PROPERTIES:
:URL:
:WORK:
:HOME:
:MOBILE:
:LOCATION:
:BIRTHDAY: 
:NOTE:
:END:"

You will get the desired output. You also don't need the %? unless you particularly want the cursor to be placed before the contact-name when capture is exited.

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