emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org ba8c468634 2/2: org-insert-todo-heading-respect-con


From: ELPA Syncer
Subject: [elpa] externals/org ba8c468634 2/2: org-insert-todo-heading-respect-content: Fix regression in b4e41b
Date: Wed, 7 Jun 2023 09:59:09 -0400 (EDT)

branch: externals/org
commit ba8c4686347a0411ab84e89232b64e3ee1ef10f9
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    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
---
 etc/ORG-NEWS             |  4 ++++
 lisp/org.el              | 10 ++++++----
 testing/lisp/test-org.el | 18 +++++++++++++++++-
 3 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index ddf1e91101..7e70150640 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -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
diff --git a/lisp/org.el b/lisp/org.el
index 9eac34cdc6..e69d24de5b 100644
--- a/lisp/org.el
+++ b/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.
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 54f0b87f3e..1c283dde72 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -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'."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]