Skip to content

Commit

Permalink
Docs: (defpred.org) Fix macro example
Browse files Browse the repository at this point in the history
Thanks to Pete Kazmier (@pkazmier) for reporting (see issue #52).
  • Loading branch information
alphapapa committed Nov 24, 2020
1 parent 6e6f62d commit ae83de1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions examples/defpred.org
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,24 @@ Finally, if you're a Lisper who appreciates anaphora, you might prefer a more sy
(org-ql-defpred (person p) (&rest names)
"Search for entries about any of NAMES."
:normalizers ((`(,predicate-names . ,names)
`(or (tags ,@(--map `(concat "person" ,it) names))
`(or (tags ,@(--map (concat "person" it) names))
,@(--map `(property "person" ,it) names)))))
#+END_SRC

Let's make sure it works:
Let's make sure it normalizes correctly:

#+BEGIN_SRC elisp :results code :exports both :cache yes
(org-ql--normalize-query '(person "Alice" "Bob"))
#+END_SRC

#+RESULTS[ebc46fff31b72359353dda539a26c95b7d650df2]:
#+BEGIN_SRC elisp
(or (tags "personAlice" "personBob")
(property "person" "Alice")
(property "person" "Bob"))
#+END_SRC

It does, so the query also produces the correct results:

#+BEGIN_SRC elisp :results list :exports both :cache yes
(org-ql-query :select '(org-get-heading :no-tags)
Expand Down

0 comments on commit ae83de1

Please sign in to comment.