Browse Source

compat: Add `org-newline-and-indent'

* lisp/org-compat.el (org-newline-and-indent): New function.
* lisp/org.el (org--newline): Use new function.
Kévin Le Gouguec 2 months ago
parent
commit
e47b053d9a
2 changed files with 7 additions and 1 deletions
  1. 6 0
      lisp/org-compat.el
  2. 1 1
      lisp/org.el

+ 6 - 0
lisp/org-compat.el

@@ -102,6 +102,12 @@ is nil)."
   (defun org-time-convert-to-list (time)
     (seconds-to-time (float-time time))))
 
+;; `newline-and-indent' did not take a numeric argument before 27.1.
+(if (version< emacs-version "27")
+    (defsubst org-newline-and-indent (&optional _arg)
+      (newline-and-indent))
+  (defalias 'org-newline-and-indent #'newline-and-indent))
+
 
 ;;; Emacs < 26.1 compatibility
 

+ 1 - 1
lisp/org.el

@@ -17654,7 +17654,7 @@ indent unconditionally; otherwise, call `newline' with ARG and
 INTERACTIVE, which can trigger indentation if
 `electric-indent-mode' is enabled."
   (if indent
-      (newline-and-indent)
+      (org-newline-and-indent arg)
     (newline arg interactive)))
 
 (defun org-return (&optional indent arg interactive)