From 705a2cdeab8da1a9a736039886ee8f46f5bc5358 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 14 Oct 2014 21:18:44 +0200 Subject: [PATCH] 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. --- lisp/org.el | 1 + testing/lisp/test-org.el | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 96829a7d5..c940b2ad3 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -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)))) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 831fa3c14..7a49510ee 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -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 -- 2.11.4.GIT