org-ql
org-ql copied to clipboard
Handle multiple buffers-or-files with `org-ql-view--complete-buffers-files`
Original issue: #227 Extending conversation from #228
From the original issue, there was an problem with the initial-input
for completing-read
. After testing a few things, an issue with the org-ql-view--complete-buffers-files
not supporting multiple files when trying to refresh org-ql-view
was found. Consequently the use of completing-read-multiple
was proposed in #228.
The refactor of the org-ql-view--complete-buffers-files
entails the following:
- [ ] Use
completing-read-multiple
inorg-ql-view--complete-buffers-files
- [ ] Refactor
org-ql-view--contract-buffers-files
to allow displayingbuffers-or-files
in the view buffer- All file names and buffers/buffer-names are normalized to allow identifying duplicates.
- When a list is passed, if it's not one of the special cases (eg: "org-directory"), make sure it's a list of strings.
- Remove duplicate entries if there are any (in theory this should never happen?)
- If the value being contracted is a function and it resolves to the
org-agenda-files
function, contract to "org-agenda-files" instead of a function. - Expect the output of this function to be a list of strings, a string value, or a function.
- [ ] Refactor
org-ql-view--expand-buffers-files
to always return a list of string to allow displaying them in the view buffer- Resolve all values to a list of strings and ensure no unique values are present in them.
- Refactoring
org-ql-view--expand-buffers-files
will impactorg-ql-view--link-follow
in the following ways:- There is no need to test if the values returned by
org-ql-view--expand-buffers-files
is a buffer or string at https://github.com/alphapapa/org-ql/blob/31aeb0a2505acf8044c07824888ddec7f3e529c1/org-ql-view.el#L636 This will reflect in the test cases as well
- There is no need to test if the values returned by
Thanks. If we agree in #258 to require buffer arguments to be buffer objects rather than buffer names, that should simplify these changes a bit.
It would be great to have this feature.
I was looking at this function today. I wish there was a way to abstract this list into a variable:
(list 'buffer 'org-agenda-files 'org-directory 'all)
so one can add another list to it, either by providing a function or by an explicit list. From my experiments it is not as trivial as simply refactoring the variable.
We tried to solve it in #228 , didn't have the time to finish that. There were a few issues we hand't ironed out. I can revisit this when I have some time.