Merge: v0.8.7

This commit is contained in:
Adam Porter 2024-06-26 11:32:45 -05:00
commit f24d93f038
6 changed files with 241 additions and 128 deletions

View file

@ -562,6 +562,16 @@ Nothing new yet.
Tagged v0.6.2, fixing a compilation warning.
** 0.8.7
*Fixes*
+ Timestamps with internal time ranges (e.g. ~<2024-06-26 10:00-11:00>~) are matched for simple queries. (This support is not yet comprehensive, e.g. a query that depends on the specific inner time range may not behave as expected. Previously such timestamps were not matched at all. See [[https://github.com/alphapapa/org-ql/pull/237][#237]] and [[https://github.com/alphapapa/org-ql/issues/371][#371]]. Thanks to [[https://github.com/yantar92][Ihor Radchenko]].)
+ Timestamps with day-of-the-week abbreviations are matched more flexibly (allowing, e.g. a period in French locales). (See [[https://github.com/alphapapa/org-ql/discussions/429][#429]], [[https://github.com/alphapapa/org-ql/issues/432][#432]]. Thanks to [[https://github.com/neurolit][Florian D.]] for reporting.)
+ Command ~org-ql-search~ did not narrow properly when called interactively.
*Compatibility*
+ Dynamic blocks work with Org 9.7. ([[https://github.com/alphapapa/org-ql/issues/431][#431]]. Thanks to [[https://github.com/jezcope][Jez Cope]] for reporting.)
** 0.8.6
*Fixes*

View file

@ -186,7 +186,7 @@ necessary."
(interactive (list (org-ql-view--complete-buffers-files)
(read-string "Query: " (when org-ql-view-query
(format "%S" org-ql-view-query)))
:narrow (or org-ql-view-narrow (eq current-prefix-arg '(4)))
:narrow (or org-ql-view-narrow (equal current-prefix-arg '(4)))
:super-groups (org-ql-view--complete-super-groups)
:sort (org-ql-view--complete-sort)))
;; NOTE: Using `with-temp-buffer' is a hack to work around the fact that `make-local-variable'
@ -348,7 +348,8 @@ this (must be a single line in the Org buffer):
(org-element-property (intern (concat ":" (upcase property))) element)))))
(elements (org-ql-query :from (current-buffer)
:where query
:select '(org-element-headline-parser (line-end-position))
:select '(org-ql-view--resolve-element-properties
(org-element-headline-parser (line-end-position)))
:order-by sort)))
(when take
(setf elements (cl-etypecase take

View file

@ -157,10 +157,9 @@ This list should not contain any duplicates."))
(defvar org-ql-regexp-part-ts-date
(rx (repeat 4 digit) "-" (repeat 2 digit) "-" (repeat 2 digit)
;; Day of week
(optional " " (1+ alpha)))
(optional " " (1+ (or alpha punct))))
"Matches the inner, date part of an Org timestamp, both active and inactive.
Also matches optional day-of-week. Used to build other timestamp
regexps.")
Used to build other timestamp regexps.")
(defvar org-ql-regexp-part-ts-repeaters
;; Repeaters (not sure if the colon is necessary, but it's in the org.el one)
@ -170,7 +169,8 @@ regexps.")
Includes leading space character.")
(defvar org-ql-regexp-part-ts-time
(rx " " (repeat 1 2 digit) ":" (repeat 2 digit))
(rx " " (repeat 1 2 digit) ":" (repeat 2 digit)
(optional "-" (repeat 1 2 digit) ":" (repeat 2 digit)))
"Matches the inner, time part of an Org timestamp (i.e. HH:MM).
Includes leading space character. Used to build other timestamp
regexps.")

View file

@ -74,6 +74,7 @@ Functions / Macros
Changelog
* 0.9-pre: 09-pre.
* 0.8.7: 087.
* 0.8.6: 086.
* 0.8.5: 085.
* 0.8.4: 084.
@ -1045,6 +1046,7 @@ releases.
* Menu:
* 0.9-pre: 09-pre.
* 0.8.7: 087.
* 0.8.6: 086.
* 0.8.5: 085.
* 0.8.4: 084.
@ -1084,7 +1086,7 @@ releases.
* 0.1: 01.

File: README.info, Node: 09-pre, Next: 086, Up: Changelog
File: README.info, Node: 09-pre, Next: 087, Up: Changelog
5.1 0.9-pre
===========
@ -1104,9 +1106,37 @@ File: README.info, Node: helm-org-ql (1), Up: 09-pre
Tagged v0.6.2, fixing a compilation warning.

File: README.info, Node: 086, Next: 085, Prev: 09-pre, Up: Changelog
File: README.info, Node: 087, Next: 086, Prev: 09-pre, Up: Changelog
5.2 0.8.6
5.2 0.8.7
=========
*Fixes*
• Timestamps with internal time ranges (e.g. <2024-06-26
10:00-11:00>) are matched for simple queries. (This support is
not yet comprehensive, e.g. a query that depends on the specific
inner time range may not behave as expected. Previously such
timestamps were not matched at all. See #237
(https://github.com/alphapapa/org-ql/pull/237) and #371
(https://github.com/alphapapa/org-ql/issues/371). Thanks to Ihor
Radchenko (https://github.com/yantar92).)
• Timestamps with day-of-the-week abbreviations are matched more
flexibly (allowing, e.g. a period in French locales). (See #429
(https://github.com/alphapapa/org-ql/discussions/429), #432
(https://github.com/alphapapa/org-ql/issues/432). Thanks to
Florian D. (https://github.com/neurolit) for reporting.)
• Command org-ql-search did not narrow properly when called
interactively.
*Compatibility*
• Dynamic blocks work with Org 9.7. (#431
(https://github.com/alphapapa/org-ql/issues/431). Thanks to Jez
Cope (https://github.com/jezcope) for reporting.)

File: README.info, Node: 086, Next: 085, Prev: 087, Up: Changelog
5.3 0.8.6
=========
*Fixes*
@ -1116,7 +1146,7 @@ File: README.info, Node: 086, Next: 085, Prev: 09-pre, Up: Changelog

File: README.info, Node: 085, Next: 084, Prev: 086, Up: Changelog
5.3 0.8.5
5.4 0.8.5
=========
*Fixes*
@ -1133,7 +1163,7 @@ File: README.info, Node: 085, Next: 084, Prev: 086, Up: Changelog

File: README.info, Node: 084, Next: 083, Prev: 085, Up: Changelog
5.4 0.8.4
5.5 0.8.4
=========
*Fixes*
@ -1147,7 +1177,7 @@ File: README.info, Node: 084, Next: 083, Prev: 085, Up: Changelog

File: README.info, Node: 083, Next: 082, Prev: 084, Up: Changelog
5.5 0.8.3
5.6 0.8.3
=========
*Fixes*
@ -1160,7 +1190,7 @@ File: README.info, Node: 083, Next: 082, Prev: 084, Up: Changelog

File: README.info, Node: 082, Next: 081, Prev: 083, Up: Changelog
5.6 0.8.2
5.7 0.8.2
=========
*Fixes*
@ -1174,7 +1204,7 @@ File: README.info, Node: 082, Next: 081, Prev: 083, Up: Changelog

File: README.info, Node: 081, Next: 08, Prev: 082, Up: Changelog
5.7 0.8.1
5.8 0.8.1
=========
*Fixes*
@ -1189,7 +1219,7 @@ File: README.info, Node: 081, Next: 08, Prev: 082, Up: Changelog

File: README.info, Node: 08, Next: 074, Prev: 081, Up: Changelog
5.8 0.8
5.9 0.8
=======
*Additions*
@ -1245,8 +1275,8 @@ File: README.info, Node: 08, Next: 074, Prev: 081, Up: Changelog

File: README.info, Node: 074, Next: 073, Prev: 08, Up: Changelog
5.9 0.7.4
=========
5.10 0.7.4
==========
*Fixes*
• Ignore empty quoted strings in plain-string queries (#383
@ -1255,7 +1285,7 @@ File: README.info, Node: 074, Next: 073, Prev: 08, Up: Changelog

File: README.info, Node: 073, Next: 072, Prev: 074, Up: Changelog
5.10 0.7.3
5.11 0.7.3
==========
*Fixes*
@ -1273,7 +1303,7 @@ File: README.info, Node: 073, Next: 072, Prev: 074, Up: Changelog

File: README.info, Node: 072, Next: 071, Prev: 073, Up: Changelog
5.11 0.7.2
5.12 0.7.2
==========
*Fixes*
@ -1294,7 +1324,7 @@ File: README.info, Node: 072, Next: 071, Prev: 073, Up: Changelog

File: README.info, Node: 071, Next: 07, Prev: 072, Up: Changelog
5.12 0.7.1
5.13 0.7.1
==========
*Fixes*
@ -1313,7 +1343,7 @@ File: README.info, Node: 071, Next: 07, Prev: 072, Up: Changelog

File: README.info, Node: 07, Next: 063, Prev: 071, Up: Changelog
5.13 0.7
5.14 0.7
========
*Added*
@ -1372,7 +1402,7 @@ File: README.info, Node: 07, Next: 063, Prev: 071, Up: Changelog

File: README.info, Node: 063, Next: 062, Prev: 07, Up: Changelog
5.14 0.6.3
5.15 0.6.3
==========
*Fixed*
@ -1388,7 +1418,7 @@ File: README.info, Node: 063, Next: 062, Prev: 07, Up: Changelog

File: README.info, Node: 062, Next: 061, Prev: 063, Up: Changelog
5.15 0.6.2
5.16 0.6.2
==========
*Fixed*
@ -1399,7 +1429,7 @@ File: README.info, Node: 062, Next: 061, Prev: 063, Up: Changelog

File: README.info, Node: 061, Next: 06, Prev: 062, Up: Changelog
5.16 0.6.1
5.17 0.6.1
==========
*Fixed*
@ -1417,7 +1447,7 @@ File: README.info, Node: 061, Next: 06, Prev: 062, Up: Changelog

File: README.info, Node: 06, Next: 052, Prev: 061, Up: Changelog
5.17 0.6
5.18 0.6
========
*Added*
@ -1484,7 +1514,7 @@ File: README.info, Node: 06, Next: 052, Prev: 061, Up: Changelog

File: README.info, Node: 052, Next: 051, Prev: 06, Up: Changelog
5.18 0.5.2
5.19 0.5.2
==========
*Fixed*
@ -1495,7 +1525,7 @@ File: README.info, Node: 052, Next: 051, Prev: 06, Up: Changelog

File: README.info, Node: 051, Next: 05, Prev: 052, Up: Changelog
5.19 0.5.1
5.20 0.5.1
==========
*Fixed*
@ -1508,7 +1538,7 @@ File: README.info, Node: 051, Next: 05, Prev: 052, Up: Changelog

File: README.info, Node: 05, Next: 049, Prev: 051, Up: Changelog
5.20 0.5
5.21 0.5
========
*Added*
@ -1549,7 +1579,7 @@ File: README.info, Node: 05, Next: 049, Prev: 051, Up: Changelog

File: README.info, Node: 049, Next: 048, Prev: 05, Up: Changelog
5.21 0.4.9
5.22 0.4.9
==========
*Fixed*
@ -1560,7 +1590,7 @@ File: README.info, Node: 049, Next: 048, Prev: 05, Up: Changelog

File: README.info, Node: 048, Next: 047, Prev: 049, Up: Changelog
5.22 0.4.8
5.23 0.4.8
==========
*Fixed*
@ -1572,7 +1602,7 @@ File: README.info, Node: 048, Next: 047, Prev: 049, Up: Changelog

File: README.info, Node: 047, Next: 046, Prev: 048, Up: Changelog
5.23 0.4.7
5.24 0.4.7
==========
*Fixed*
@ -1585,7 +1615,7 @@ File: README.info, Node: 047, Next: 046, Prev: 048, Up: Changelog

File: README.info, Node: 046, Next: 045, Prev: 047, Up: Changelog
5.24 0.4.6
5.25 0.4.6
==========
*Fixed*
@ -1598,7 +1628,7 @@ File: README.info, Node: 046, Next: 045, Prev: 047, Up: Changelog

File: README.info, Node: 045, Next: 044, Prev: 046, Up: Changelog
5.25 0.4.5
5.26 0.4.5
==========
*Fixed*
@ -1610,7 +1640,7 @@ File: README.info, Node: 045, Next: 044, Prev: 046, Up: Changelog

File: README.info, Node: 044, Next: 043, Prev: 045, Up: Changelog
5.26 0.4.4
5.27 0.4.4
==========
*Fixed*
@ -1622,7 +1652,7 @@ File: README.info, Node: 044, Next: 043, Prev: 045, Up: Changelog

File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog
5.27 0.4.3
5.28 0.4.3
==========
*Fixed*
@ -1632,7 +1662,7 @@ File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog

File: README.info, Node: 042, Next: 041, Prev: 043, Up: Changelog
5.28 0.4.2
5.29 0.4.2
==========
*Fixed*
@ -1641,7 +1671,7 @@ File: README.info, Node: 042, Next: 041, Prev: 043, Up: Changelog

File: README.info, Node: 041, Next: 04, Prev: 042, Up: Changelog
5.29 0.4.1
5.30 0.4.1
==========
*Fixed*
@ -1651,7 +1681,7 @@ File: README.info, Node: 041, Next: 04, Prev: 042, Up: Changelog

File: README.info, Node: 04, Next: 032, Prev: 041, Up: Changelog
5.30 0.4
5.31 0.4
========
_Note:_ The next release, 0.5, may include changes which will require
@ -1732,7 +1762,7 @@ automatically, as they will be pushed to the master branch when ready.

File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog
5.31 0.3.2
5.32 0.3.2
==========
*Fixed*
@ -1745,7 +1775,7 @@ File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog

File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog
5.32 0.3.1
5.33 0.3.1
==========
*Fixed*
@ -1755,7 +1785,7 @@ File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog

File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog
5.33 0.3
5.34 0.3
========
*Added*
@ -1823,7 +1853,7 @@ File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog

File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog
5.34 0.2.3
5.35 0.2.3
==========
*Fixed*
@ -1833,7 +1863,7 @@ File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog

File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog
5.35 0.2.2
5.36 0.2.2
==========
*Fixed*
@ -1844,7 +1874,7 @@ File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog

File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog
5.36 0.2.1
5.37 0.2.1
==========
*Fixed*
@ -1854,7 +1884,7 @@ File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog

File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog
5.37 0.2
5.38 0.2
========
*Added*
@ -1937,7 +1967,7 @@ File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog

File: README.info, Node: 01, Prev: 02, Up: Changelog
5.38 0.1
5.39 0.1
========
First tagged release.
@ -2022,86 +2052,87 @@ GPLv3

Tag Table:
Node: Top225
Node: Contents2051
Node: Screenshots2178
Node: Installation2296
Node: Quelpa2810
Node: Helm support3338
Node: Usage3741
Node: Commands4139
Node: org-ql-find4604
Node: org-ql-open-link5512
Node: org-ql-refile6367
Node: org-ql-search6695
Node: helm-org-ql8626
Node: org-ql-view9004
Node: org-ql-view-sidebar9534
Node: org-ql-view-recent-items9914
Node: org-ql-sparse-tree10410
Node: Queries11210
Node: Non-sexp query syntax12327
Node: General predicates14086
Node: Ancestor/descendant predicates21011
Node: Date/time predicates22139
Node: Functions / Macros25263
Node: Agenda-like views25561
Ref: Function org-ql-block25723
Node: Listing / acting-on results26984
Ref: Caching27192
Ref: Function org-ql-select28105
Ref: Function org-ql-query30531
Ref: Macro org-ql (deprecated)32305
Node: Custom predicates32620
Ref: Macro org-ql-defpred32844
Node: Dynamic block36285
Node: Links39009
Node: Tips39696
Node: Changelog40020
Node: 09-pre40945
Node: helm-org-ql (1)41094
Node: 08641235
Node: 08541472
Node: 08442128
Node: 08342580
Node: 08242921
Node: 08143314
Node: 0843735
Node: 07446459
Node: 07346682
Node: 07247416
Node: 07148337
Node: 0749148
Node: 06352014
Node: 06252547
Node: 06152854
Node: 0653424
Node: 05256480
Node: 05156782
Node: 0557207
Node: 04958738
Node: 04859020
Node: 04759369
Node: 04659778
Node: 04560186
Node: 04460547
Node: 04360906
Node: 04261109
Node: 04161270
Node: 0461517
Node: 03265618
Node: 03166021
Node: 0366218
Node: 02369518
Node: 02269752
Node: 02170032
Node: 0270237
Node: 0174315
Node: Development74416
Node: Copyright assignment74649
Node: Notes75239
Node: Comparison with Org Agenda searches75403
Node: org-sidebar76292
Node: License76571
Node: Contents2065
Node: Screenshots2192
Node: Installation2310
Node: Quelpa2824
Node: Helm support3352
Node: Usage3755
Node: Commands4153
Node: org-ql-find4618
Node: org-ql-open-link5526
Node: org-ql-refile6381
Node: org-ql-search6709
Node: helm-org-ql8640
Node: org-ql-view9018
Node: org-ql-view-sidebar9548
Node: org-ql-view-recent-items9928
Node: org-ql-sparse-tree10424
Node: Queries11224
Node: Non-sexp query syntax12341
Node: General predicates14100
Node: Ancestor/descendant predicates21025
Node: Date/time predicates22153
Node: Functions / Macros25277
Node: Agenda-like views25575
Ref: Function org-ql-block25737
Node: Listing / acting-on results26998
Ref: Caching27206
Ref: Function org-ql-select28119
Ref: Function org-ql-query30545
Ref: Macro org-ql (deprecated)32319
Node: Custom predicates32634
Ref: Macro org-ql-defpred32858
Node: Dynamic block36299
Node: Links39023
Node: Tips39710
Node: Changelog40034
Node: 09-pre40973
Node: helm-org-ql (1)41122
Node: 08741263
Node: 08642494
Node: 08542728
Node: 08443384
Node: 08343836
Node: 08244177
Node: 08144570
Node: 0844991
Node: 07447715
Node: 07347940
Node: 07248674
Node: 07149595
Node: 0750406
Node: 06353272
Node: 06253805
Node: 06154112
Node: 0654682
Node: 05257738
Node: 05158040
Node: 0558465
Node: 04959996
Node: 04860278
Node: 04760627
Node: 04661036
Node: 04561444
Node: 04461805
Node: 04362164
Node: 04262367
Node: 04162528
Node: 0462775
Node: 03266876
Node: 03167279
Node: 0367476
Node: 02370776
Node: 02271010
Node: 02171290
Node: 0271495
Node: 0175573
Node: Development75674
Node: Copyright assignment75907
Node: Notes76497
Node: Comparison with Org Agenda searches76661
Node: org-sidebar77550
Node: License77829

End Tag Table

29
tests/data-ts.org Normal file
View file

@ -0,0 +1,29 @@
#+title: Timestamp-specific tests
/Timestamps in this file are active ones./
* Single-timestamp ranges
** Single-timestamp, without repeater
<2024-06-25 Tue 08:00-09:00>
** Single-timestamp, with repeater (deadline)
DEADLINE: <2024-06-25 Tue 08:00-09:00 ++7d>
* Multi-timestamp ranges
/Not sure that it would make sense to use repeaters for this kind of range./
** Multi-timestamp, without repeater
<2024-06-25 Tue 08:00>--<2024-06-26 Wed 08:00>
* Day-of-week abbreviations
** French
<2024-07-12 Fri>
* Canary
/This entry should never be matched./

View file

@ -1690,7 +1690,36 @@ with keyword arg NOW in PLIST."
(org-ql-expect ((org-ql--query-string-to-sexp "ts-active:with-time="))
'("Take over the universe" "Take over the world" "Visit Mars" "Visit the moon" "Practice leaping tall buildings in a single bound" "Get haircut" "Internet" "Spaceship lease" "Fix flux capacitor" "/r/emacs" "Shop for groceries" "Rewrite Emacs in Common Lisp"))
(org-ql-expect ((org-ql--query-string-to-sexp "ts-active:with-time=t"))
'("Skype with president of Antarctica" "Renew membership in supervillain club" "Order a pizza"))))
'("Skype with president of Antarctica" "Renew membership in supervillain club" "Order a pizza")))
(describe "matches timestamps with inner time ranges"
(before-each
(setq org-ql-test-buffer (org-ql-test-data-buffer "data-ts.org")
org-ql-test-num-headings (with-current-buffer org-ql-test-buffer
(org-with-wide-buffer
(goto-char (point-min))
;; Exclude the "Canary" heading.
(1- (cl-loop while (re-search-forward org-heading-regexp nil t)
sum 1))))))
(org-ql-it "without :with-time"
(org-ql-expect ('(ts-active))
'("Single-timestamp, without repeater" "Single-timestamp, with repeater (deadline)" "Multi-timestamp, without repeater" "French")))
(org-ql-it ":with-time t"
(org-ql-expect ('(ts-active :on "2024-06-25" :with-time t))
'("Single-timestamp, without repeater" "Single-timestamp, with repeater (deadline)" "Multi-timestamp, without repeater"))
(org-ql-expect ('(ts-active :on "2024-06-26" :with-time t))
'("Multi-timestamp, without repeater")))
(org-ql-it ":with-time t and with specified time value in :to"
(org-ql-expect ('(ts-active :to "2024-06-25 09:00" :with-time t))
'("Single-timestamp, without repeater" "Single-timestamp, with repeater (deadline)" "Multi-timestamp, without repeater"))
;; FIXME: The test below fails because timestamps with
;; ranges are not yet parsed into multiple timestamps and
;; compared as a range. This will have to be addressed in
;; a new version.
;; (org-ql-expect ('(ts-active :from "2024-06-25 08:30"))
;; '("Single-timestamp, without repeater" "Single-timestamp, with repeater (deadline)" "Multi-timestamp, without repeater"))
)))
(describe "inactive"
@ -1829,7 +1858,20 @@ with keyword arg NOW in PLIST."
'("Visit Mars")))
(org-ql-then (:now "2019-07-07")
(org-ql-expect ('(ts :on today))
nil)))))
nil))))
(describe "Day-of-week abbreviations"
(before-each
(setq org-ql-test-buffer (org-ql-test-data-buffer "data-ts.org")
org-ql-test-num-headings (with-current-buffer org-ql-test-buffer
(org-with-wide-buffer
(goto-char (point-min))
;; Exclude the "Canary" heading.
(1- (cl-loop while (re-search-forward org-heading-regexp nil t)
sum 1))))))
(org-ql-it "matches French abbreviations (with trailing period)"
(org-ql-expect ('(ts :on "2024-07-12"))
'("French")))))
(describe "Compound queries"