branch: externals/org
commit 2732be62368f586b36fd9cb894d124ff521f64dd
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    org-indent-line: Amalgamate indentation into a single undo operation
    
    * lisp/org.el (org-indent-line): Use `with-undo-amalgamate' when
    indenting inside src block.
    
    Reported-by: the_wurfkreuz <[email protected]>
    Link: 
https://orgmode.org/list/um5eHR8bLcJ0ZZWZj8_y-a4LyjHgZ3Ca2JNVRmDrJnvE278tiyU8xyFVu1vI9zO-BcIde6Y8VUcV6xmjTC4Mx_j7QUIkEW24HDOPqqtzsqg=@proton.me
---
 lisp/org.el | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 55351fe478..5c97d13c4d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19606,16 +19606,17 @@ Also align node properties according to 
`org-property-format'."
                            org-edit-src-content-indentation)))))
                ;; Avoid over-indenting when beginning of a new line is not 
empty.
                ;; https://list.orgmode.org/[email protected]/
-               (when block-content-ind
-                 (save-excursion (indent-line-to block-content-ind)))
-               (ignore-errors ; do not err when there is no proper major mode
-                 ;; It is important to call `indent-according-to-mode'
-                 ;; rather than `indent-line-function' here or we may
-                 ;; sometimes break `electric-indent-mode'
-                 ;; 
https://orgmode.org/list/5O9VMGb6WRaqeHR5_NXTb832Z2Lek_5L40YPDA52-S3kPwGYJspI8kLWaGtuq3DXyhtHpj1J7jTIXb39RX9BtCa2ecrWHjijZqI8QAD742U=@proton.me
-                 (org-babel-do-in-edit-buffer (indent-according-to-mode)))
-               (when (and block-content-ind (looking-at-p "^$"))
-                 (indent-line-to block-content-ind))))
+               (with-undo-amalgamate
+                 (when block-content-ind
+                   (save-excursion (indent-line-to block-content-ind)))
+                 (ignore-errors ; do not err when there is no proper major mode
+                   ;; It is important to call `indent-according-to-mode'
+                   ;; rather than `indent-line-function' here or we may
+                   ;; sometimes break `electric-indent-mode'
+                   ;; 
https://orgmode.org/list/5O9VMGb6WRaqeHR5_NXTb832Z2Lek_5L40YPDA52-S3kPwGYJspI8kLWaGtuq3DXyhtHpj1J7jTIXb39RX9BtCa2ecrWHjijZqI8QAD742U=@proton.me
+                   (org-babel-do-in-edit-buffer (indent-according-to-mode)))
+                 (when (and block-content-ind (looking-at-p "^$"))
+                   (indent-line-to block-content-ind)))))
            (t
             (let ((column (org--get-expected-indentation element nil)))
               ;; Preserve current column.

Reply via email to