M etc/ORG-NEWS => etc/ORG-NEWS +4 -0
@@ 189,6 189,10 @@ publishing" in the ~org-export-dispatch~ UI to be customized,
respectively.
** New features
+*** ~org-insert-todo-heading-respect-content~ now accepts prefix arguments
+
+The prefix arguments are passed to ~org-insert-todo-heading~.
+
*** Add support for ~logind~ idle time in ~org-user-idle-seconds~
When Emacs is built with =dbus= support and
M lisp/org.el => lisp/org.el +6 -4
@@ 6512,11 6512,13 @@ Set it to HEADING when provided."
(interactive)
(org-insert-heading '(4) invisible-ok))
-(defun org-insert-todo-heading-respect-content (&optional _)
- "Insert TODO heading with `org-insert-heading-respect-content' set to t."
- (interactive)
+(defun org-insert-todo-heading-respect-content (&optional arg)
+ "Call `org-insert-todo-heading', inserting after current subtree.
+ARG is passed to `org-insert-todo-heading'.
+This command temporarily sets `org-insert-heading-respect-content' to t."
+ (interactive "P")
(let ((org-insert-heading-respect-content t))
- (org-insert-todo-heading '(4) t)))
+ (org-insert-todo-heading arg t)))
(defun org-insert-todo-heading (arg &optional force-heading)
"Insert a new heading with the same level and TODO state as current heading.
M testing/lisp/test-org.el => testing/lisp/test-org.el +17 -1
@@ 2025,7 2025,23 @@ CLOCK: [2022-09-17 sam. 11:00]--[2022-09-17 sam. 11:46] => 0:46"
"* TODO \n"
(org-test-with-temp-text "* TODO\n** WAITING\n"
(org-insert-todo-heading-respect-content)
- (buffer-substring-no-properties (line-beginning-position) (point-max))))))
+ (buffer-substring-no-properties (line-beginning-position) (point-max)))))
+ (should
+ (equal
+ "* TODO \n"
+ (let ((org-todo-keywords '((sequence "FIRST" "TODO" "|" "DONE"))))
+ (org-test-with-temp-text "* TODO\n** WAITING\n"
+ (org-insert-todo-heading-respect-content)
+ (buffer-substring-no-properties (line-beginning-position) (point-max))))))
+ ;; Pass prefix argument.
+ (should
+ (equal
+ "* FIRST \n"
+ (let ((org-todo-keywords '((sequence "FIRST" "TODO" "|" "DONE"))))
+ (org-test-with-temp-text "* TODO\n** WAITING\n"
+ (org-insert-todo-heading-respect-content '(4))
+ (buffer-substring-no-properties (line-beginning-position) (point-max))))))
+ )
(ert-deftest test-org/clone-with-time-shift ()
"Test `org-clone-subtree-with-time-shift'."