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

helm-org-ql doesn't seems to obey default predicate #316

Closed
joonro opened this issue Dec 5, 2022 · 9 comments
Closed

helm-org-ql doesn't seems to obey default predicate #316

joonro opened this issue Dec 5, 2022 · 9 comments

Comments

@joonro
Copy link

joonro commented Dec 5, 2022

Hi,

Thank you very much for org-ql, this quickly became my go-to search tool for my org files.

I'm mainly interested in using helm-org-ql-agenda-files, and this doesn't seems to obey default predicate of rifle. That is, I get very different results if I do rifle:term1,term2 VS. term1,term2.

@alphapapa
Copy link
Owner

Hi Joon,

Thanks for the kind words. I'm glad to hear that it's useful to you.

The helm-org-ql sources use the same function to convert non-sexp queries into sexp ones: org-ql--query-string-to-sexp:

(let* ((query (org-ql--query-string-to-sexp helm-pattern))

Here are some examples of how that converts queries:

(org-ql--query-string-to-sexp "term1,term2")
;; (rifle "term1")

(org-ql--query-string-to-sexp "rifle:term1,term2")
;; (rifle "term1" "term2")

(org-ql--query-string-to-sexp "term1 term2")
;; (and (rifle "term1") (rifle "term2"))

So in this case, since you're not specifying a predicate, you need not use a comma between terms.

FYI, you may also find the org-ql-find commands useful, e.g. org-ql-find-in-agenda is the non-Helm equivalent (not that I have anything against using Helm, of course).

@joonro
Copy link
Author

joonro commented Dec 6, 2022

Thanks for the quick reply! Hmm maybe there is something wrong with my setting, I'm definitively not getting the same results between rifle:term1,term2 and term1 term2.

One thing I noticed, though is that I'm getting a strange results from your org-ql--query-string-to-sexp examples. I'm getting the same results as you when I eval the first two ((org-ql--query-string-to-sexp "term1,term2") and (org-ql--query-string-to-sexp "rifle:term1,term2")). However, when I eval (org-ql--query-string-to-sexp "term1 term2"), I'm getting (and (rifle "term1") (rifle "erm2")) --- notice the missing t in term2. I wonder if this is the reason why I'm getting inconsistent results.

And for some reason when I try to use org-ql-find-in-agenda with a simple term, I'm getting Wrong type argument: markerp, nil error.

@akirak
Copy link
Contributor

akirak commented Dec 6, 2022

@joonro

I'm getting a strange results from your org-ql--query-string-to-sexp examples.

I experienced the same issue which I reported in #314. It's caused by a recent update in peg.el. If you can downgrade peg, it will resolve the issue.

@joonro
Copy link
Author

joonro commented Dec 6, 2022

@akirak thanks fro the info. Do you know the version number of peg.el that does not have the bug? I'm only seeing Other versions: 1.0.1 (gnu) when I click on it in my list-packages results.

@akirak
Copy link
Contributor

akirak commented Dec 6, 2022

@joonro peg-1.0 should work. You can download from ELPA or from emacsmirror.

@joonro
Copy link
Author

joonro commented Dec 6, 2022

@akirak Yes I manually installed peg-1.0 and now I'm getting consistent results between rifle:term1,term2 and term1 term2. Thank you very much! Btw, do you know if this is reported to peg?

@akirak
Copy link
Contributor

akirak commented Dec 6, 2022

Btw, do you know if this is reported to peg?

@joonro I found a thread in bug-gnu-emacs. Apparently, the recent change was made for a bug fix, which caused the issue in org-ql. I am not sure if this is a new bug or expected behavior (i.e. poor documentation or misinterpretation) https://lists.gnu.org/archive/html/bug-gnu-emacs/2022-11/msg01410.html

@alphapapa
Copy link
Owner

This should be fixed now. Please let me know if it works for you.

@joonro
Copy link
Author

joonro commented Dec 9, 2022

Yes thank you very much, I updated peg to 1.0.1 and it is working properly. Thank you very much!

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