alphapapa / org-ql

A searching tool for Org-mode, including custom query languages, commands, saved searches and agenda-like views, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

joonro opened this issue · comments

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.

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).

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.

@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.

@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.

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

@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?

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

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

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