Fix: (org-ql--select) Bind case-fold-search only around preamble

Fixes #114.  Thanks to @bitclick for reporting.

Released as 0.4.5.
This commit is contained in:
Adam Porter 2020-05-01 06:20:46 -05:00
parent 4fef5b089f
commit 5a031bf5c1
4 changed files with 89 additions and 61 deletions

View file

@ -398,6 +398,11 @@ Expands into a call to ~org-ql-select~ with the same arguments. For convenience
/Note:/ Breaking changes may be made before version 1.0, but in the event of major changes, attempts at backward compatibility will be made with obsolescence declarations, translation of arguments, etc. Users who need stability guarantees before 1.0 may choose to use tagged stable releases. /Note:/ Breaking changes may be made before version 1.0, but in the event of major changes, attempts at backward compatibility will be made with obsolescence declarations, translation of arguments, etc. Users who need stability guarantees before 1.0 may choose to use tagged stable releases.
** 0.4.5
*Fixed*
+ Non-case-folding predicates like ~(todo)~ unnecessarily disabled case-folding for other predicates. ([[https://github.com/alphapapa/org-ql/issues/114][Issue #114]]. Thanks to [[https://github.com/bitclick][@bitclick]] for reporting.)
** 0.4.4 ** 0.4.4
*Fixed* *Fixed*

View file

@ -2,7 +2,7 @@
;; Author: Adam Porter <adam@alphapapa.net> ;; Author: Adam Porter <adam@alphapapa.net>
;; Url: https://github.com/alphapapa/org-ql ;; Url: https://github.com/alphapapa/org-ql
;; Version: 0.4.4 ;; Version: 0.4.5
;; Package-Requires: ((emacs "26.1") (dash "2.13") (dash-functional "1.2.0") (f "0.17.2") (org "9.0") (org-super-agenda "1.2-pre") (ov "1.0.6") (peg "0.6") (s "1.12.0") (ts "0.2-pre")) ;; Package-Requires: ((emacs "26.1") (dash "2.13") (dash-functional "1.2.0") (f "0.17.2") (org "9.0") (org-super-agenda "1.2-pre") (ov "1.0.6") (peg "0.6") (s "1.12.0") (ts "0.2-pre"))
;; Keywords: hypermedia, outlines, Org, agenda ;; Keywords: hypermedia, outlines, Org, agenda
@ -355,12 +355,12 @@ If NARROW is non-nil, buffer will not be widened."
(message "org-ql: No headings in buffer: %s" (current-buffer))) (message "org-ql: No headings in buffer: %s" (current-buffer)))
nil) nil)
;; Find matching entries. ;; Find matching entries.
(cond (preamble (let ((case-fold-search preamble-case-fold)) (cond (preamble (cl-loop while (let ((case-fold-search preamble-case-fold))
(cl-loop while (re-search-forward preamble nil t) (re-search-forward preamble nil t))
do (outline-back-to-heading 'invisible-ok) do (outline-back-to-heading 'invisible-ok)
when (funcall predicate) when (funcall predicate)
collect (funcall action) collect (funcall action)
do (outline-next-heading)))) do (outline-next-heading)))
(t (cl-loop when (funcall predicate) (t (cl-loop when (funcall predicate)
collect (funcall action) collect (funcall action)
while (outline-next-heading)))))))) while (outline-next-heading))))))))

View file

@ -63,6 +63,7 @@ Functions / Macros
Changelog Changelog
* 0.4.5: 045.
* 0.4.4: 044. * 0.4.4: 044.
* 0.4.3: 043. * 0.4.3: 043.
* 0.4.2: 042. * 0.4.2: 042.
@ -151,7 +152,8 @@ File: README.info, Node: Usage, Next: Changelog, Prev: Installation, Up: Top
4 Usage 4 Usage
******* *******
• • • • • •
• • • • •
Feedback on these APIs is welcome. Eventually, after being tested Feedback on these APIs is welcome. Eventually, after being tested
and polished, they will be considered stable. and polished, they will be considered stable.
@ -706,6 +708,7 @@ releases.
* Menu: * Menu:
* 0.4.5: 045.
* 0.4.4: 044. * 0.4.4: 044.
* 0.4.3: 043. * 0.4.3: 043.
* 0.4.2: 042. * 0.4.2: 042.
@ -721,9 +724,21 @@ releases.
* 0.1: 01. * 0.1: 01.
 
File: README.info, Node: 044, Next: 043, Up: Changelog File: README.info, Node: 045, Next: 044, Up: Changelog
5.1 0.4.4 5.1 0.4.5
=========
*Fixed*
• Non-case-folding predicates like (todo) unnecessarily disabled
case-folding for other predicates. (Issue #114
(https://github.com/alphapapa/org-ql/issues/114). Thanks to
@bitclick (https://github.com/bitclick) for reporting.)

File: README.info, Node: 044, Next: 043, Prev: 045, Up: Changelog
5.2 0.4.4
========= =========
*Fixed* *Fixed*
@ -735,7 +750,7 @@ File: README.info, Node: 044, Next: 043, Up: Changelog
 
File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog
5.2 0.4.3 5.3 0.4.3
========= =========
*Fixed* *Fixed*
@ -745,7 +760,7 @@ File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog
 
File: README.info, Node: 042, Next: 041, Prev: 043, Up: Changelog File: README.info, Node: 042, Next: 041, Prev: 043, Up: Changelog
5.3 0.4.2 5.4 0.4.2
========= =========
*Fixed* *Fixed*
@ -754,7 +769,7 @@ File: README.info, Node: 042, Next: 041, Prev: 043, Up: Changelog
 
File: README.info, Node: 041, Next: 04, Prev: 042, Up: Changelog File: README.info, Node: 041, Next: 04, Prev: 042, Up: Changelog
5.4 0.4.1 5.5 0.4.1
========= =========
*Fixed* *Fixed*
@ -764,7 +779,7 @@ File: README.info, Node: 041, Next: 04, Prev: 042, Up: Changelog
 
File: README.info, Node: 04, Next: 032, Prev: 041, Up: Changelog File: README.info, Node: 04, Next: 032, Prev: 041, Up: Changelog
5.5 0.4 5.6 0.4
======= =======
_Note:_ The next release, 0.5, may include changes which will require _Note:_ The next release, 0.5, may include changes which will require
@ -845,7 +860,7 @@ as they will be pushed to the master branch when ready.
 
File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog
5.6 0.3.2 5.7 0.3.2
========= =========
*Fixed* *Fixed*
@ -858,7 +873,7 @@ File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog
 
File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog
5.7 0.3.1 5.8 0.3.1
========= =========
*Fixed* *Fixed*
@ -868,7 +883,7 @@ File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog
 
File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog
5.8 0.3 5.9 0.3
======= =======
*Added* *Added*
@ -933,8 +948,8 @@ File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog
 
File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog
5.9 0.2.3 5.10 0.2.3
========= ==========
*Fixed* *Fixed*
• Priority queries could fail to match headings whose to-do keywords • Priority queries could fail to match headings whose to-do keywords
@ -943,7 +958,7 @@ File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog
 
File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog
5.10 0.2.2 5.11 0.2.2
========== ==========
*Fixed* *Fixed*
@ -954,7 +969,7 @@ File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog
 
File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog
5.11 0.2.1 5.12 0.2.1
========== ==========
*Fixed* *Fixed*
@ -964,7 +979,7 @@ File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog
 
File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog
5.12 0.2 5.13 0.2
======== ========
*Added* *Added*
@ -1047,7 +1062,7 @@ File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog
 
File: README.info, Node: 01, Prev: 02, Up: Changelog File: README.info, Node: 01, Prev: 02, Up: Changelog
5.13 0.1 5.14 0.1
======== ========
First tagged release. First tagged release.
@ -1108,44 +1123,45 @@ GPLv3
 
Tag Table: Tag Table:
Node: Top225 Node: Top225
Node: Contents1462 Node: Contents1477
Node: Screenshots1636 Node: Screenshots1651
Node: Installation1754 Node: Installation1769
Node: Quelpa2392 Node: Quelpa2407
Node: Usage2835 Node: Usage2850
Node: Commands3163 Node: Commands3199
Node: org-ql-search3636 Node: org-ql-search3672
Node: helm-org-ql5284 Node: helm-org-ql5320
Node: org-ql-view5696 Node: org-ql-view5732
Node: org-ql-view-sidebar5894 Node: org-ql-view-sidebar5930
Node: org-ql-view-recent-items6250 Node: org-ql-view-recent-items6286
Node: org-ql-sparse-tree6734 Node: org-ql-sparse-tree6770
Node: Queries7534 Node: Queries7570
Node: Non-sexp query syntax8442 Node: Non-sexp query syntax8478
Node: General predicates10149 Node: General predicates10185
Node: Ancestor/descendant predicates14956 Node: Ancestor/descendant predicates14992
Node: Date/time predicates16084 Node: Date/time predicates16120
Node: Functions / Macros18739 Node: Functions / Macros18775
Node: Agenda-like views18972 Node: Agenda-like views19008
Node: Listing / acting-on results20377 Node: Listing / acting-on results20413
Node: Changelog24979 Node: Changelog25015
Node: 04425568 Node: 04525619
Node: 04325913 Node: 04425966
Node: 04226108 Node: 04326323
Node: 04126267 Node: 04226518
Node: 0426506 Node: 04126677
Node: 03230437 Node: 0426916
Node: 03130814 Node: 03230847
Node: 0331009 Node: 03131224
Node: 02333982 Node: 0331419
Node: 02234208 Node: 02334392
Node: 02134476 Node: 02234620
Node: 0234675 Node: 02134888
Node: 0138710 Node: 0235087
Node: Notes38811 Node: 0139122
Node: Comparison with Org Agenda searches38973 Node: Notes39223
Node: org-sidebar39844 Node: Comparison with Org Agenda searches39385
Node: License40123 Node: org-sidebar40256
Node: License40535
 
End Tag Table End Tag Table

View file

@ -707,6 +707,13 @@ RESULTS should be a list of strings as returned by
(org-ql-it "with two plain strings in an OR" (org-ql-it "with two plain strings in an OR"
(org-ql-expect ((or "Take over" "universe") (org-ql-expect ((or "Take over" "universe")
:sort todo) :sort todo)
'("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut")))
(org-ql-it "case-folding predicate with non-case-folding preamble"
;; e.g. the (todo) predicate disables case-folding in its preamble, but that
;; should not prevent case-folding in this and other predicates (issue #114).
(org-ql-expect ((and (todo "TODO") (regexp "take over"))
:sort todo)
'("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut")))) '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut"))))
(describe "(scheduled)" (describe "(scheduled)"