0

TLDR: Setting org-todo-keywords has broken org-agenda for me. How can I set this variable without the negative side-effects?

I am encountering three issues with org-agenda:

  1. When I invoke an org-agenda view that includes alltodo, or just pull up the all TODO view with t, no items show up. The only way I can get items to appear on the agenda is if I use a daily/weekly view and the items are scheduled in that time.
  2. Though I have a set of org-todo-keywords defined and C-h v on that variable shows the value I expect, attempting to cycle through TODO states in either the actual .org files or the agenda view will only progress through TODO, DONE, and an keyword-less state.
  3. When I set org-agenda-custom-commands that use org-super-agenda-groups, org-agenda does not respect these. No items that match the filters I've defined appear on the agenda, nor are any headings shown.

In my current configuration, if I set debug-on-entry for org-agenda-get-todos, then when I invoke the 'All TODOs' view (org-agenda + t), I see the following backtrace:

* org-agenda-get-todos()
  org-agenda-get-day-entries("/home/myUser/path/to/org/agenda.org" (6 29 2024) :todo)
  org-todo-list(nil)
  funcall-interactively(org-todo-list nil)
  call-interactively(org-todo-list)
  org-agenda(nil)
  funcall-interactively(org-agenda nil)
  call-interactively(org-agenda nil nil)
  command-execute(org-agenda)

It wasn't clear to me from this what the problem might be, but I thought there was something amiss in its only calling org-agenda-get-day-entries on one file. I tried to copy all of my TODO items to agenda.org from inbox.org, but this did not fix the issue at all.

So I decided to attempt a differential diagnosis. I booted up Emacs with the default settings. I set the following:

(setq org-directory (expand-file-name "~/path/to/org")) and booted up org-agenda. It successfully pulls up all the non-done TODO items in inbox.org. I experimented with copying some of these to other files in the directory, and it catches them all. So far, so good.

Next, I had a suspicion that the occasional message warning me of an org version conflict might have something to do with it, so in my scratch buffer I add the following configuration in, to mirror what I have in my main configuration:

(defvar bootstrap-version)
(let ((bootstrap-file
     (expand-file-name
      "straight/repos/straight.el/bootstrap.el"
      (or (bound-and-true-p straight-base-dir)
          user-emacs-directory)))
    (bootstrap-version 7))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
      (url-retrieve-synchronously
       "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
       'silent 'inhibit-cookies)
    (goto-char (point-max))
    (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'use-package)
(setq straight-use-package-by-default t)

(use-package org)

After I use straight-pull-all and eval-buffer, org-version returns 9.6.15, while my main config returns 9.8-pre. The All TODOs view still works in the scratch config at this point.

Next, I add in more of my current agenda-related config:

(setq org-agenda-files
      (mapcar 'file-truename
          (file-expand-wildcards
           (concat org-directory "/*.org")))
      org-agenda-hide-tags-regexp "."
      org-agenda-prefix-format
      '((agenda . " %i %-12:c%?-12t% s")
        (todo . " ")
        (tags . "%i %-12:c")
        (search . "%i %-12:c"))
      org-todo-keywords
      '((sequence
         "TRIAGE(t)"
         "BACKLOG(b)"
         "READY FOR WORK(r)"
         "TODAY(o)"
         "REVIEW(v)"
         "DONE(d)"))
      org-log-done 'time)

(define-key global-map (kbd "C-c a") 'org-agenda)

After applying these changes, everything still works just fine.

I add org-super-agenda and enable the mode:

(use-package org-super-agenda
  :init
  (org-super-agenda-mode))

And again, everything's working fine. Now, I add one of my org-super-agenda-based custom commands:

(setq org-agenda-custom-commands
      '(("p" "Personal Agenda"
     ((agenda "" ((org-agenda-span 'day)
              (org-super-agenda-groups
               '((:name "Today"
                  :time-grid t
                  :date today
                  :todo "TODAY"
                  :scheduled today
                  :order 1)))))
      (alltodo "" ((org-agenda-overriding-header "")
               (org-super-agenda-groups
             '((:name "Inbox"
                :tag "inbox"
                :order 1)
             (:name "Important"
                :priority "A"
                :order 2)
             (:name "Due Today"
                :deadline today
                :order 3)
             (:name "Overdue"
                :deadline past
                :order 4)
             (:name "Easy Wins"
                :tag "easy"
                :order 5))))))))

Now, at this stage what happens is that C-c a t for the all TODOs view still pulls in everything successfully, but if I enter C-c a p for the Personal Agenda view I've defined, the only part that works at all is the daily agenda block at the top. The alltodo section is utterly empty.

I remove all the org-super-agenda-groups definitions from the alltodo section so that the custom command looks like this:

(setq org-agenda-custom-commands
      '(("p" "Personal Agenda"
     ((agenda "" ((org-agenda-span 'day)
              (org-super-agenda-groups
               '((:name "Today"
                  :time-grid t
                  :date today
                  :todo "TODAY"
                  :scheduled today
                  :order 1)))))
      (alltodo "")))))

Now the pane below the agenda at least shows the title Global list of TODO items of type: ALL, but it still doesn't show any entries, even though I know the correct files are being read because there ARE entries in the day-agenda pane. Even if I reduce the Personal Agenda view to JUST (alltodo ""), it still doesn't grab anything.

Just to sanity-check, I try calling C-c a t again and now THAT is also not working, but now all of my org-todo-keywords are being respected. org-version is still reporting 9.6.15 for this scratch instance.

After further experimentation, adding and removing things, it turns out that the source of every problem was this:

(setq org-todo-keywords
      '((sequence
         "TRIAGE(t)"
         "BACKLOG(b)"
         "READY FOR WORK(r)"
         "TODAY(o)"
         "REVIEW(v)"
         "DONE(d)")))

Removing this and this alone makes the agenda behave exactly how I want it to, except that I now can't use the keyword rotation I want.

4
  • "I have verified that, given this configuration, org-agenda-files evaluates to the directory where the various files that I want to feed my agenda live" - it's probably irrelevant to your question, but that's not true: both the variable org-agenda-files and the function of the same name should evaluate to a list of all .org files in your org-directory. Check that inbox.org is a member of that list.
    – NickD
    Commented Jun 26 at 12:53
  • I think the syntax of FILETAGS requires the colons: #+FILETAGS: :inbox: - see Tag Inheritance in the manual. But I don't know if this will fix your problem. - After checking, no, this is wrong: it works either way.
    – NickD
    Commented Jun 26 at 13:02
  • 1
    Imprecise language on my part: org-agenda-files does indeed evaluate to a list of all .org files in org-directory, and inbox.org is a member of that list.
    – lmkerbey
    Commented Jun 26 at 14:07
  • If you are checking with C-c a a you have to make sure that there is a timestamp (plain, scheduled, or deadline) on the items that you expert to appear, and the timestamp has to be within the span of the agenda. If you are doing C-c a t, they show whether there is a timestamp or not. So AFAICT things work as they should. If it still does not work for you, please provide a step-by-step recipe that I can follow to try to reproduce your problem.
    – NickD
    Commented Jun 26 at 16:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.