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)))
;; 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
;; 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)
(org-element-property :org-marker element)
(org-element-property :begin element))))
(org-element-property :org-marker element))))
(with-current-buffer (marker-buffer marker)
;; I wish `org-get-tags-at' used the correct buffer automatically.
(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
buffer. In this case, ACTION should return an Org element."
(declare (indent defun))
(setq action (cl-ecase markers
('t `(lambda ()
(setq action (pcase markers
('nil `(lambda ()
,action))
(_ `(lambda ()
;; FIXME: Document that, when markers is t, `action' should return an Org
;; headline element, which --add-markers works with. On the other hand,
;; maybe this should be on the agenda-ng side.
(->> ,action
org-ql--add-agenda-markers)))
('nil `(lambda ()
,action))))
org-ql--add-agenda-markers)))))
`(org-ql--query ,buffers-or-files
',pred-body
:action ,action