lou <[email protected]> writes:
You can use %c to insert category in agenda prefix. Calling
org-get-category directly is a mistake - the %(...) functions
are ran in agenda buffer, not in Org buffer, which
`org-get-category' expects.
I used `org-get-category` directly in the example as a minimal
case. My actual use case, that I think worked fine before, is
to
have a function that returns a dynamic prefix based on the
entries
category (but not necessarily the category itself). Is
something
like this supported at all?
You can use `org-agenda-get-category' from inside agenda buffer.
I think there's something not right here. If I evaluate this
modified example, again in `emacs -Q`
* This is a header with a timestamp
:PROPERTIES:
:CATEGORY: test
:END:
<2025-12-09 Di 12:00-14:00>
To Reproduce the warning the timestamp must be for the current day *and* have a
time component.
#+begin_src emacs-lisp
(setq org-agenda-files (list (buffer-file-name (current-buffer))))
(defun prefix-fn ()
(or (org-agenda-get-category)
buffer-file-name))
(setq org-agenda-prefix-format '((agenda . "%(prefix-fn)")))
(org-agenda)
#+end_src
#+RESULTS:
the agenda buffer shows the buffer-file-name *not* the category as
the prefix string. If the `%(..)` was evaluated in the agenda
buffer, that should be the other way around. Am I missing
something?
~lou