Revert "Change: (olp, olps) Optimize multiple args with heading query"
This reverts commit 2d07cb0822.
This commit is contained in:
parent
b62896a583
commit
8f51fe9a12
3 changed files with 29 additions and 49 deletions
|
|
@ -521,7 +521,6 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
|
|||
|
||||
*Changed*
|
||||
+ Helm support (including the command =helm-org-ql=) has been moved to a separate package, =helm-org-ql=.
|
||||
+ Predicates ~outline-path~ and ~outline-path-segment~, when called with multiple arguments, optimize to a query like ~(and (heading LAST-OLP-ARG) (olp OTHER-OLP-ARGS))~, which is much faster.
|
||||
|
||||
*Internal*
|
||||
+ Predicates are now defined more cleanly with a macro (=org-ql-defpred=) that consolidates functionality related to each predicate. This will also allow users to more easily define custom predicates.
|
||||
|
|
|
|||
28
org-ql.el
28
org-ql.el
|
|
@ -1170,17 +1170,9 @@ the following queries:
|
|||
(olp \"Food\" \"Fruits\")
|
||||
(olp \"Fruits\" \"Grapes\")
|
||||
(olp \"Food\" \"Grapes\")"
|
||||
;; FIXME: Stop regexp quoting when the (heading) predicate is changed to take a non-regexp string.
|
||||
:normalizers ((`(,predicate-names ,string)
|
||||
;; Equivalent to (heading string), which is much faster.
|
||||
`(heading ,(regexp-quote string)))
|
||||
(`(,predicate-names . ,strings)
|
||||
;; Rewrite query to use (heading) with the last string
|
||||
;; and (olp) for the rest, which is much faster.
|
||||
(let ((last (car (last strings)))
|
||||
(rest (butlast strings)))
|
||||
`(and (heading ,(regexp-quote last))
|
||||
(outline-path ,@(mapcar #'regexp-quote rest))))))
|
||||
:normalizers ((`(,predicate-names . ,strings)
|
||||
;; Regexp quote headings.
|
||||
`(outline-path ,@(mapcar #'regexp-quote strings))))
|
||||
:body (let ((entry-olp (org-ql--value-at (point) #'org-ql--outline-path)))
|
||||
(cl-loop for h in regexps
|
||||
always (cl-member h entry-olp :test #'string-match))))
|
||||
|
|
@ -1203,17 +1195,9 @@ contiguous segment of the outline path:
|
|||
|
||||
(olp \"Food\" \"Grape\")"
|
||||
;; MAYBE: Allow anchored matching.
|
||||
;; FIXME: Stop regexp quoting when the (heading) predicate is changed to take a non-regexp string.
|
||||
:normalizers ((`(,predicate-names ,string)
|
||||
;; Equivalent to (heading string), which is much faster.
|
||||
`(heading ,(regexp-quote string)))
|
||||
(`(,predicate-names . ,strings)
|
||||
;; Rewrite query to use (heading) with the last string
|
||||
;; and (olp) for the rest, which is much faster.
|
||||
(let ((last (car (last strings)))
|
||||
(rest (butlast strings)))
|
||||
`(and (heading ,(regexp-quote last))
|
||||
(outline-path-segment ,@(mapcar #'regexp-quote rest))))))
|
||||
:normalizers ((`(,(or 'outline-path-segment 'olps) . ,strings)
|
||||
;; Regexp quote headings.
|
||||
`(outline-path-segment ,@(mapcar #'regexp-quote strings))))
|
||||
:body (org-ql--infix-p regexps (org-ql--value-at (point) #'org-ql--outline-path)))
|
||||
|
||||
(org-ql-defpred path (&rest regexps)
|
||||
|
|
|
|||
49
org-ql.info
49
org-ql.info
|
|
@ -966,9 +966,6 @@ File: README.info, Node: 06-pre, Next: 05, Up: Changelog
|
|||
*Changed*
|
||||
• Helm support (including the command helm-org-ql) has been moved to
|
||||
a separate package, helm-org-ql.
|
||||
• Predicates ‘outline-path’ and ‘outline-path-segment’, when called
|
||||
with multiple arguments, optimize to a query like ‘(and (heading
|
||||
LAST-OLP-ARG) (olp OTHER-OLP-ARGS))’, which is much faster.
|
||||
|
||||
*Internal*
|
||||
• Predicates are now defined more cleanly with a macro
|
||||
|
|
@ -1491,29 +1488,29 @@ Node: Links33872
|
|||
Node: Tips34559
|
||||
Node: Changelog34877
|
||||
Node: 06-pre35573
|
||||
Node: 0536416
|
||||
Node: 04937893
|
||||
Node: 04838167
|
||||
Node: 04738514
|
||||
Node: 04638909
|
||||
Node: 04539309
|
||||
Node: 04439668
|
||||
Node: 04340025
|
||||
Node: 04240220
|
||||
Node: 04140381
|
||||
Node: 0440622
|
||||
Node: 03244555
|
||||
Node: 03144934
|
||||
Node: 0345131
|
||||
Node: 02348106
|
||||
Node: 02248334
|
||||
Node: 02148602
|
||||
Node: 0248801
|
||||
Node: 0152836
|
||||
Node: Notes52937
|
||||
Node: Comparison with Org Agenda searches53099
|
||||
Node: org-sidebar53971
|
||||
Node: License54250
|
||||
Node: 0536196
|
||||
Node: 04937673
|
||||
Node: 04837947
|
||||
Node: 04738294
|
||||
Node: 04638689
|
||||
Node: 04539089
|
||||
Node: 04439448
|
||||
Node: 04339805
|
||||
Node: 04240000
|
||||
Node: 04140161
|
||||
Node: 0440402
|
||||
Node: 03244335
|
||||
Node: 03144714
|
||||
Node: 0344911
|
||||
Node: 02347886
|
||||
Node: 02248114
|
||||
Node: 02148382
|
||||
Node: 0248581
|
||||
Node: 0152616
|
||||
Node: Notes52717
|
||||
Node: Comparison with Org Agenda searches52879
|
||||
Node: org-sidebar53751
|
||||
Node: License54030
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue