0

I'm just looking to add files to my org-agenda-variable. I added a single file successfully but am unable to use multiple.

With the code below in my .emacs.el file, the agenda buffer shows 0 TODO's despite there being plenty in the files specified.

Am I using list wrong?

Per another question I checked and the code is not in the customize block.

(setq org-agenda-files (list "C:/Users/Hugh/Documents/CS/Org/todo_dissertation.org"
    "C:/Users/Hugh/Documents/CS/Org/todo_LT_misc.org"
    "C:/Users/Hugh/Documents/CS/Org/todo_ST_misc.org"
    "C:/Users/Hugh/Documents/CS/Org/todo_career.org"))

C-h v user-init-file gives:

Its value is "c:/Users/Hugh/AppData/Roaming/.emacs.el"

which is the file I'm editing.

M-x emacs-version returns:

GNU Emacs 26.1 (build 1, x86-64-w64-mingw32) of 2018-05-30

M-x org-version returns:

Org mode version 9.1.9 (release-9.1.9-65-g5e4542 @ c:/Users/Hugh/emacs/share/emacs/26.1/lisp/org/
  • Your usage of list is fine. What does M-: (mapcar #'file-readable-p org-agenda-files) say? (It should say (t t t t).) – Tobias Jun 18 at 10:06
  • nice, it says nil. I wasn't sure what to do without an error message. Must be a problem with one or more of the .org files? – Hugh_Kelley Jun 18 at 10:14
  • ok thanks, that was a typo but not an issue with the actual file – Hugh_Kelley Jun 18 at 10:36
  • Get the help for the variable user-init-file with C-h v user-init-file RET. I guess you put .emacs.el into your user directory but emacs expects the init file in some roaming directory. You can avoid that by setting the HOME environment variable. – Tobias Jun 18 at 10:39
  • hmm, maybe but I've successfully made other changes to the init file, and its saved in C:/Users/Hugh/AppData/Roaming so should be correct. – Hugh_Kelley Jun 18 at 10:44
0

Here's how I debugged this:

first, use C-H v user-init-file RET to check the location of the init file. There's a chance the wrong file is being edited.

Then use M-: (mapcar #'file-readable-p org-agenda-files) to check the status of the files listed in the org-agenda-files variable. If they're readable, the expression returns (t t) where there is a t for each readable file in the list.

Then, use the setq-loudly function to check the value of the org-agenda-files as emacs is initialized when emacs is restarted.

(defmacro setq-loudly (&rest var-val-seq) 
    "Set like `setq' the VAR-VAL-SEQ sequence and emit message." 
    (append '(progn) (cl-loop for var-val on var-val-seq by 'cddr collect 
        `(message "(setq %s %S)" (quote ,(car var-val)) (setq ,(car var-val) ,
            (cadr var-val)))) (last var-val-seq 2)))

finally, use (debug-on-variable-change 'org-agenda-files) in the init file. This will offer a debug buffer each time the variable is changed.

In my case, the init file called (setq org-agenda-files 'list( "path-string")) twice. Once where I added and edited it and once where customize had added it, setting it to nil

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.