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

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

[elpa] externals/org 654005394b: org-list-struct-apply-struct: Do not re


From: ELPA Syncer
Subject: [elpa] externals/org 654005394b: org-list-struct-apply-struct: Do not rely on `match-data' after edits
Date: Mon, 11 Jul 2022 07:57:50 -0400 (EDT)

branch: externals/org
commit 654005394b68cc1bf4ba8ff5791333fc3f080826
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org-list-struct-apply-struct: Do not rely on `match-data' after edits
    
    * lisp/org-list.el (org-list-struct-apply-struct): Refresh
    `org-list-full-item-re' match data if we edit the bullet.  Fixes
    
https://orgmode.org/list/62cbc0f3.1c69fb81.13d5e.e250SMTPIN_ADDED_BROKEN@mx.google.com
    * testing/lisp/test-org-list.el (test-org-list/indent-item): Add test
    checking for the reported bug.
---
 lisp/org-list.el              |  3 +++
 testing/lisp/test-org-list.el | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/lisp/org-list.el b/lisp/org-list.el
index e2c3fad7c5..0f0aaefdc3 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -1953,6 +1953,9 @@ Initial position of cursor is restored after the changes."
                     (goto-char (match-end 1))
                     (insert-before-markers new-bul)
                     (insert keep-space))))
+              ;; Refresh potentially shifted match markers.
+              (goto-char item)
+              (looking-at org-list-full-item-re)
              ;; b.  Replace checkbox.
              (cond
               ((equal (match-string 3) new-box))
diff --git a/testing/lisp/test-org-list.el b/testing/lisp/test-org-list.el
index da1841e73e..cab2937126 100644
--- a/testing/lisp/test-org-list.el
+++ b/testing/lisp/test-org-list.el
@@ -309,6 +309,16 @@
            (buffer-string))))
   (should
    (equal "
+- [ ] list item 1
+  + [ ] list item 2"
+          (org-test-with-temp-text "
+- [ ] list item 1
+- [ ] list item 2<point>"
+            (let ((org-list-demote-modify-bullet '(("-" . "+"))))
+              (org-indent-item)
+              (buffer-string)))))
+  (should
+   (equal "
 1. Item 1
    + Item 2"
          (org-test-with-temp-text "



reply via email to

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