-
Notifications
You must be signed in to change notification settings - Fork 109
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
org-ql-search.el: Extend org-dblock-write:org-ql to indicate query scope #212
Conversation
Hi, Thanks for your patience. This looks like a good start. I'll add some comments inline... |
`buffer' the current buffer | ||
`org-agenda-files' all agenda files | ||
`org-directory' all org files | ||
`(list-of-files ...)' a list of org files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm glad you listed these choices explicitly. However, this list-of-files one needs clarification: is it an arbitrary Lisp list? Arbitrary Lisp code? A list of strings? A list of symbols which may evaluate to strings? etc.
Of course, it should probably only accept one string or a list of strings; any other types of value or a list of any other types of value should be rejected. However, we might consider accepting variables and lists of variables, which would make it easier for the user to refer to sets of files.
Either way, we should be very careful to avoid security issues with executing arbitrary code when the block is updated. Please see the tests related to the other block arguments for examples.
(query (cl-etypecase query | ||
(string (org-ql--query-string-to-sexp query)) | ||
(string (org-ql--plain-query query)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change probably indicates that this patch is based on an outdated version of org-ql.
(list ;; SAFETY: Query is in sexp form: ask for confirmation, because it could contain arbitrary code. | ||
(org-ql--ask-unsafe-query query) | ||
query))) | ||
(columns (or columns '(heading todo (priority "P")))) | ||
(scope (cond ((listp scope) scope) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See first comment about arbitrary Lisp values.
(with-current-buffer (marker-buffer m) | ||
(save-excursion | ||
(goto-char m) | ||
(org-store-link nil nil)))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for these changes? They seem unrelated to the PR's purpose.
:where query | ||
:select '(org-element-headline-parser (line-end-position)) | ||
:select 'element-with-markers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change made?
This week started using |
This is meant to resolve #151.
Namely, it adds a ":scope" parameter that can be used to indicate the scope of the query (the
:from
portion). It is inspired by how this is done with org clock tables.I created this as a draft as it works functionally, but does not yet have tests. Happy to address any feedback.