[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals-release/org 022bb471c1: org-indent-line: Fix indentatio
From: |
ELPA Syncer |
Subject: |
[elpa] externals-release/org 022bb471c1: org-indent-line: Fix indentation inside src blocks with `electric-indent-mode' |
Date: |
Tue, 9 Jul 2024 12:58:44 -0400 (EDT) |
branch: externals-release/org
commit 022bb471c1812bb146cf2807742577c5dfc32116
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
org-indent-line: Fix indentation inside src blocks with
`electric-indent-mode'
* lisp/org.el (org-indent-line): Use `indent-according-to-mode' to
indent in src block's major mode. Using `indent-line-function' fails
when `electric-indent-mode' wants to suppress <tab> indentation.
* testing/lisp/test-org.el (test-org/with-electric-indent): Add test.
Reported-by: the_wurfkreuz <the_wurfkreuz@proton.me>
Link:
https://orgmode.org/list/5O9VMGb6WRaqeHR5_NXTb832Z2Lek_5L40YPDA52-S3kPwGYJspI8kLWaGtuq3DXyhtHpj1J7jTIXb39RX9BtCa2ecrWHjijZqI8QAD742U=@proton.me
---
lisp/org.el | 6 +++++-
testing/lisp/test-org.el | 12 ++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/lisp/org.el b/lisp/org.el
index 4169a1f74c..5967ab27e7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19809,7 +19809,11 @@ Also align node properties according to
`org-property-format'."
(+ (org-current-text-indentation)
org-edit-src-content-indentation)))))
(ignore-errors ; do not err when there is no proper major mode
- (org-babel-do-in-edit-buffer (funcall indent-line-function)))
+ ;; 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
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index f21e52bfd4..2487c9ace6 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -1744,6 +1744,18 @@ CLOCK: [2022-09-17 sam. 11:00]--[2022-09-17 sam. 11:46]
=> 0:46"
(electric-indent-local-mode 1)
(call-interactively 'org-return)
(buffer-string)))))
+ ;; Make sure that we do not mess things up when indenting remotely
+ ;; in src block buffer.
+ (let ((org-edit-src-content-indentation 2))
+ (should
+ ;; Add `org-edit-src-content-indentation' and no more.
+ ;;
https://orgmode.org/list/5O9VMGb6WRaqeHR5_NXTb832Z2Lek_5L40YPDA52-S3kPwGYJspI8kLWaGtuq3DXyhtHpj1J7jTIXb39RX9BtCa2ecrWHjijZqI8QAD742U=@proton.me
+ (equal "#+begin_src fundamental\n \n#+end_src" ; 2 spaces
+ (org-test-with-temp-text "#+begin_src
fundamental<point>\n#+end_src"
+ (electric-indent-local-mode 1)
+ (call-interactively 'org-return)
+ (should (looking-at-p "\n\\#"))
+ (buffer-string)))))
;; C-j, like `electric-newline-and-maybe-indent', should not indent.
(should
(equal " Para\ngraph"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals-release/org 022bb471c1: org-indent-line: Fix indentation inside src blocks with `electric-indent-mode',
ELPA Syncer <=