Fix: (org-ql--def-query-string-to-sexp-fn) Updated for peg v1.0.1

Fixes #314, fixes #316.  Thanks to Akira Komamura (@akirak) and Joon
Ro (@joonro) for reporting.

Instead of `[blank]` in this PEX, it used to be `(syntax-class
whitespace)`, which worked fine with peg v1.0.  Then
<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59345> was filed and
resulted in the release of peg v1.0.1, after which that no longer
worked.  As best I can tell from reading the discussion, `[blank]` and
`(syntax-class whitespace)` should behave the same way, yet here they
do not: with peg v1.0.1, only `[blank]` works.  Why, I do not know; I
only tried it because I could find no explanation for the broken
behavior, and luckily, it works.  Maybe it's due to the use of
`(syntax-class whitespace)` later in the `pexs`; but since it finally
works again, let's take the victory as-is.
This commit is contained in:
Adam Porter 2022-12-08 19:50:37 -06:00
parent 85aee42fae
commit 9f00fa3890
3 changed files with 39 additions and 33 deletions

View file

@ -524,7 +524,8 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
** 0.6.3-pre
Nothing yet.
*Fixed*
+ Non-sexp query parsing with updated version 1.0.1 of the ~peg~ package. (Fixes [[https://github.com/alphapapa/org-ql/issues/314][#314]], [[https://github.com/alphapapa/org-ql/issues/316][#316]]. Thanks to [[https://github.com/akirak][Akira Komamura]] and [[https://github.com/joonro][Joon Ro]] for reporting.)
** 0.6.2

View file

@ -3,7 +3,7 @@
;; Author: Adam Porter <adam@alphapapa.net>
;; Url: https://github.com/alphapapa/org-ql
;; Version: 0.6.3-pre
;; Package-Requires: ((emacs "26.1") (dash "2.18.1") (f "0.17.2") (map "2.1") (org "9.0") (org-super-agenda "1.2") (ov "1.0.6") (peg "1.0") (s "1.12.0") (transient "0.1") (ts "0.2-pre"))
;; Package-Requires: ((emacs "26.1") (dash "2.18.1") (f "0.17.2") (map "2.1") (org "9.0") (org-super-agenda "1.2") (ov "1.0.6") (peg "1.0.1") (s "1.12.0") (transient "0.1") (ts "0.2-pre"))
;; Keywords: hypermedia, outlines, Org, agenda
;;; Commentary:
@ -854,8 +854,7 @@ value of `org-ql-predicates')."
;; obscure bug in `peg': when one keyword is a substring of another,
;; and the shorter one is listed first, the shorter one fails to match.
(-sort (-on #'> #'length))))
(pexs `((query (+ term
(opt (+ (syntax-class whitespace) (any)))))
(pexs `((query (+ (and term (* [blank]))))
(term (or (and negation (list positive-term)
;; This is a bit confusing, but it seems to work. There's probably a better way.
`(pred -- (list 'not (car pred))))

View file

@ -983,7 +983,13 @@ File: README.info, Node: 063-pre, Next: 062, Up: Changelog
5.1 0.6.3-pre
=============
Nothing yet.
*Fixed*
• Non-sexp query parsing with updated version 1.0.1 of the peg
package. (Fixes #314
(https://github.com/alphapapa/org-ql/issues/314), #316
(https://github.com/alphapapa/org-ql/issues/316). Thanks to Akira
Komamura (https://github.com/akirak) and Joon Ro
(https://github.com/joonro) for reporting.)

File: README.info, Node: 062, Next: 061, Prev: 063-pre, Up: Changelog
@ -1628,34 +1634,34 @@ Node: Links35679
Node: Tips36366
Node: Changelog36690
Node: 063-pre37461
Node: 06237569
Node: 06137878
Node: 0638446
Node: 05241500
Node: 05141800
Node: 0542223
Node: 04943752
Node: 04844032
Node: 04744379
Node: 04644788
Node: 04545196
Node: 04445557
Node: 04345916
Node: 04246119
Node: 04146280
Node: 0446527
Node: 03250628
Node: 03151031
Node: 0351228
Node: 02354528
Node: 02254762
Node: 02155042
Node: 0255247
Node: 0159325
Node: Notes59426
Node: Comparison with Org Agenda searches59588
Node: org-sidebar60477
Node: License60756
Node: 06237900
Node: 06138209
Node: 0638777
Node: 05241831
Node: 05142131
Node: 0542554
Node: 04944083
Node: 04844363
Node: 04744710
Node: 04645119
Node: 04545527
Node: 04445888
Node: 04346247
Node: 04246450
Node: 04146611
Node: 0446858
Node: 03250959
Node: 03151362
Node: 0351559
Node: 02354859
Node: 02255093
Node: 02155373
Node: 0255578
Node: 0159656
Node: Notes59757
Node: Comparison with Org Agenda searches59919
Node: org-sidebar60808
Node: License61087

End Tag Table