Change/Fix: Pass :narrow to org-ql-agenda--agenda

This function is not only useful for "agenda" views, in which one
would almost surely want a widened buffer, but also agenda-like views
of subtrees, in which narrowing should be preserved.
This commit is contained in:
Adam Porter 2018-08-22 14:32:46 -05:00
parent 103993c52e
commit 5774880988

View file

@ -97,21 +97,23 @@ agenda in, rather than the default."
;; TODO: Probably better to just use eval on org-ql rather than reimplementing parts of it here. ;; TODO: Probably better to just use eval on org-ql rather than reimplementing parts of it here.
',query ',query
:sort ',sort :sort ',sort
:buffer ,buffer)))) :buffer ,buffer
:narrow ,narrow))))
;;;; Functions ;;;; Functions
;; TODO: Move the action-fn down into --filter-buffer, so users can avoid calling the ;; TODO: Move the action-fn down into --filter-buffer, so users can avoid calling the
;; headline-parser when they don't need it. ;; headline-parser when they don't need it.
(cl-defun org-ql-agenda--agenda (buffers-files query &key sort buffer) (cl-defun org-ql-agenda--agenda (buffers-files query &key sort buffer narrow)
"FIXME: Docstring" "FIXME: Docstring"
(declare (indent defun)) (declare (indent defun))
;; I think it's reasonable to use `eval' here. ;; I think it's reasonable to use `eval' here.
(let* ((entries (--> (eval `(org-ql ',buffers-files (let* ((entries (--> (eval `(org-ql ',buffers-files
,query ,query
:sort ,sort :sort ,sort
:markers t)) :markers t
:narrow ,narrow))
(mapcar #'org-ql-agenda--format-element it) (mapcar #'org-ql-agenda--format-element it)
(cond ((bound-and-true-p org-super-agenda-mode) (org-super-agenda--group-items it)) (cond ((bound-and-true-p org-super-agenda-mode) (org-super-agenda--group-items it))
(t it)) (t it))