org-ql-search.el: Extend org-dblock-write:org-ql to indicate query scope#212
org-ql-search.el: Extend org-dblock-write:org-ql to indicate query scope#212rekahsoft wants to merge 1 commit intoalphapapa:masterfrom
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.
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.
| (-let* (((&plist :scope :query :columns :sort :ts-format :take) params) | ||
| (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.
This change probably indicates that this patch is based on an outdated version of org-ql.
| (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.
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.
What's the reason for these changes? They seem unrelated to the PR's purpose.
| (elements (org-ql-query :from scope | ||
| :where query | ||
| :select '(org-element-headline-parser (line-end-position)) | ||
| :select 'element-with-markers |
|
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
:fromportion). 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.