Come get your sexp strings. Sexp strings going once, sexp string going twice...
I Wanted to have a convenient way to write elisp expressions as a string. Keeping track of parenthesises doesn't make for a good user interface. Based on org-ql's method.
Convert to and from a string to a boolean elisp expression.
For example,
"tag:tag1,tag2 title:title1,title2 query1 query2 `or `(query3 `and query4 `) query5 (to be, or not to be? to not be!)"
matches the following under this predicate.
(and
(or
(and (tag "tag1" "tag2")
(title "title1" "title2")
(both "query1")
(both "query2"))
(and (both "query3")
(both "query4")))
(both "query5")
(both "(" "to")
(both "be" ",")
(both "or")
(both "not")
(both "to")
(both "be "?" ".")
(both "to")
(both "not")
(both "be" "!" ")"))
look at how org-roam-search uses sexp-string
.
The key functions are
sexp-string--query-string-to-sexp
sexp-string--query-sexp-to-string
sexp-string--transform-query
Two syntaxs are currently supported.
org-ql like syntax called sexp-string--custom-pexs
.
,
between args after predicates isand
.`or
isor
.`and
isand
.`(`)
are brackets.!
is negation.- E.g
"tag:tag1,tag2 title:title1,title2 query1 query2 `or `(query3 `and query4 `) query5 (to be, or not to be? to not be!)"
recoll like syntax (also Notmuch (Xapian) and Xesam) called sexp-string--recoll-pexs
.
,
between args in predicates isand
./
between args in predicates isor
.OR
isor
.AND
isand
.()
are brackets.-
is negation.- E.g
"tag:tag1,tag2/tag3 OR title:title1,title2 query1 query2 OR (query3 AND query4) query5 \"(to be, or not to be? to not be!)\""
Look at sexp-string--custom-pexs
to define your own.
I know I know, these are all my packages. I don't know any one that uses this package yet.