1

I'm having trouble getting Emacs to automatically include files in my org-mode agenda. I want files from two folders included, which I've attempted to do by setting

(setq org-agenda-files (list "~/Dropbox/journal" "~/Dropbox/notebooks"))

in my .emacs. In these two folders there are two types of files, eight-digit journal files and .orgfiles, all which I try to include through the following regular expression:

(setq org-agenda-file-regexp "\\`[^.].*\\.org\\|[0-9]\\{8\\}\\'")

However, when I start Emacs, only the files previously included through C-[ are available in my agenda. Does anyone have an idea as to what might be the problem here?

  • Your example works correctly -- verified by evaluating (org-agenda-files). If you evaluate (org-agenda-files), do you get a listing of all the files matching your regexp in the designated folders? Perhaps you haven't added your regexp to the auto-mode-alist and the org-agenda query fails because the file being queried is not in org-mode. Org-mode generally opens the file needed and performs an initial test to verify it is in org-mode, and this is established by the auto-mode-alist. – lawlist Mar 11 '15 at 17:17
  • @lawlist, thanks for your reply. Evaluating (org-agenda-files) returns merely the files added through C-[. My auto-mode-alist contains the regexp and its association with org-mode. (If I open the files through C-x C-f, the files are opened in org-mode.) – Tarjei Mar 12 '15 at 6:54
  • Your code works with no settings other than what is in your question, so perhaps you have other settings that are conflicting with it. Try a barebones installation of Emacs with the most recent public release, and only use your two lines of code and add a couple of files with eight-digit names to the Dropbox directories and then evaluate the function (org-agenda-files), not the variable -- it should work just fine under that scenario. Once you see that it works with nothing but the raw code, you can begin to track down what might be causing the conflict in your own particular setup. – lawlist Mar 12 '15 at 7:12
  • @lawlist, thanks, I'll try that. I was hoping there was some rudimentary thing I'd forgotten ... but I guess I'll start debugging. – Tarjei Mar 12 '15 at 7:14
  • @lawlist, I'm feeling less than very smart here, but is it sufficient to have the files associated with org-mode through auto-mode-alist, or do I specifically need a -*- mode:org -*- in every file I create for org mode? – Tarjei Mar 12 '15 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.