Fix: Don't treat an element's :begin property as a marker

Only markers are markers.  Also add FIXME about tag inheritance when
no marker is used (although see caveat in it...).
This commit is contained in:
Adam Porter 2018-08-22 13:32:44 -05:00
parent b4ba9e78fd
commit cdbe750b7c
2 changed files with 13 additions and 10 deletions

View file

@ -187,9 +187,12 @@ Its property list should be the second item in the list, as returned by `org-ele
(org-ql-agenda--add-todo-face it))) (org-ql-agenda--add-todo-face it)))
;; FIXME: Figure out whether I should use `org-agenda-use-tag-inheritance' or `org-use-tag-inheritance', etc. ;; FIXME: Figure out whether I should use `org-agenda-use-tag-inheritance' or `org-use-tag-inheritance', etc.
(tag-list (if org-use-tag-inheritance (tag-list (if org-use-tag-inheritance
;; FIXME: Note that tag inheritance cannot be used here unless markers are
;; added, otherwise we can't go to the item's buffer to look for inherited
;; tags. (Or does `org-element-headline-parser' parse inherited tags too? I
;; forget...)
(if-let ((marker (or (org-element-property :org-hd-marker element) (if-let ((marker (or (org-element-property :org-hd-marker element)
(org-element-property :org-marker element) (org-element-property :org-marker element))))
(org-element-property :begin element))))
(with-current-buffer (marker-buffer marker) (with-current-buffer (marker-buffer marker)
;; I wish `org-get-tags-at' used the correct buffer automatically. ;; I wish `org-get-tags-at' used the correct buffer automatically.
(org-get-tags-at marker (not org-use-tag-inheritance))) (org-get-tags-at marker (not org-use-tag-inheritance)))

View file

@ -37,15 +37,15 @@ If MARKERS is non-nil, `org-agenda-ng--add-markers' is used to
add markers to each item, pointing to the item in its source add markers to each item, pointing to the item in its source
buffer. In this case, ACTION should return an Org element." buffer. In this case, ACTION should return an Org element."
(declare (indent defun)) (declare (indent defun))
(setq action (cl-ecase markers (setq action (pcase markers
('t `(lambda () ('nil `(lambda ()
,action))
(_ `(lambda ()
;; FIXME: Document that, when markers is t, `action' should return an Org ;; FIXME: Document that, when markers is t, `action' should return an Org
;; headline element, which --add-markers works with. On the other hand, ;; headline element, which --add-markers works with. On the other hand,
;; maybe this should be on the agenda-ng side. ;; maybe this should be on the agenda-ng side.
(->> ,action (->> ,action
org-ql--add-agenda-markers))) org-ql--add-agenda-markers)))))
('nil `(lambda ()
,action))))
`(org-ql--query ,buffers-or-files `(org-ql--query ,buffers-or-files
',pred-body ',pred-body
:action ,action :action ,action