0

There's an interesting question about how to view the hierarchy of TODO keywords in org-agenda which shows two different approaches:

  • use the "%l" specifier in org-agenda-prefix-format

  • set org-tags-match-list-sublevels to 'indentation

But I can't seem to get either to work.

Using the first method:

(setq org-agenda-custom-commands
      '(("c" "My TODOs"
         ((tags-todo "mytag"
                     ((org-agenda-prefix-format " %e %l ")
                      (org-tags-match-list-sublevels t)))))))

I get a backtrace:

Debugger entered--Lisp error: (wrong-type-argument buffer-or-string-p 3)
  get-text-property(0 extra-space 3)
  (concat level "" (get-text-property 0 (quote extra-space) level))
  (if (equal level "") "" (concat level "" (get-text-property 0 (quote extra-space) level)))
  (format "%s" (if (equal level "") "" (concat level "" (get-text-property 0 (quote extra-space) level))))
  (format " %s %s %s " (format "%38s" (if (equal breadcrumbs "") "" (concat breadcrumbs "" (get-text-property 0 (quote extra-space) breadcrumbs)))) (format "%6s" (if (equal effort "") "" (concat effort "" (get-text-property 0 (quote extra-space) effort)))) (format "%s" (if (equal level "") "" (concat level "" (get-text-property 0 (quote extra-space) level)))))
  eval((format " %s %s %s " (format "%38s" (if (equal breadcrumbs "") "" (concat breadcrumbs "" (get-text-property 0 (quote extra-space) breadcrumbs)))) (format "%6s" (if (equal effort "") "" (concat effort "" (get-text-property 0 (quote extra-space) effort)))) (format "%s" (if (equal level "") "" (concat level "" (get-text-property 0 (quote extra-space) level))))))

The breadcrumb representation works, but...:

(setq org-agenda-custom-commands
      '(("c" "My TODOs"
         ((tags-todo "mytag"
                     ((org-agenda-prefix-format " %e %b ")
                      (org-tags-match-list-sublevels t)))))))

...my headlines are too long and/or nested to neatly fit on the screen using breadcrumbs.

The second method successfully indents the headlines using dots, but it also obliterates the effort times with spaces:

(setq org-agenda-custom-commands
      '(("c" "My TODOs"
         ((tags-todo "mytag"
                     ((org-agenda-prefix-format " %e ")
                      (org-tags-match-list-sublevels 'indented)))))))

I tried swapping out the effort for breadcrumbs:

(setq org-agenda-custom-commands
      '(("c" "My TODOs"
         ((tags-todo "mytag"
                     ((org-agenda-prefix-format " %b ")
                      (org-tags-match-list-sublevels 'indented)))))))

...and that is not obliterated - it shows the breadcrumbs, then indentation dots, then TODO keyword and headline.

Have I just unluckily run into two different bugs or have I done something stupid? I want mytag TODOs with effort and indentation.

GNU Emacs 24.4.1

org 8.2.10

0

Here is a workaround using the %(expression) syntax:

(defun my-agenda-prefix ()
  (format "%s" (my-agenda-indent-string (org-current-level))))

(defun my-agenda-indent-string (level)
  (if (= level 1)
      ""
    (let ((str ""))
      (while (> level 2)
        (setq level (1- level)
              str (concat str "──")))
      (concat str "►"))))

(setq org-agenda-custom-commands
      '(("c" "My TODOs"
         ((tags-todo "mytag"
                     ((org-agenda-prefix-format " %e %(my-agenda-prefix) ")
                      (org-tags-match-list-sublevels t)))))))

Not that there is a third bug or oddity here: you can only use %(expression) once, so any other customisations should be added to my-agenda-prefix.

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.