Release: v0.7.2

-----BEGIN PGP SIGNATURE-----
 
 iF0EABECAB0WIQRibGN7s6Ag030zGsLn4Z3JMOysmwUCZRO8JAAKCRDn4Z3JMOys
 mxpgAKDB9mCBhmsIfMAgQVRCcAOjBu6A7gCfQRSwZyBQYXIFwJ/y9JA2Ftpkafw=
 =w2+9
 -----END PGP SIGNATURE-----

Merge tag 'v0.7.2'

Release: v0.7.2

# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRibGN7s6Ag030zGsLn4Z3JMOysmwUCZRO8JAAKCRDn4Z3JMOys
# mxpgAKDB9mCBhmsIfMAgQVRCcAOjBu6A7gCfQRSwZyBQYXIFwJ/y9JA2Ftpkafw=
# =w2+9
# -----END PGP SIGNATURE-----
# gpg: directory '/data/data/com.termux/files/home/.gnupg' created
# gpg: Signature made 2023-09-27 07:22:44 +0200 CEST
# gpg:                using DSA key 626C637BB3A020D37D331AC2E7E19DC930ECAC9B
# gpg: Can't check signature: No public key
This commit is contained in:
Bram Schoenmakers 2023-10-03 19:05:42 +02:00
commit 9496ad3c20
7 changed files with 341 additions and 285 deletions

View file

@ -1,7 +1,6 @@
#+TITLE: org-ql
# NOTE: Using =BEGIN_HTML= for this causes TeX/info export to fail, but this HTML block works.
# #+HTML: <a href=https://alphapapa.github.io/dont-tread-on-emacs/><img src="images/dont-tread-on-emacs-150.png" align="right"></a>
#+HTML: <img src="images/dog.png" align="right">
# NOTE: To avoid having this in the info manual, we use HTML rather than Org syntax; it still appears with the GitHub renderer.
@ -543,10 +542,21 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
/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.7.1-pre
** 0.7.2
*Fixes*
+ Timestamp predicates are more tolerant of partial input (e.g. preventing errors while the user is typing a query into ~org-ql-find~).
+ Query parser ignores leading whitespace (e.g. preventing errors while the user is typing a query into ~org-ql-find~).
+ Use of ~org-ql-find~ with ~:query-prefix~ argument prevented selection of results. ([[https://github.com/alphapapa/org-ql/issues/351][#351]]. Thanks to [[https://github.com/danielfleischer][Daniel Fleischer]] for reporting.)
+ Handle narrowed buffers correctly in ~org-ql-find~.
+ Warn about empty headings in ~org-ql-completing-read~ (the Org format allows a heading line to have no text, but it's useless for this purpose, and usually indicates unnoticed corruption).
** 0.7.1
*Fixes*
+ Function ~org-ql-completing-read~ is more compatible with default Emacs completion. (See [[https://github.com/alphapapa/org-ql/issues/338][#338]]. Thanks to [[https://github.com/arozbiz][arozbiz]] for reporting.)
+ Function ~org-ql-completing-read~ would sometimes stop updating with changes in input. (See [[https://github.com/alphapapa/org-ql/issues/350][#350]]. Thanks to [[https://github.com/anpandey][Ankit Raj Pandey]] for reporting and fixing, and to [[https://github.com/minad][Daniel Mendler]] for advising.)
+ In ~org-ql-completing-read~, format links for display, and use ~org-entry-get~ internally rather than ~org-get-heading~.
** 0.7

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

View file

@ -116,14 +116,21 @@ single predicate)."
;; without properties, so we have to use `org-get-heading', which added additional
;; optional arguments in a certain Org version, so in those versions, it will
;; return priority cookies and comment strings.
(let ((heading (org-get-heading t t)))
(let ((heading (org-link-display-format (org-entry-get (point) "ITEM"))))
(if (string-empty-p heading)
;; A heading's string can be empty, but we can't use one because it
;; wouldn't be useful to the user; and if one is found, it's very
;; likely to indicate an unnoticed mistake or corruption in the
;; file: so display a warning and don't record it as a candidate.
(warn "Empty heading at %S in %S" (point) (buffer-name))
(when (gethash heading table)
;; Disambiguate heading (even adding the path isn't enough, because that could
;; also be duplicated).
(if-let ((suffix (gethash heading disambiguations)))
(setf heading (format "%s <%s>" heading (cl-incf suffix)))
(setf heading (format "%s <%s>" heading (puthash heading 2 disambiguations)))))
(puthash heading (point-marker) table)))
(let ((marker (point-marker)))
(puthash (propertize heading 'org-marker marker) marker table)))))
(path (marker)
(org-with-point-at marker
(let* ((path (thread-first (org-get-outline-path nil t)
@ -140,7 +147,7 @@ single predicate)."
(affix (completions)
;; (debug-message "AFFIX:%S" completions)
(cl-loop for completion in completions
for marker = (gethash completion table)
for marker = (get-text-property 0 'org-marker completion)
for prefix = (todo marker)
for suffix = (concat (path marker) " " (snippet marker))
collect (list completion prefix suffix)))
@ -150,7 +157,7 @@ single predicate)."
;; Using `while-no-input' here doesn't make it as responsive as,
;; e.g. Helm while typing, but it seems to help a little when using the
;; org-rifle-style snippets.
(or (snippet (gethash candidate table)) "")))
(or (snippet (get-text-property 0 'org-marker candidate)) "")))
(snippet
(marker) (when-let
((snippet
@ -161,7 +168,7 @@ single predicate)."
'face 'org-ql-completing-read-snippet)))
(group (candidate transform)
(pcase transform
(`nil (buffer-name (marker-buffer (gethash candidate table))))
(`nil (buffer-name (marker-buffer (get-text-property 0 'org-marker candidate))))
(_ candidate)))
(try (string _collection _pred point &optional _metadata)
;; (debug-message "TRY: STRING:%S" string)
@ -171,8 +178,6 @@ single predicate)."
;; (debug-message "all-completions RETURNS: %S" (all-completions string table pred))
(all-completions string table pred))
(collection (input _pred flag)
(when query-prefix
(setf input (concat query-prefix input)))
(pcase flag
('metadata (list 'metadata
(cons 'group-function #'group)
@ -223,6 +228,8 @@ single predicate)."
`(boundaries 0 . ,(length suffix)))))
(run-query (input)
;; (debug-message "RUN-QUERY:%S" input)
(when query-prefix
(setf input (concat query-prefix input)))
(unless (or (string-empty-p input)
(equal last-input input))
;; (debug-message "RUN-QUERY:%S RUNNING" input)

View file

@ -83,8 +83,7 @@ single predicate)."
:query-prefix query-prefix
:query-filter query-filter
:prompt prompt)))
(with-current-buffer (marker-buffer marker)
(goto-char marker)
(org-with-point-at marker
(display-buffer (current-buffer) org-ql-find-display-buffer-action)
(select-window (get-buffer-window (current-buffer)))
(run-hook-with-args 'org-ql-find-goto-hook))))

View file

@ -4,7 +4,7 @@
;; Author: Adam Porter <adam@alphapapa.net>
;; Url: https://github.com/alphapapa/org-ql
;; Version: 0.7.1-pre
;; Version: 0.7.2
;; 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
@ -76,6 +76,7 @@ Tags are stored in match group 1. Match group 2 stores the tags
without the enclosing colons.")
(defvaralias 'org-ql-link-regexp
;; FIXME: `org-link-bracket-re' is void until `org-link-make-regexps' is called.
(if (bound-and-true-p org-link-bracket-re)
'org-link-bracket-re
'org-bracket-link-regexp)
@ -944,7 +945,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 (+ (and term (* [blank]))))
(pexs `((query (and (* [blank]) (+ (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))))
@ -1285,6 +1286,9 @@ result form."
to on))
(when from
(setq from (pcase from
("-"
;; Ignore, because it means the user is typing a negative number.
nil)
((or 'today "today") (->> (ts-now)
(ts-apply :hour 0 :minute 0 :second 0)))
((pred numberp) (->> (ts-now)
@ -1301,6 +1305,9 @@ result form."
((pred ts-p) from))))
(when to
(setq to (pcase to
("-"
;; Ignore, because it means the user is typing a negative number.
nil)
((or 'today "today") (->> (ts-now)
(ts-apply :hour 23 :minute 59 :second 59)))
((pred numberp) (->> (ts-now)

View file

@ -1,4 +1,4 @@
This is README.info, produced by makeinfo version 5.2 from README.texi.
This is README.info, produced by makeinfo version 6.7 from README.texi.
INFO-DIR-SECTION Emacs
START-INFO-DIR-ENTRY
@ -71,7 +71,8 @@ Functions / Macros
Changelog
* 0.7.1-pre: 071-pre.
* 0.7.2: 072.
* 0.7.1: 071.
* 0.7: 07.
* 0.6.3: 063.
* 0.6.2: 062.
@ -991,7 +992,8 @@ releases.
* Menu:
* 0.7.1-pre: 071-pre.
* 0.7.2: 072.
* 0.7.1: 071.
* 0.7: 07.
* 0.6.3: 063.
* 0.6.2: 062.
@ -1020,21 +1022,49 @@ releases.
* 0.1: 01.

File: README.info, Node: 071-pre, Next: 07, Up: Changelog
File: README.info, Node: 072, Next: 071, Up: Changelog
5.1 0.7.1-pre
=============
5.1 0.7.2
=========
*Fixes*
• Timestamp predicates are more tolerant of partial input (e.g.
preventing errors while the user is typing a query into
org-ql-find).
• Query parser ignores leading whitespace (e.g. preventing errors
while the user is typing a query into org-ql-find).
• Use of org-ql-find with :query-prefix argument prevented
selection of results. (#351
(https://github.com/alphapapa/org-ql/issues/351). Thanks to Daniel
Fleischer (https://github.com/danielfleischer) for reporting.)
• Handle narrowed buffers correctly in org-ql-find.
• Warn about empty headings in org-ql-completing-read (the Org
format allows a heading line to have no text, but its useless for
this purpose, and usually indicates unnoticed corruption).

File: README.info, Node: 071, Next: 07, Prev: 072, Up: Changelog
5.2 0.7.1
=========
*Fixes*
• Function org-ql-completing-read is more compatible with default
Emacs completion. (See #338
(https://github.com/alphapapa/org-ql/issues/338). Thanks to
arozbiz (https://github.com/arozbiz) for reporting.)
• Function org-ql-completing-read would sometimes stop updating
with changes in input. (See #350
(https://github.com/alphapapa/org-ql/issues/350). Thanks to Ankit
Raj Pandey (https://github.com/anpandey) for reporting and fixing,
and to Daniel Mendler (https://github.com/minad) for advising.)
• In org-ql-completing-read, format links for display, and use
org-entry-get internally rather than org-get-heading.

File: README.info, Node: 07, Next: 063, Prev: 071-pre, Up: Changelog
File: README.info, Node: 07, Next: 063, Prev: 071, Up: Changelog
5.2 0.7
5.3 0.7
=======
*Added*
@ -1094,7 +1124,7 @@ File: README.info, Node: 07, Next: 063, Prev: 071-pre, Up: Changelog

File: README.info, Node: 063, Next: 062, Prev: 07, Up: Changelog
5.3 0.6.3
5.4 0.6.3
=========
*Fixed*
@ -1110,7 +1140,7 @@ File: README.info, Node: 063, Next: 062, Prev: 07, Up: Changelog

File: README.info, Node: 062, Next: 061, Prev: 063, Up: Changelog
5.4 0.6.2
5.5 0.6.2
=========
*Fixed*
@ -1121,7 +1151,7 @@ File: README.info, Node: 062, Next: 061, Prev: 063, Up: Changelog

File: README.info, Node: 061, Next: 06, Prev: 062, Up: Changelog
5.5 0.6.1
5.6 0.6.1
=========
*Fixed*
@ -1139,7 +1169,7 @@ File: README.info, Node: 061, Next: 06, Prev: 062, Up: Changelog

File: README.info, Node: 06, Next: 052, Prev: 061, Up: Changelog
5.6 0.6
5.7 0.6
=======
*Added*
@ -1206,7 +1236,7 @@ File: README.info, Node: 06, Next: 052, Prev: 061, Up: Changelog

File: README.info, Node: 052, Next: 051, Prev: 06, Up: Changelog
5.7 0.5.2
5.8 0.5.2
=========
*Fixed*
@ -1217,7 +1247,7 @@ File: README.info, Node: 052, Next: 051, Prev: 06, Up: Changelog

File: README.info, Node: 051, Next: 05, Prev: 052, Up: Changelog
5.8 0.5.1
5.9 0.5.1
=========
*Fixed*
@ -1230,8 +1260,8 @@ File: README.info, Node: 051, Next: 05, Prev: 052, Up: Changelog

File: README.info, Node: 05, Next: 049, Prev: 051, Up: Changelog
5.9 0.5
=======
5.10 0.5
========
*Added*
• View dispatcher using transient.el (like Magit), bound to v in
@ -1271,7 +1301,7 @@ File: README.info, Node: 05, Next: 049, Prev: 051, Up: Changelog

File: README.info, Node: 049, Next: 048, Prev: 05, Up: Changelog
5.10 0.4.9
5.11 0.4.9
==========
*Fixed*
@ -1282,7 +1312,7 @@ File: README.info, Node: 049, Next: 048, Prev: 05, Up: Changelog

File: README.info, Node: 048, Next: 047, Prev: 049, Up: Changelog
5.11 0.4.8
5.12 0.4.8
==========
*Fixed*
@ -1294,7 +1324,7 @@ File: README.info, Node: 048, Next: 047, Prev: 049, Up: Changelog

File: README.info, Node: 047, Next: 046, Prev: 048, Up: Changelog
5.12 0.4.7
5.13 0.4.7
==========
*Fixed*
@ -1307,7 +1337,7 @@ File: README.info, Node: 047, Next: 046, Prev: 048, Up: Changelog

File: README.info, Node: 046, Next: 045, Prev: 047, Up: Changelog
5.13 0.4.6
5.14 0.4.6
==========
*Fixed*
@ -1320,7 +1350,7 @@ File: README.info, Node: 046, Next: 045, Prev: 047, Up: Changelog

File: README.info, Node: 045, Next: 044, Prev: 046, Up: Changelog
5.14 0.4.5
5.15 0.4.5
==========
*Fixed*
@ -1332,7 +1362,7 @@ File: README.info, Node: 045, Next: 044, Prev: 046, Up: Changelog

File: README.info, Node: 044, Next: 043, Prev: 045, Up: Changelog
5.15 0.4.4
5.16 0.4.4
==========
*Fixed*
@ -1344,7 +1374,7 @@ File: README.info, Node: 044, Next: 043, Prev: 045, Up: Changelog

File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog
5.16 0.4.3
5.17 0.4.3
==========
*Fixed*
@ -1354,7 +1384,7 @@ File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog

File: README.info, Node: 042, Next: 041, Prev: 043, Up: Changelog
5.17 0.4.2
5.18 0.4.2
==========
*Fixed*
@ -1363,7 +1393,7 @@ File: README.info, Node: 042, Next: 041, Prev: 043, Up: Changelog

File: README.info, Node: 041, Next: 04, Prev: 042, Up: Changelog
5.18 0.4.1
5.19 0.4.1
==========
*Fixed*
@ -1373,7 +1403,7 @@ File: README.info, Node: 041, Next: 04, Prev: 042, Up: Changelog

File: README.info, Node: 04, Next: 032, Prev: 041, Up: Changelog
5.19 0.4
5.20 0.4
========
_Note:_ The next release, 0.5, may include changes which will require
@ -1454,7 +1484,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.20 0.3.2
5.21 0.3.2
==========
*Fixed*
@ -1467,7 +1497,7 @@ File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog

File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog
5.21 0.3.1
5.22 0.3.1
==========
*Fixed*
@ -1477,7 +1507,7 @@ File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog

File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog
5.22 0.3
5.23 0.3
========
*Added*
@ -1545,7 +1575,7 @@ File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog

File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog
5.23 0.2.3
5.24 0.2.3
==========
*Fixed*
@ -1555,7 +1585,7 @@ File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog

File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog
5.24 0.2.2
5.25 0.2.2
==========
*Fixed*
@ -1566,7 +1596,7 @@ File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog

File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog
5.25 0.2.1
5.26 0.2.1
==========
*Fixed*
@ -1576,7 +1606,7 @@ File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog

File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog
5.26 0.2
5.27 0.2
========
*Added*
@ -1659,7 +1689,7 @@ File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog

File: README.info, Node: 01, Prev: 02, Up: Changelog
5.27 0.1
5.28 0.1
========
First tagged release.
@ -1717,71 +1747,72 @@ GPLv3

Tag Table:
Node: Top225
Node: Contents1812
Node: Screenshots1935
Node: Installation2053
Node: Quelpa2567
Node: Helm support3095
Node: Usage3498
Node: Commands3896
Node: org-ql-find4340
Node: org-ql-refile4806
Node: org-ql-search5129
Node: helm-org-ql6825
Node: org-ql-view7203
Node: org-ql-view-sidebar7733
Node: org-ql-view-recent-items8113
Node: org-ql-sparse-tree8609
Node: Queries9409
Node: Non-sexp query syntax10526
Node: General predicates12285
Node: Ancestor/descendant predicates19272
Node: Date/time predicates20400
Node: Functions / Macros23524
Node: Agenda-like views23822
Ref: Function org-ql-block23984
Node: Listing / acting-on results25245
Ref: Caching25453
Ref: Function org-ql-select26366
Ref: Function org-ql-query28792
Ref: Macro org-ql (deprecated)30566
Node: Custom predicates30881
Ref: Macro org-ql-defpred31105
Node: Dynamic block34546
Node: Links37270
Node: Tips37957
Node: Changelog38281
Node: 071-pre39079
Node: 0739416
Node: 06342344
Node: 06242875
Node: 06143180
Node: 0643748
Node: 05246802
Node: 05147102
Node: 0547525
Node: 04949054
Node: 04849336
Node: 04749685
Node: 04650094
Node: 04550502
Node: 04450863
Node: 04351222
Node: 04251425
Node: 04151586
Node: 0451833
Node: 03255934
Node: 03156337
Node: 0356534
Node: 02359834
Node: 02260068
Node: 02160348
Node: 0260553
Node: 0164631
Node: Notes64732
Node: Comparison with Org Agenda searches64894
Node: org-sidebar65783
Node: License66062
Node: Contents1791
Node: Screenshots1914
Node: Installation2032
Node: Quelpa2546
Node: Helm support3074
Node: Usage3477
Node: Commands3875
Node: org-ql-find4319
Node: org-ql-refile4785
Node: org-ql-search5108
Node: helm-org-ql6804
Node: org-ql-view7182
Node: org-ql-view-sidebar7712
Node: org-ql-view-recent-items8092
Node: org-ql-sparse-tree8588
Node: Queries9388
Node: Non-sexp query syntax10505
Node: General predicates12264
Node: Ancestor/descendant predicates19251
Node: Date/time predicates20379
Node: Functions / Macros23503
Node: Agenda-like views23801
Ref: Function org-ql-block23963
Node: Listing / acting-on results25224
Ref: Caching25432
Ref: Function org-ql-select26345
Ref: Function org-ql-query28771
Ref: Macro org-ql (deprecated)30545
Node: Custom predicates30860
Ref: Macro org-ql-defpred31084
Node: Dynamic block34525
Node: Links37249
Node: Tips37936
Node: Changelog38260
Node: 07239037
Node: 07139944
Node: 0740753
Node: 06343677
Node: 06244208
Node: 06144513
Node: 0645081
Node: 05248135
Node: 05148435
Node: 0548858
Node: 04950389
Node: 04850671
Node: 04751020
Node: 04651429
Node: 04551837
Node: 04452198
Node: 04352557
Node: 04252760
Node: 04152921
Node: 0453168
Node: 03257269
Node: 03157672
Node: 0357869
Node: 02361169
Node: 02261403
Node: 02161683
Node: 0261888
Node: 0165966
Node: Notes66067
Node: Comparison with Org Agenda searches66229
Node: org-sidebar67118
Node: License67397

End Tag Table

View file

@ -33,6 +33,8 @@
(require 'org-ql-search)
(require 'org-ql-view)
(require 'xr)
;;;; Variables
(defvar org-ql-test-buffer nil