This commit is contained in:
Adam Porter 2018-01-03 11:19:43 -06:00
parent fc64ec78bd
commit 29eec8ba25

View file

@ -62,22 +62,9 @@
(string (list files)))) (string (list files))))
(mapc 'find-file-noselect files) (mapc 'find-file-noselect files)
(let* ((org-use-tag-inheritance t) (let* ((org-use-tag-inheritance t)
(entries (-flatten (entries (-flatten (--map (with-current-buffer (find-buffer-visiting it)
(--map (with-current-buffer (find-buffer-visiting it) (mapcar #'org-agenda-ng--format-element
;; FIXME: It would be more optimal to (org-agenda-ng--filter-buffer :pred pred)))
;; gather the entry at each matching
;; position instead of returning a list of
;; positions and then having to go back
;; and get the entries at each position.
(let* ((positions (org-agenda-ng--filter-buffer :pred pred))
(elements (--map (org-with-point-at it
(org-element-headline-parser
;; FIXME: This is a hack
(save-excursion
(forward-line 3)
(point))))
positions)))
(mapcar #'org-agenda-ng--format-element elements)))
files))) files)))
(result-string (org-agenda-finalize-entries entries 'agenda)) (result-string (org-agenda-finalize-entries entries 'agenda))
(target-buffer (get-buffer-create "test-agenda-ng"))) (target-buffer (get-buffer-create "test-agenda-ng")))
@ -102,7 +89,6 @@
while (outline-next-heading))))) while (outline-next-heading)))))
(cl-defun org-agenda-ng--filter-buffer (&key pred) (cl-defun org-agenda-ng--filter-buffer (&key pred)
;; TODO: Remove all, any, and none, and just use the predicate lambda.
"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."
@ -116,7 +102,11 @@ NONE-PREDS."
(when (org-before-first-heading-p) (when (org-before-first-heading-p)
(outline-next-heading)) (outline-next-heading))
(cl-loop when (funcall pred) (cl-loop when (funcall pred)
collect (point) collect (org-element-headline-parser
;; FIXME: This bound is a hack
(save-excursion
(forward-line 3)
(point)))
while (outline-next-heading))))) while (outline-next-heading)))))
;;;; Faces/properties ;;;; Faces/properties