org-element: Keep ARCHIVE tag in headline tags

* lisp/org-element.el (org-element-headline-parser): Do not remove
  ARCHIVE tag.
(org-element-headline-interpreter): Apply change.

* testing/lisp/test-org-element.el (test-org-element/headline-archive-tag):
Update tests.

<http://permalink.gmane.org/gmane.emacs.orgmode/97141>
This commit is contained in:
Nicolas Goaziou 2015-04-24 14:28:17 +02:00
parent aad7dd2486
commit 84e2e1e752
2 changed files with 3 additions and 12 deletions

View File

@ -942,8 +942,6 @@ Assume point is at beginning of the headline."
(skip-chars-backward " \r\t\n")
(forward-line)
(point)))))
;; Clean TAGS from archive tag, if any.
(when archivedp (setq tags (delete org-archive-tag tags)))
(let ((headline
(list 'headline
(nconc
@ -992,10 +990,7 @@ CONTENTS is the contents of the element."
(priority (org-element-property :priority headline))
(title (org-element-interpret-data
(org-element-property :title headline)))
(tags (let ((tag-list (if (org-element-property :archivedp headline)
(cons org-archive-tag
(org-element-property :tags headline))
(org-element-property :tags headline))))
(tags (let ((tag-list (org-element-property :tags headline)))
(and tag-list
(format ":%s:" (mapconcat #'identity tag-list ":")))))
(commentedp (org-element-property :commentedp headline))

View File

@ -1020,16 +1020,12 @@ Some other text
(org-test-with-temp-text "* Headline :ARCHIVE:"
(let ((org-archive-tag "ARCHIVE"))
(let ((headline (org-element-at-point)))
(should (org-element-property :archivedp headline))
;; Test tag removal.
(should-not (org-element-property :tags headline)))))
(should (org-element-property :archivedp headline)))))
;; Multiple tags.
(org-test-with-temp-text "* Headline :test:ARCHIVE:"
(let ((org-archive-tag "ARCHIVE"))
(let ((headline (org-element-at-point)))
(should (org-element-property :archivedp headline))
;; Test tag removal.
(should (equal (org-element-property :tags headline) '("test"))))))
(should (org-element-property :archivedp headline)))))
;; Tag is case-sensitive.
(should-not
(org-test-with-temp-text "* Headline :ARCHIVE:"