From d1f26eec2f29a3156a3389bd22c50a203bd1e334 Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Tue, 22 May 2018 06:27:21 -0500 Subject: [PATCH] (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. --- org-ql.el | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/org-ql.el b/org-ql.el index 49c3152..49c60e3 100644 --- a/org-ql.el +++ b/org-ql.el @@ -174,7 +174,7 @@ like one returned by `date-to-day'." (defsubst org-ql--closed-p (&optional 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. COMPARATOR-OR-PRIORITY should be either a comparator function, 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)))) (setq priority (* 1000 (- org-lowest-priority (string-to-char priority)))) - `(when-let ((item-priority (save-excursion - (save-match-data - ;; FIXME: Is the save-match-data above necessary? - (when (and (looking-at org-heading-regexp) - (save-match-data - (string-match org-priority-regexp (match-string 0)))) - ;; TODO: Items with no priority - ;; should not be the same as B - ;; priority. That's not very - ;; useful IMO. Better to do it - ;; like in org-super-agenda. - (org-get-priority (match-string 0))))))) - (funcall ',comparator ,priority item-priority)))) + (when-let ((item-priority (save-excursion + (save-match-data + ;; FIXME: Is the save-match-data above necessary? + (when (and (looking-at org-heading-regexp) + (save-match-data + (string-match org-priority-regexp (match-string 0)))) + ;; TODO: Items with no priority + ;; should not be the same as B + ;; priority. That's not very + ;; useful IMO. Better to do it + ;; like in org-super-agenda. + (org-get-priority (match-string 0))))))) + (funcall comparator priority item-priority)))) (defun org-ql--habit-p () (org-is-habit-p))