Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2012-09-29 10:16:33 +02:00
commit 6e61cfc80f
2 changed files with 49 additions and 31 deletions

View File

@ -760,11 +760,14 @@ Assume point is at beginning of the headline."
(point)))))
;; Clean RAW-VALUE from any quote or comment string.
(when (or quotedp commentedp)
(let ((case-fold-search nil))
(setq raw-value
(replace-regexp-in-string
(concat "\\(" org-quote-string "\\|" org-comment-string "\\) +")
(concat
(regexp-opt (list org-quote-string org-comment-string))
"\\(?: \\|$\\)")
""
raw-value)))
raw-value))))
;; Clean TAGS from archive tag, if any.
(when archivedp (setq tags (delete org-archive-tag tags)))
(let ((headline

View File

@ -739,23 +739,31 @@ CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] => 0:01"
(should-not (org-element-property :quotedp (org-element-at-point)))))
;; Standard position.
(org-test-with-temp-text "* QUOTE Headline"
(let ((org-quote-string "QUOTE"))
(let ((headline (org-element-at-point)))
(let* ((org-quote-string "QUOTE")
(headline (org-element-at-point)))
(should (org-element-property :quotedp headline))
;; Test removal from raw value.
(should (equal (org-element-property :raw-value headline) "Headline"))))
;; Case sensitivity.
(let ((org-quote-string "Quote"))
(should-not (org-element-property :quotedp (org-element-at-point)))))
(org-test-with-temp-text "* QUOTE Headline"
(let* ((org-quote-string "Quote")
(headline (org-element-at-point)))
(should-not (org-element-property :quotedp headline))
(should (equal (org-element-property :raw-value headline)
"QUOTE Headline"))))
;; With another keyword.
(org-test-with-temp-text "* TODO QUOTE Headline"
(let ((org-quote-string "QUOTE")
(org-todo-keywords '((sequence "TODO" "DONE"))))
(should (org-element-property :quotedp (org-element-at-point)))))
(let* ((org-quote-string "QUOTE")
(org-todo-keywords '((sequence "TODO" "DONE")))
(headline (org-element-at-point)))
(should (org-element-property :quotedp headline))
(should (equal (org-element-property :raw-value headline) "Headline"))))
;; With the keyword only.
(org-test-with-temp-text "* QUOTE"
(let ((org-quote-string "QUOTE"))
(should (org-element-property :quotedp (org-element-at-point))))))
(let* ((org-quote-string "QUOTE")
(headline (org-element-at-point)))
(should (org-element-property :quotedp headline))
(should (equal (org-element-property :raw-value headline) "")))))
(ert-deftest test-org-element/headline-comment-keyword ()
"Test COMMENT keyword recognition."
@ -765,23 +773,30 @@ CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] => 0:01"
(should-not (org-element-property :commentedp (org-element-at-point)))))
;; Standard position.
(org-test-with-temp-text "* COMMENT Headline"
(let ((org-comment-string "COMMENT"))
(let ((headline (org-element-at-point)))
(let ((org-comment-string "COMMENT")
(headline (org-element-at-point)))
(should (org-element-property :commentedp headline))
;; Test removal from raw value.
(should (equal (org-element-property :raw-value headline) "Headline"))))
;; Case sensitivity.
(let ((org-comment-string "Comment"))
(should-not (org-element-property :commentedp (org-element-at-point)))))
(org-test-with-temp-text "* COMMENT Headline"
(let* ((org-comment-string "Comment")
(headline (org-element-at-point)))
(should-not (org-element-property :commentedp headline))
(should (equal (org-element-property :raw-value headline)
"COMMENT Headline"))))
;; With another keyword.
(org-test-with-temp-text "* TODO COMMENT Headline"
(let ((org-comment-string "COMMENT")
(org-todo-keywords '((sequence "TODO" "DONE"))))
(should (org-element-property :commentedp (org-element-at-point)))))
(let* ((org-comment-string "COMMENT")
(org-todo-keywords '((sequence "TODO" "DONE")))
(headline (org-element-at-point)))
(should (org-element-property :commentedp headline))
(should (equal (org-element-property :raw-value headline) "Headline"))))
;; With the keyword only.
(org-test-with-temp-text "* COMMENT"
(let ((org-comment-string "COMMENT"))
(should (org-element-property :commentedp (org-element-at-point))))))
(let* ((org-comment-string "COMMENT")
(headline (org-element-at-point)))
(should (org-element-property :commentedp headline))
(should (equal (org-element-property :raw-value headline) "")))))
(ert-deftest test-org-element/headline-archive-tag ()
"Test ARCHIVE tag recognition."