mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-26 07:02:52 +00:00
Merge branch 'maint'
This commit is contained in:
commit
0be044736c
|
@ -7570,7 +7570,8 @@ This is important for non-interactive uses of the command."
|
||||||
(and (ignore-errors (org-back-to-heading invisible-ok))
|
(and (ignore-errors (org-back-to-heading invisible-ok))
|
||||||
(org-at-heading-p))))
|
(org-at-heading-p))))
|
||||||
(or arg (not itemp))))
|
(or arg (not itemp))))
|
||||||
;; At beginning of buffer or so hight up that only a heading makes sense.
|
;; At beginning of buffer or so high up that only a heading
|
||||||
|
;; makes sense.
|
||||||
(insert
|
(insert
|
||||||
(if (or (bobp) (org-previous-line-empty-p)) "" "\n")
|
(if (or (bobp) (org-previous-line-empty-p)) "" "\n")
|
||||||
(if (org-in-src-block-p) ",* " "* "))
|
(if (org-in-src-block-p) ",* " "* "))
|
||||||
|
@ -7632,9 +7633,9 @@ This is important for non-interactive uses of the command."
|
||||||
(org-end-of-subtree nil t)
|
(org-end-of-subtree nil t)
|
||||||
(skip-chars-backward " \r\n")
|
(skip-chars-backward " \r\n")
|
||||||
(and (looking-at "[ \t]+") (replace-match ""))
|
(and (looking-at "[ \t]+") (replace-match ""))
|
||||||
(forward-char 1)
|
(unless (eobp) (forward-char 1))
|
||||||
(when (looking-at "^\\*")
|
(when (looking-at "^\\*")
|
||||||
(backward-char 1)
|
(unless (bobp) (backward-char 1))
|
||||||
(insert "\n")))
|
(insert "\n")))
|
||||||
|
|
||||||
;; If we are splitting, grab the text that should be moved to the new headline
|
;; If we are splitting, grab the text that should be moved to the new headline
|
||||||
|
@ -7770,7 +7771,7 @@ This is a list with the following elements:
|
||||||
"Insert TODO heading with `org-insert-heading-respect-content' set to t."
|
"Insert TODO heading with `org-insert-heading-respect-content' set to t."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(let ((org-insert-heading-respect-content t))
|
(let ((org-insert-heading-respect-content t))
|
||||||
(org-insert-todo-heading force-state t)))
|
(org-insert-todo-heading force-state '(4))))
|
||||||
|
|
||||||
(defun org-insert-todo-heading (arg &optional force-heading)
|
(defun org-insert-todo-heading (arg &optional force-heading)
|
||||||
"Insert a new heading with the same level and TODO state as current heading.
|
"Insert a new heading with the same level and TODO state as current heading.
|
||||||
|
|
|
@ -407,6 +407,28 @@
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(looking-at "- $")))))
|
(looking-at "- $")))))
|
||||||
|
|
||||||
|
(ert-deftest test-org/insert-todo-heading-respect-content ()
|
||||||
|
"Test `org-insert-todo-heading-respect-content' specifications."
|
||||||
|
;; Create a TODO heading.
|
||||||
|
(should
|
||||||
|
(org-test-with-temp-text "* H1\n Body"
|
||||||
|
(org-insert-todo-heading-respect-content)
|
||||||
|
(nth 2 (org-heading-components))))
|
||||||
|
;; Add headline after body of current subtree.
|
||||||
|
(should
|
||||||
|
(org-test-with-temp-text "* H1\nBody"
|
||||||
|
(org-insert-todo-heading-respect-content)
|
||||||
|
(eobp)))
|
||||||
|
(should
|
||||||
|
(org-test-with-temp-text "* H1\n** H2\nBody"
|
||||||
|
(org-insert-todo-heading-respect-content)
|
||||||
|
(eobp)))
|
||||||
|
;; In a list, do not create a new item.
|
||||||
|
(should
|
||||||
|
(org-test-with-temp-text "* H\n- an item\n- another one"
|
||||||
|
(search-forward "an ")
|
||||||
|
(org-insert-todo-heading-respect-content)
|
||||||
|
(and (eobp) (org-at-heading-p)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue