Function: org-get-tags

org-get-tags is a byte-compiled function defined in org.el.gz.

Signature

(org-get-tags &optional EPOM LOCAL)

Documentation

Get the list of tags specified in the headline at EPOM.

When argument EPOM is non-nil, it should be point, marker, or headline element.

According to org-use-tag-inheritance, tags may be inherited from parent headlines, and from the whole document, through org-file-tags. In this case, the returned list of tags contains tags in this order: file tags, tags inherited from parent headlines, local tags. If a tag appears multiple times, only the most local tag is returned.

However, when optional argument LOCAL is non-nil, only return tags specified at the headline.

Inherited tags have the inherited text property.

This function may modify the match data.

Aliases

org-get-tags-at (obsolete since 9.2)

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-get-tags (&optional epom local)
  "Get the list of tags specified in the headline at EPOM.

When argument EPOM is non-nil, it should be point, marker, or headline
element.

According to `org-use-tag-inheritance', tags may be inherited
from parent headlines, and from the whole document, through
`org-file-tags'.  In this case, the returned list of tags
contains tags in this order: file tags, tags inherited from
parent headlines, local tags.  If a tag appears multiple times,
only the most local tag is returned.

However, when optional argument LOCAL is non-nil, only return
tags specified at the headline.

Inherited tags have the `inherited' text property.

This function may modify the match data."
  (if (and org-trust-scanner-tags
           (or (not epom) (eq epom (point)))
           (not local))
      org-scanner-tags
    (setq epom (org-element-lineage
                (org-element-at-point epom)
                '(headline inlinetask)
                'with-self))
    (let ((ltags (org--get-local-tags epom))
          itags)
      (if (or local (not org-use-tag-inheritance)) ltags
        (setq
         itags
         (mapcar
          #'org-add-prop-inherited
          (org-element-property-inherited :tags epom nil 'acc)))
        (setq itags (append org-file-tags itags))
        (nreverse
	 (delete-dups
	  (nreverse (nconc (org-remove-uninherited-tags itags) ltags))))))))