Nicolas Goaziou <[email protected]> writes:
> AFAICT, `newline-and-indent' doesn't accept any argument. Keeping it
> introduces a build warning and test failures. Hence the removal.
>
> Since you were calling it with an argument I assume this may be
> a novelty in Emacs 27.
Wow, you're right. That caught me off-guard.
> However Org still supports Emacs 24.4. If that's
> the case, we need an additional compatibility layer to support both
> cases. WDYT?
I don't know if we want to jump through these hoops for a feature that
people have done without so far? FWIW though, the following patch seems
to work ("make test" works with both 26.3 and 28.0 on my end):
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 2b35535fa..ed12b9d18 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -102,6 +102,11 @@ is nil)."
(defun org-time-convert-to-list (time)
(seconds-to-time (float-time time))))
+(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
diff --git a/lisp/org.el b/lisp/org.el
index 8ad437a20..57e78599f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17649,12 +17649,12 @@ call `open-line' on the very first character."
(defun org--newline (indent arg interactive)
"Call `newline-and-indent' or just `newline'.
-If INDENT is non-nil, call `newline-and-indent' to indent
-unconditionally; otherwise, call `newline' with ARG and
-INTERACTIVE, which can trigger indentation if
+If INDENT is non-nil, call `newline-and-indent' with ARG (if
+supported) )to 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)
(I hope I got that right.)
> Meanwhile, I fixed the docstring. Thanks!
And thanks again.