Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle multiple buffers-or-files with org-ql-view--complete-buffers-files #260

Open
3 tasks
ahmed-shariff opened this issue Oct 10, 2021 · 3 comments
Open
3 tasks
Milestone

Comments

@ahmed-shariff
Copy link

ahmed-shariff commented Oct 10, 2021

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 in org-ql-view--complete-buffers-files
  • Refactor org-ql-view--contract-buffers-files to allow displaying buffers-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 impact org-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
      (unless (or (bufferp buffers-files)

      This will reflect in the test cases as well
@alphapapa
Copy link
Owner

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.

@dmgerman
Copy link

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.

@ahmed-shariff
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants