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

More native support for 'agenda symbol in org-ql-search #95

Closed
kisp opened this issue Feb 21, 2020 · 3 comments
Closed

More native support for 'agenda symbol in org-ql-search #95

kisp opened this issue Feb 21, 2020 · 3 comments
Labels

Comments

@kisp
Copy link

@kisp kisp commented Feb 21, 2020

It would be nice if org-ql-search would support passing 'agenda for its first argument BUFFERS-FILES more natively.

It seems that when called interactively, org-ql-search replaces 'agenda with a list of filenames as if it had been called with this list of filenames.

Instead, I would like *Org QL View: (todo)* to list in its header

Query:(todo) In:agenda

instead of showing me a very long list of filenames.

When called non-interactively, it would be nice, if I could run

(org-ql-search 'agenda '(todo))

instead of

(org-ql-search org-agenda-files '(todo))
@alphapapa

This comment has been minimized.

Copy link
Owner

@alphapapa alphapapa commented Feb 22, 2020

Hi Kilian,

IIUC there are a few separate ideas here:

  1. Instead, I would like Org QL View: (todo) to list in its header

Query:(todo) In:agenda

instead of showing me a very long list of filenames.

That should be doable. See function org-ql-view--header-line-format. It would probably be as simple as comparing the list of files to the value of org-agenda-files and the return value of (org-agenda-files) (note that that symbol has both a variable and a function value which are subtly different) and using one or the other, depending on whether they match.

  1. It seems that when called interactively, org-ql-search replaces 'agenda with a list of filenames as if it had been called with this list of filenames.

See function org-ql-view--complete-buffers-files. When the argument is agenda, the function org-agenda-files is called to get the list of files, which is passed to org-ql-search.

I probably don't want to change org-ql-search so that it accepts agenda as an argument directly, because this is currently handled by the interactive completion code. I think it's probably better if users who call org-ql-search non-interactively pass a list of files and buffers by using the appropriate variable or function. In other words, I think the "magic" should generally be contained within the interactive completion code. When writing Lisp code, it's not much more of a burden to type org-agenda-files instead of agenda, and I don't think the extra complexity would be worth it.

What do you think?

Thanks.

@kisp

This comment has been minimized.

Copy link
Author

@kisp kisp commented Feb 26, 2020

Hi, thanks for this great library and your extensive answer, which is very helpful for me. I am fine if you want to close the issue.

I remember now one more thing that made me wonder if things could behave differently.
Imagine I run M-x org-ql-search and interactively answer the prompts in the minibuffer. For the Buffers/files: prompt I enter agenda. Then I type C-x ESC ESC for repeat-complex-command and again I see this long list of filenames in the minibuffer, which is not so interesting to me and I would prefer to see just agenda.

@alphapapa alphapapa closed this in bfc56a2 Feb 28, 2020
@alphapapa

This comment has been minimized.

Copy link
Owner

@alphapapa alphapapa commented Feb 28, 2020

Hi Kilian,

Thanks for the kind words. And thanks for prodding me to do something about this. I came up with a fairly clean solution, and it also allows me to "contract" the list of files in the header line, which looks much better. I've tested it and it seems to work well. Please let me know what you think.

alphapapa added a commit that referenced this issue Feb 28, 2020
When offering completion of org-ql-view-buffers-files, and when
formatting it in the header line, use the "contracted" form when
possible (i.e. show "org-agenda-files" instead of a list of all the
expanded agenda file filenames).

Fixes #95.  Thanks to Kilian Sprotte (@kisp) for suggesting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.