org-insert-todo-heading-respect-content: Fix regression in b4e41b
* lisp/org.el (org-insert-todo-heading-respect-content): Do not force first TODO keyword in the inserted heading. Instead, accept prefix arguments and pass them directly to `org-insert-todo-heading'. * etc/ORG-NEWS (~org-insert-todo-heading-respect-content~ now accepts prefix arguments): Document the change. * testing/lisp/test-org.el (test-org/insert-todo-heading-respect-content): Add tests. Reported-by: Xuan Wang <xuan.public@gmail.com> Link: https://orgmode.org/list/CALjN2yehOVYZuU+tURes+mJ5XyTrRY1O0UG1ijH-6TjJ=W0ibw@mail.gmail.com
This commit is contained in:
parent
661a98f891
commit
ba8c468634
|
@ -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
|
||||
|
|
10
lisp/org.el
10
lisp/org.el
|
@ -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.
|
||||
|
|
|
@ -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'."
|
||||
|
|
Loading…
Reference in New Issue