Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

emacs

org-mode

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?

like image 479
Daniel Dinnyes Avatar asked Apr 26 '16 19:04

Daniel Dinnyes


People also ask

How do you use Org mode?

To enable Org mode on your current document, type M-x org-mode which will enable the Org mode on the current document. Those are minuses, not underscores. MY PROJECT is the title of the document, this can be anything. This will enable Org mode for this document, no matter what the file-ending is.

How do you mark a todo as done in Org mode?

So, let's mark the TODO item DONE by moving the cursor onto that line and hitting C-c C-t, which runs the command org-todo. Notice how org-mode uses a timestamp to record when a TODO item was closed. Let's add some more TODO items.


1 Answers

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 ;)

like image 167
Daniel Dinnyes Avatar answered Oct 25 '22 21:10

Daniel Dinnyes