mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 20:37:51 +00:00
Tiny fix
* lisp/org.el (org-N-empty-lines-before-current): Insert empty lines before point, not after. * testing/lisp/test-org.el (test-org/insert-heading): Add test.
This commit is contained in:
parent
4f578a3f7f
commit
79ac71d175
|
@ -7884,14 +7884,15 @@ unconditionally."
|
|||
(defun org-N-empty-lines-before-current (n)
|
||||
"Make the number of empty lines before current exactly N.
|
||||
So this will delete or add empty lines."
|
||||
(save-excursion
|
||||
(let ((column (current-column)))
|
||||
(beginning-of-line)
|
||||
(unless (bobp)
|
||||
(let ((start (save-excursion
|
||||
(skip-chars-backward " \r\t\n")
|
||||
(line-end-position))))
|
||||
(delete-region start (line-end-position 0))))
|
||||
(insert (make-string n ?\n))))
|
||||
(insert (make-string n ?\n))
|
||||
(move-to-column column)))
|
||||
|
||||
(defun org-get-heading (&optional no-tags no-todo no-priority no-comment)
|
||||
"Return the heading of the current entry, without the stars.
|
||||
|
|
|
@ -1354,7 +1354,15 @@
|
|||
(org-overview)
|
||||
(let ((org-blank-before-new-entry '((heading . nil))))
|
||||
(org-insert-heading '(4)))
|
||||
(invisible-p (line-end-position 0)))))
|
||||
(invisible-p (line-end-position 0))))
|
||||
;; Properly handle empty lines when forcing a headline below current
|
||||
;; one.
|
||||
(should
|
||||
(equal "* H1\n\n* H\n\n* \n"
|
||||
(org-test-with-temp-text "* H1\n\n* H<point>"
|
||||
(let ((org-blank-before-new-entry '((heading . t))))
|
||||
(org-insert-heading '(4))
|
||||
(buffer-string))))))
|
||||
|
||||
(ert-deftest test-org/insert-todo-heading-respect-content ()
|
||||
"Test `org-insert-todo-heading-respect-content' specifications."
|
||||
|
|
Loading…
Reference in a new issue