From 5a031bf5c19d274934f80d616d6fde62a6db5786 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Fri, 1 May 2020 06:20:46 -0500 Subject: [PATCH] Fix: (org-ql--select) Bind case-fold-search only around preamble Fixes #114. Thanks to @bitclick for reporting. Released as 0.4.5. --- README.org | 5 ++ org-ql.el | 14 ++--- org-ql.info | 124 ++++++++++++++++++++++++------------------- tests/test-org-ql.el | 7 +++ 4 files changed, 89 insertions(+), 61 deletions(-) diff --git a/README.org b/README.org index d6e654b..b272b15 100644 --- a/README.org +++ b/README.org @@ -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. +** 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 *Fixed* diff --git a/org-ql.el b/org-ql.el index aef1854..0307d78 100644 --- a/org-ql.el +++ b/org-ql.el @@ -2,7 +2,7 @@ ;; Author: Adam Porter ;; 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")) ;; 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))) nil) ;; Find matching entries. - (cond (preamble (let ((case-fold-search preamble-case-fold)) - (cl-loop while (re-search-forward preamble nil t) - do (outline-back-to-heading 'invisible-ok) - when (funcall predicate) - collect (funcall action) - do (outline-next-heading)))) + (cond (preamble (cl-loop while (let ((case-fold-search preamble-case-fold)) + (re-search-forward preamble nil t)) + do (outline-back-to-heading 'invisible-ok) + when (funcall predicate) + collect (funcall action) + do (outline-next-heading))) (t (cl-loop when (funcall predicate) collect (funcall action) while (outline-next-heading)))))))) diff --git a/org-ql.info b/org-ql.info index 5919d5e..b5d86ef 100644 --- a/org-ql.info +++ b/org-ql.info @@ -63,6 +63,7 @@ Functions / Macros Changelog +* 0.4.5: 045. * 0.4.4: 044. * 0.4.3: 043. * 0.4.2: 042. @@ -151,7 +152,8 @@ File: README.info, Node: Usage, Next: Changelog, Prev: Installation, Up: Top 4 Usage ******* - • • • • + • • + • • • • • Feedback on these APIs is welcome. Eventually, after being tested and polished, they will be considered stable. @@ -706,6 +708,7 @@ releases. * Menu: +* 0.4.5: 045. * 0.4.4: 044. * 0.4.3: 043. * 0.4.2: 042. @@ -721,9 +724,21 @@ releases. * 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* @@ -735,7 +750,7 @@ File: README.info, Node: 044, Next: 043, Up: Changelog  File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog -5.2 0.4.3 +5.3 0.4.3 ========= *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 -5.3 0.4.2 +5.4 0.4.2 ========= *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 -5.4 0.4.1 +5.5 0.4.1 ========= *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 -5.5 0.4 +5.6 0.4 ======= _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 -5.6 0.3.2 +5.7 0.3.2 ========= *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 -5.7 0.3.1 +5.8 0.3.1 ========= *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 -5.8 0.3 +5.9 0.3 ======= *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 -5.9 0.2.3 -========= +5.10 0.2.3 +========== *Fixed* • 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 -5.10 0.2.2 +5.11 0.2.2 ========== *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 -5.11 0.2.1 +5.12 0.2.1 ========== *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 -5.12 0.2 +5.13 0.2 ======== *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 -5.13 0.1 +5.14 0.1 ======== First tagged release. @@ -1108,44 +1123,45 @@ GPLv3  Tag Table: Node: Top225 -Node: Contents1462 -Node: Screenshots1636 -Node: Installation1754 -Node: Quelpa2392 -Node: Usage2835 -Node: Commands3163 -Node: org-ql-search3636 -Node: helm-org-ql5284 -Node: org-ql-view5696 -Node: org-ql-view-sidebar5894 -Node: org-ql-view-recent-items6250 -Node: org-ql-sparse-tree6734 -Node: Queries7534 -Node: Non-sexp query syntax8442 -Node: General predicates10149 -Node: Ancestor/descendant predicates14956 -Node: Date/time predicates16084 -Node: Functions / Macros18739 -Node: Agenda-like views18972 -Node: Listing / acting-on results20377 -Node: Changelog24979 -Node: 04425568 -Node: 04325913 -Node: 04226108 -Node: 04126267 -Node: 0426506 -Node: 03230437 -Node: 03130814 -Node: 0331009 -Node: 02333982 -Node: 02234208 -Node: 02134476 -Node: 0234675 -Node: 0138710 -Node: Notes38811 -Node: Comparison with Org Agenda searches38973 -Node: org-sidebar39844 -Node: License40123 +Node: Contents1477 +Node: Screenshots1651 +Node: Installation1769 +Node: Quelpa2407 +Node: Usage2850 +Node: Commands3199 +Node: org-ql-search3672 +Node: helm-org-ql5320 +Node: org-ql-view5732 +Node: org-ql-view-sidebar5930 +Node: org-ql-view-recent-items6286 +Node: org-ql-sparse-tree6770 +Node: Queries7570 +Node: Non-sexp query syntax8478 +Node: General predicates10185 +Node: Ancestor/descendant predicates14992 +Node: Date/time predicates16120 +Node: Functions / Macros18775 +Node: Agenda-like views19008 +Node: Listing / acting-on results20413 +Node: Changelog25015 +Node: 04525619 +Node: 04425966 +Node: 04326323 +Node: 04226518 +Node: 04126677 +Node: 0426916 +Node: 03230847 +Node: 03131224 +Node: 0331419 +Node: 02334392 +Node: 02234620 +Node: 02134888 +Node: 0235087 +Node: 0139122 +Node: Notes39223 +Node: Comparison with Org Agenda searches39385 +Node: org-sidebar40256 +Node: License40535  End Tag Table diff --git a/tests/test-org-ql.el b/tests/test-org-ql.el index bf2340f..71c3ecf 100644 --- a/tests/test-org-ql.el +++ b/tests/test-org-ql.el @@ -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-expect ((or "Take over" "universe") :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")))) (describe "(scheduled)"