You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Emacs org-contacts时触发integer-or-marker-p类型错误求助

org-contacts执行M-x org-contacts时触发wrong-type-argument错误

配置情况

从MELPA安装org-contacts后,配置如下:

(use-package org-contacts
   :ensure t
   :custom
   (org-contacts-files '("~/org/contacts.org")))

测试联系人条目

在~/org/contacts.org中添加了以下测试条目:

* Joe Blog
  :PROPERTIES:
  :TEL: +1 650 123 4567
  :EMAIL:    joeblog@gmail.com
  :URL:
  :NOTES: Nice Guy
  :END:

错误信息

执行M-x org-contacts命令时触发Lisp错误,调试回溯信息如下:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p (headline (:raw-value "Joe Blog" :begin 46 :end 212 :pre-blank 0 :contents-begin 57 :contents-end 212 :robust-begin nil :robust-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 46 :TEL "\+1 650 123 4567" :EMAIL "joeblog@gmail.com" :URL "" :NOTES "Nice Guy" :ID "e74e91ec-9d87-4624-8ef0-71d48dccf341" :title "Joe Blog" :mode first-section ...)))
org-entry-properties((headline (:raw-value "Joe Blog" :begin 46 :end 212 :pre-blank 0 :contents-begin 57 :contents-end 212 :robust-begin nil :robust-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 46 :TEL "\+1 650 123 4567" :EMAIL "joeblog@gmail.com" :URL "" :NOTES "Nice Guy" :ID "e74e91ec-9d87-4624-8ef0-71d48dccf341" :title "Joe Blog" :mode first-section ...)) standard)
org-contacts--candidate((headline (:raw-value "Joe Blog" :begin 46 :end 212 :pre-blank 0 :contents-begin 57 :contents-end 212 :robust-begin nil :robust-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 46 :TEL "\+1 650 123 4567" :EMAIL "joeblog@gmail.com" :URL "" :NOTES "Nice Guy" :ID "e74e91ec-9d87-4624-8ef0-71d48dccf341" :title "Joe Blog" :mode first-section ...)))
#f(compiled-function (headline) #<bytecode -0x16cf8aeb8c5a3451>)((headline (:raw-value "Joe Blog" :begin 46 :end 212 :pre-blank 0 :contents-begin 57 :contents-end 212 :robust-begin nil :robust-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 46 :TEL "\+1 650 123 4567" :EMAIL "joeblog@gmail.com" :URL "" :NOTES "Nice Guy" :ID "e74e91ec-9d87-4624-8ef0-71d48dccf341" :title "Joe Blog" :mode first-section ...)))
#f(compiled-function (--data) #<bytecode -0x1d67545669d4fcbf>)((headline (:raw-value "Joe Blog" :begin 46 :end 212 :pre-blank 0 :contents-begin 57 :contents-end 212 :robust-begin nil :robust-end nil :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 46 :TEL "\+1 650 123 4567" :EMAIL "joeblog@gmail.com" :URL "" :NOTES "Nice Guy" :ID "e74e91ec-9d87-4624-8ef0-71d48dccf341" :title "Joe Blog" :mode first-section ...)))
mapc(#f(compiled-function (--data) #<bytecode -0x1d67545669d4fcbf>) ((headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) ...))
#f(compiled-function (--data) #<bytecode -0x1d67545669d4fcbf>)((org-data (:begin 1 :contents-begin 1 :contents-end 79758 :end 79760 :robust-begin 3 :robust-end 79756 :post-blank 2 :post-affiliated 1 :path nil :mode org-data ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) ...))
org-element-map((org-data (:begin 1 :contents-begin 1 :contents-end 79758 :end 79760 :robust-begin 3 :robust-end 79756 :post-blank 2 :post-affiliated 1 :path nil :mode org-data ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) (headline ...) ...) headline #f(compiled-function (headline) #<bytecode -0x16cf8aeb8c5a3451>))
org-contacts--candidates(("~/org/contacts.org"))
org-contacts--return-candidates(("~/org/contacts.org"))
org-contacts()
funcall-interactively(org-contacts)
command-execute(org-contacts record)
execute-extended-command(nil "org-contacts" "org")
funcall-interactively(execute-extended-command nil "org-contacts" "org")
command-execute(execute-extended-command)

问题分析与解决建议

从回溯信息看,错误根源是org-entry-properties函数接收到了org-element的headline对象,而非预期的整数/标记位置。这是因为org-contacts版本与当前Org-mode不兼容:新版Org-mode的org-element-map返回元素对象,而旧版org-contacts仍期望接收位置参数。

解决方法:

  • 升级org-contacts到最新版本,确保适配当前Org-mode的API
  • 若升级后问题仍存在,可修改org-contacts--candidate函数,将headline对象转换为位置参数:把org-entry-properties的调用参数改为(org-element-property :begin headline),而非直接传入headline对象

内容的提问来源于stack exchange,提问作者belberg

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 02:22:01