Kyle Meyer <k...@kyleam.com> writes: > That looks good as far as fixing the misbehavior you report. I wonder > though whether there's a deeper org-get-tags issue here worth > considering. Its documentation says > > ... the returned list of tags contains tags in this order: file > tags, tags inherited from parent headlines, local tags. > > But it's not specified what happens when a tag is both local and > inherited. The current implementation drops the local tag variant > through its delete-dups call: > > (delete-dups > (append (org-remove-uninherited-tags itags) ltags)) > > I would have expected the local tag to get priority here. If that were > the case (e.g., something like below), that would also solve the issue > you describe. > > Thoughts?
That sounds reasonable, let me prepare a new patch. > > -- >8 -- > diff --git a/lisp/org.el b/lisp/org.el > index fb95590fc..3dac42b7b 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -12310,8 +12310,10 @@ (defun org-get-tags (&optional pos local) > (org--get-local-tags)) > itags))) > (setq itags (append org-file-tags itags)) > - (delete-dups > - (append (org-remove-uninherited-tags itags) ltags)))))))) > + (nreverse > + (delete-dups > + (nreverse (nconc (org-remove-uninherited-tags itags) > + ltags)))))))))) > > (defun org-get-buffer-tags () > "Get a table of all tags used in the buffer, for completion."