lou <[email protected]> writes: >> Yeah. Looks like prefix is computed _before_ category is >> produced for >> agenda. So, org-agenda-get-category is too early to be useful. >> So you may need `org-agenda-with-point-at-orig-entry' as I said >> in the >> updated docstring. > > wrapping prefix-fn in `org-agenda-with-point-at-orig-entry' > produces an error (stacktrace is below). > > But it also does not make sense. If %(..) is evaluated in the > agenda buffer why does `buffer-file-name` point to the buffer of > the entry?
Hmm. Right. What I think happens is that *some* lines in agenda are computed inside Org buffer, but *some* are computed inside agenda buffer. Specifically, Org heading lines are computed inside Org buffers, while time indicators are inside agenda buffers (also, diary entries - inside diary buffers). So, it is more complex (as usual in agenda code). > Also calling `org-get-category` *gets* the category, it just > produces also a warning, while `org-agenda-get-category` returns > nil. To me this looks off. org-agenda-get-category looks inside agenda buffer, at the text properties set for agenda lines. If the text properties are empty (as they are before prefix is computed), it returns nil. org-get-category returns "???" when no category is found. > Note that the initial problem (the warning) only occurs with > timestamped entries on the current date. For any other kind of > Agenda entry calling `org-get-category` works completely without > issue. Likely because of time grid lines that are computed inside agenda buffer and also trigger prefix calculation. Without time grid, I expect most things to run inside Org buffer. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
