Tidy: (org-ql--defpred)
Somehow this old macro snuck back in...maybe in a merge gone bad?
This commit is contained in:
parent
92d099caf6
commit
27609264a5
1 changed files with 0 additions and 27 deletions
27
org-ql.el
27
org-ql.el
|
|
@ -159,33 +159,6 @@ See Info node `(org-ql)Queries'."
|
||||||
|
|
||||||
;;;; Macros
|
;;;; Macros
|
||||||
|
|
||||||
(cl-defmacro org-ql--defpred (name args docstring &rest body)
|
|
||||||
"Define an `org-ql' selector predicate named `org-ql--predicate-NAME'.
|
|
||||||
NAME may be a symbol or a list of symbols: if a list, the first
|
|
||||||
is used as the name and the rest are aliases. ARGS is a
|
|
||||||
`cl-defun'-style argument list. DOCSTRING is the function's
|
|
||||||
docstring. BODY is the body of the predicate.
|
|
||||||
|
|
||||||
Predicates will be called with point on the beginning of an Org
|
|
||||||
heading and should return non-nil if the heading's entry is a
|
|
||||||
match."
|
|
||||||
(declare (debug ([&or symbolp listp] listp stringp def-body))
|
|
||||||
(indent defun))
|
|
||||||
(let* ((aliases (when (listp name)
|
|
||||||
(cdr name)))
|
|
||||||
(name (cl-etypecase name
|
|
||||||
(list (car name))
|
|
||||||
(atom name)))
|
|
||||||
(fn-name (intern (concat "org-ql--predicate-" (symbol-name name))))
|
|
||||||
(pred-name (intern (symbol-name name))))
|
|
||||||
`(progn
|
|
||||||
(cl-eval-when (compile load eval)
|
|
||||||
;; When compiling, the predicate must be added to `org-ql-predicates' before `org-ql--def-plain-query-fn'
|
|
||||||
;; is called to define `org-ql--plain-query'. Otherwise, `org-ql--plain-query' seems to work properly
|
|
||||||
;; when interpreted but not always when the file is byte-compiled.
|
|
||||||
(push (list :name ',pred-name :aliases ',aliases :fn ',fn-name :docstring ,docstring :args ',args) org-ql-predicates))
|
|
||||||
(cl-defun ,fn-name ,args ,docstring ,@body))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(cl-defmacro org-ql (buffers-or-files query &key sort narrow action)
|
(cl-defmacro org-ql (buffers-or-files query &key sort narrow action)
|
||||||
"Expands into a call to `org-ql-select' with the same arguments.
|
"Expands into a call to `org-ql-select' with the same arguments.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue