flet->fmap
This commit is contained in:
parent
38d549e6cc
commit
c412012100
1 changed files with 8 additions and 8 deletions
|
|
@ -40,11 +40,11 @@
|
||||||
|
|
||||||
;;;; Macros
|
;;;; Macros
|
||||||
|
|
||||||
(defmacro org-agenda-ng--flet (fns &rest body)
|
(defmacro org-agenda-ng--fmap (fns &rest body)
|
||||||
(declare (indent defun))
|
(declare (indent defun))
|
||||||
`(cl-letf ,(cl-loop for (fn def) in fns
|
`(cl-letf ,(cl-loop for (fn target) in fns
|
||||||
collect `((symbol-function ',fn)
|
collect `((symbol-function ',fn)
|
||||||
,def))
|
(symbol-function ,target)))
|
||||||
,@body))
|
,@body))
|
||||||
|
|
||||||
(cl-defun org-agenda-ng--test-lambda (&key all any none)
|
(cl-defun org-agenda-ng--test-lambda (&key all any none)
|
||||||
|
|
@ -187,11 +187,11 @@
|
||||||
"Return positions of matching headings in current buffer.
|
"Return positions of matching headings in current buffer.
|
||||||
Headings should return non-nil for any ANY-PREDS and nil for all
|
Headings should return non-nil for any ANY-PREDS and nil for all
|
||||||
NONE-PREDS."
|
NONE-PREDS."
|
||||||
(org-agenda-ng--flet ((category (lambda (&rest args) (apply #'org-agenda-ng--category-p args)))
|
(org-agenda-ng--fmap ((category #'org-agenda-ng--category-p)
|
||||||
(date (lambda (&rest args) (apply #'org-agenda-ng--date-p args)))
|
(date #'org-agenda-ng--date-p)
|
||||||
(habit (lambda (&rest args) (apply #'org-agenda-ng--habit-p args)))
|
(habit #'org-agenda-ng--habit-p)
|
||||||
(todo (lambda (&rest args) (apply #'org-agenda-ng--todo-p args)))
|
(todo #'org-agenda-ng--todo-p)
|
||||||
(tags (lambda (&rest args) (apply #'org-agenda-ng--tags-p args))))
|
(tags #'org-agenda-ng--tags-p))
|
||||||
(let* ((our-lambda (when (or all any none)
|
(let* ((our-lambda (when (or all any none)
|
||||||
(org-agenda-ng--test-lambda :all all :any any :none none)))
|
(org-agenda-ng--test-lambda :all all :any any :none none)))
|
||||||
(pred (cond ((and our-lambda pred)
|
(pred (cond ((and our-lambda pred)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue