【问题标题】:org-agenda buffer no longer shows agenda itemsorg-agenda 缓冲区不再显示议程项目
【发布时间】:2014-01-27 02:06:26
【问题描述】:

我最近决定重做整个组织设置并提高效率。我曾经在我的机器上到处都是 .org 文件,但现在它们位于 2 个文件夹中:

~/work/org
~/personal/org

我重置了 org-mode 查找议程文件的位置

;; set agenda files
(setq org-agenda-files (quote ("~/work/org"
                   "~/personal/org")))

但是,当我拉起待办事项列表 (C-c a t) 时,我收到以下表单错误:

Non-existent agenda file [filename]. [R]emove from list or [A]bort?

用于旧列表中的文件。如果我删除所有这些文件,我最终会得到一个 Org Agenda 缓冲区,它只显示:

Global list of TODO items of type: ALL
Available with `N r': (0)[ALL]

知道我做错了什么吗?

【问题讨论】:

  • 你在改变你的初始化文件后评估过setq org-agenda-files吗?
  • org-agenda-files的值。
  • 在相关线程中查看我的回答,讨论如何使用org-agenda-file-regexp 设置此变量:superuser.com/a/702079/206164
  • 大家好,感谢您的 cmets。是的,我对表达式进行了评估。如何准确检查org-agenda-files 的值?
  • 我上面的链接讨论了如何在每次需要使用同名函数时设置此变量。

标签: emacs org-mode


【解决方案1】:

确保您没有在 .Emacs 文件的“自定义”块中设置 org-agenda-files。这是常见的错误来源。

【讨论】:

  • 嘿@fniessen,我是emacs n00b。不确定“自定义”块是什么。能详细说明一下吗?
  • 在你的 .emacs 文件中寻找这样的块:(custom-set-variables ;; custom-set-variables 是由 Custom 添加的。;; 如果你手动编辑它,你可能会弄乱它起来,所以要小心。;;你的初始化文件应该只包含一个这样的实例。;;如果有多个,它们将无法正常工作。'(org-...))
  • 啊,我明白了。我有几行说(custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(org-agenda-files nil)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) 抱歉编辑不好。但这有帮助吗?
  • 是的,我想是的:您将 org-agenda-files 设置为 nil(即一个空列表)。注释该行——但请注意额外的括号,然后重新启动您的 Emacs。然后,您设置 org-agenda-files 的其他位置应该是权威的。
  • 嗨@fniessen,做到了!非常感谢:-)
【解决方案2】:

试试这个:

(setq org-agenda-files
      (append
       (file-expand-wildcards "~/work/org/*.org")
       (file-expand-wildcards "~/personal/org/*.org")))

【讨论】:

  • 嘿@artscan,我试过这个但仍然有同样的错误。有任何想法吗?我可以给你任何可能有助于找出问题所在的输出吗?
  • 给我命令(describe-variable 'org-agenda-files)的输出
  • 我做了M-x describe-variables org-agenda-files 并得到了org-agenda-files is a variable defined in 'org.el'. Its value is nil。这是你想要的吗?
  • 不应该为零,例如("~/work/org/emacs.org" "~/personal/org/budget.org" ...)。在我的例子中,函数 file-expand-wildcards 返回目录中的 .org 文件列表。您可以从(setq org-agenda-files (quote ("~/work/org/foo.org"))) 开始,应该得到...Its value is ("~/work/org/foo.org")
  • 嗨@artscan,我认为 fniessen 发现了问题所在(尽管我确信其他问题也有问题):-)