Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2014-09-19 21:03:27 +02:00
commit 0620fe98cb
2 changed files with 12 additions and 7 deletions

View File

@ -7881,13 +7881,12 @@ command."
"Make the number of empty lines before current exactly N. "Make the number of empty lines before current exactly N.
So this will delete or add empty lines." So this will delete or add empty lines."
(save-excursion (save-excursion
(goto-char (point-at-bol)) (beginning-of-line)
(if (looking-back "\\s-+" nil 'greedy) (let ((p (point)))
(replace-match "")) (skip-chars-backward " \r\t\n")
(or (bobp) (insert "\n")) (unless (bolp) (forward-line))
(while (> N 0) (delete-region (point) p))
(insert "\n") (when (> N 0) (insert (make-string N ?\n)))))
(setq N (1- N)))))
(defun org-get-heading (&optional no-tags no-todo) (defun org-get-heading (&optional no-tags no-todo)
"Return the heading of the current entry, without the stars. "Return the heading of the current entry, without the stars.

View File

@ -731,6 +731,12 @@
(org-test-with-temp-text "Para<point>graph" (org-test-with-temp-text "Para<point>graph"
(let ((org-M-RET-may-split-line '((default . nil)))) (let ((org-M-RET-may-split-line '((default . nil))))
(org-insert-heading)) (org-insert-heading))
(buffer-string))))
;; Corner case: correctly insert a headline after an empty one.
(should
(equal "* \n* "
(org-test-with-temp-text "* <point>"
(org-insert-heading)
(buffer-string))))) (buffer-string)))))
(ert-deftest test-org/insert-todo-heading-respect-content () (ert-deftest test-org/insert-todo-heading-respect-content ()