pinmacs <[email protected]> writes: > So the motivation is that I would like to have a propview to count > diversity of nutrients, as properties, to be parsed from my diary, and I > would like to use scope as a function like my/this-week: > > #+BEGIN: propview :scope my/this-week :match "nutrition" (...) > #+END: > > where my/this-week would be defined as: > > (defun my/this-week() > (concat "file:~/org/mydiary.org::#" (format-time-string "%Y-w%W")))
Note that propview dynamic block is not a part of Org mode. It is defined in org-collector - a minimally maintained package in org-contrib. > Extending the links in the way I propose, provides more flexibility for > users, it would work whatever link they defined. I think that is it easy to extend `org-dblock-write:propview' to handle scope argument specially when it is a function, jumping to location as you describe. > The proposal to extend on org-map-entries directly, is because is a > well-known method used to retrieve information, the examples I know are > org-kanban, propview AFAIU, you propose SCOPE argument of `org-map-entries' to be a function that will return a link that should then be followed and narrowed like SCOPE='tree. This sounds very specialized. Also, SCOPE argument is already confusing - it serves dual-purpose setting both files to scan and also local narrowing. Not to mention some undocumented features, like SCOPE=(my/list-of-files) being called dynamically to determine the file list. I am not a big fan of complicating org-map-entries even further. I hope we can eventually get org-ql into the core to make a more consistent API for mapping. > [2] > (if (functionp scope) > (let* ((result (funcall scope))) > (save-window-excursion (org-link-open-from-string result) > (org-map-entries 'org-kanban//todo-info-extract match 'tree))) > (org-map-entries 'org-kanban//todo-info-extract match scope))) > This solution looks much more sensible to me. Rather than modifying org-map-entries, modify the dynamic block function and call org-map-entries in correct context from there. -- 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>
