Fix property drawer insertion with consecutive headlines

* lisp/org.el (org-get-property-block): Fix property drawer insertion
  with consecutive headlines
* testing/lisp/test-org.el (test-org/entry-put): Add test.

Thanks to Eric Abrahamsen for reporting it.
This commit is contained in:
Nicolas Goaziou 2014-10-14 21:18:44 +02:00
parent 1aad53bd39
commit 705a2cdeab
2 changed files with 8 additions and 1 deletions

View File

@ -15337,6 +15337,7 @@ return nil."
(cons (point) (progn (goto-char (match-end 0))
(line-beginning-position))))
(force
(goto-char beg)
(org-insert-property-drawer)
(let ((pos (save-excursion (search-forward ":END:")
(line-beginning-position))))

View File

@ -2366,7 +2366,13 @@ Text.
(string-match "^ *:A: +1$"
(org-test-with-temp-text "* H"
(org-entry-put (point) "A" "1")
(buffer-string)))))
(buffer-string))))
;; Special case: two consecutive headlines.
(should
(string-match "\\* A\n *:PROPERTIES:"
(org-test-with-temp-text "* A\n** B"
(org-entry-put (point) "A" "1")
(buffer-string)))))
;;; Radio Targets