(org-ql--priority-p) Convert to function
I don't remember why I had made it a macro, but it needs to be a function so it can be called correctly in org-ql--query.
This commit is contained in:
parent
9050b756ba
commit
d1f26eec2f
1 changed files with 14 additions and 14 deletions
28
org-ql.el
28
org-ql.el
|
|
@ -174,7 +174,7 @@ like one returned by `date-to-day'."
|
||||||
(defsubst org-ql--closed-p (&optional comparator target-date)
|
(defsubst org-ql--closed-p (&optional comparator target-date)
|
||||||
(org-agenda-ng--date-p :closed comparator target-date))
|
(org-agenda-ng--date-p :closed comparator target-date))
|
||||||
|
|
||||||
(defmacro org-ql--priority-p (&optional comparator-or-priority priority)
|
(defun org-ql--priority-p (&optional comparator-or-priority priority)
|
||||||
"Return non-nil if current heading has a certain priority.
|
"Return non-nil if current heading has a certain priority.
|
||||||
COMPARATOR-OR-PRIORITY should be either a comparator function,
|
COMPARATOR-OR-PRIORITY should be either a comparator function,
|
||||||
like `<=', or a priority string, like \"A\" (in which case (\` =)
|
like `<=', or a priority string, like \"A\" (in which case (\` =)
|
||||||
|
|
@ -197,19 +197,19 @@ comparator, PRIORITY should be a priority string."
|
||||||
(= '=)
|
(= '=)
|
||||||
(otherwise (user-error "Invalid comparator: %s" comparator))))
|
(otherwise (user-error "Invalid comparator: %s" comparator))))
|
||||||
(setq priority (* 1000 (- org-lowest-priority (string-to-char priority))))
|
(setq priority (* 1000 (- org-lowest-priority (string-to-char priority))))
|
||||||
`(when-let ((item-priority (save-excursion
|
(when-let ((item-priority (save-excursion
|
||||||
(save-match-data
|
(save-match-data
|
||||||
;; FIXME: Is the save-match-data above necessary?
|
;; FIXME: Is the save-match-data above necessary?
|
||||||
(when (and (looking-at org-heading-regexp)
|
(when (and (looking-at org-heading-regexp)
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(string-match org-priority-regexp (match-string 0))))
|
(string-match org-priority-regexp (match-string 0))))
|
||||||
;; TODO: Items with no priority
|
;; TODO: Items with no priority
|
||||||
;; should not be the same as B
|
;; should not be the same as B
|
||||||
;; priority. That's not very
|
;; priority. That's not very
|
||||||
;; useful IMO. Better to do it
|
;; useful IMO. Better to do it
|
||||||
;; like in org-super-agenda.
|
;; like in org-super-agenda.
|
||||||
(org-get-priority (match-string 0)))))))
|
(org-get-priority (match-string 0)))))))
|
||||||
(funcall ',comparator ,priority item-priority))))
|
(funcall comparator priority item-priority))))
|
||||||
|
|
||||||
(defun org-ql--habit-p ()
|
(defun org-ql--habit-p ()
|
||||||
(org-is-habit-p))
|
(org-is-habit-p))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue