Change: (regexp) Accept multiple regexps
This commit is contained in:
parent
7068322757
commit
7dcdc21ea1
3 changed files with 19 additions and 4 deletions
|
|
@ -233,7 +233,8 @@ If ~MARKERS~ is non-nil, ~org-agenda-ng--add-markers~ is used to add markers to
|
||||||
|
|
||||||
** 0.2-pre
|
** 0.2-pre
|
||||||
|
|
||||||
Nothing new yet.
|
*Changed*
|
||||||
|
+ ~(regexp)~ selector accepts multiple regexps to test.
|
||||||
|
|
||||||
** 0.1
|
** 0.1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -461,14 +461,16 @@ comparator, PRIORITY should be a priority string."
|
||||||
"Return non-nil if entry is a habit."
|
"Return non-nil if entry is a habit."
|
||||||
(org-is-habit-p))
|
(org-is-habit-p))
|
||||||
|
|
||||||
(org-ql--defpredicate regexp (regexp)
|
(org-ql--defpredicate regexp (&rest regexps)
|
||||||
"Return non-nil if current entry matches REGEXP (a regexp string)."
|
"Return non-nil if current entry matches one of REGEXPS (regexp strings)."
|
||||||
(let ((end (or (save-excursion
|
(let ((end (or (save-excursion
|
||||||
(outline-next-heading))
|
(outline-next-heading))
|
||||||
(point-max))))
|
(point-max))))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (line-beginning-position))
|
(goto-char (line-beginning-position))
|
||||||
(re-search-forward regexp end t))))
|
(cl-loop for regexp in regexps
|
||||||
|
thereis (save-excursion
|
||||||
|
(re-search-forward regexp end t))))))
|
||||||
|
|
||||||
(org-ql--defpredicate heading (regexp)
|
(org-ql--defpredicate heading (regexp)
|
||||||
"Return non-nil if current entry's heading matches REGEXP (a regexp string)."
|
"Return non-nil if current entry's heading matches REGEXP (a regexp string)."
|
||||||
|
|
|
||||||
|
|
@ -255,6 +255,18 @@
|
||||||
:action (org-ql-test-org-get-heading))
|
:action (org-ql-test-org-get-heading))
|
||||||
:to-equal '("Learn universal sign language")))
|
:to-equal '("Learn universal sign language")))
|
||||||
|
|
||||||
|
(describe "(regexp)"
|
||||||
|
(it "with 1 argument"
|
||||||
|
(expect (org-ql test-buffer
|
||||||
|
(regexp "Take over")
|
||||||
|
:sort todo
|
||||||
|
:action (org-ql-test-org-get-heading)) :to-equal '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Get haircut")))
|
||||||
|
(it "with 2 arguments"
|
||||||
|
(expect (org-ql test-buffer
|
||||||
|
(regexp "Take over" "pizza")
|
||||||
|
:sort todo
|
||||||
|
:action (org-ql-test-org-get-heading)) :to-equal '("Take over the universe" "Take over the world" "Take over Mars" "Take over the moon" "Order a pizza" "Get haircut"))))
|
||||||
|
|
||||||
(describe "(ts)"
|
(describe "(ts)"
|
||||||
(it "without arguments"
|
(it "without arguments"
|
||||||
(expect (org-ql test-buffer
|
(expect (org-ql test-buffer
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue