How to add .org files under org-directory to agenda

一曲冷凌霜 提交于 2019-12-04 22:11:39

问题


I am facing the following problem: Org mode has the customizable variable org-agenda-files. The files listed by absolute path under this variable are used for building the org agenda window. If an element in the list is a directory, then all .org files matching the org-agenda-regex are processed to build the agenda view. On the other hand there is also another customizable variable: org-directory. Shockingly though, if org-agenda-files is undefined, the agenda view does not try to use the matching .org files under org-directory. Also, listing the paths of the agenda files relative to org-directory in org-agenda-files is not accepted, as it complains that the files are not found.

My question is, is there an reasonably elegant way to make use of the org-directory in the lookup of agenda files, either by using it as the default to look for all .org files, or to describe the agenda files list with relative paths to org-directory?


回答1:


Actually just managed to get it working the way I wanted. So this is how the relevant config code should look like:

(custom-set-variables
 '(org-directory "~/Documents/org")
 '(org-agenda-files (list org-directory)))

This way the agenda reads from all .org files under the org-directory, and when org-directory changes it follows it. Just what I was looking for ;)



来源:https://stackoverflow.com/questions/36873628/how-to-add-org-files-under-org-directory-to-agenda

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!