瀏覽代碼

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>
Nicolas Goaziou 10 年之前
父節點
當前提交
84e2e1e752
共有 2 個文件被更改,包括 3 次插入12 次删除
  1. 1 6
      lisp/org-element.el
  2. 2 6
      testing/lisp/test-org-element.el

+ 1 - 6
lisp/org-element.el

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

+ 2 - 6
testing/lisp/test-org-element.el

@@ -1020,16 +1020,12 @@ Some other text
   (org-test-with-temp-text "* Headline :ARCHIVE:"
   (org-test-with-temp-text "* Headline :ARCHIVE:"
     (let ((org-archive-tag "ARCHIVE"))
     (let ((org-archive-tag "ARCHIVE"))
       (let ((headline (org-element-at-point)))
       (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.
   ;; Multiple tags.
   (org-test-with-temp-text "* Headline :test:ARCHIVE:"
   (org-test-with-temp-text "* Headline :test:ARCHIVE:"
     (let ((org-archive-tag "ARCHIVE"))
     (let ((org-archive-tag "ARCHIVE"))
       (let ((headline (org-element-at-point)))
       (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.
   ;; Tag is case-sensitive.
   (should-not
   (should-not
    (org-test-with-temp-text "* Headline :ARCHIVE:"
    (org-test-with-temp-text "* Headline :ARCHIVE:"