From e47b053d9acdc5910fa8810a117224868ff9a999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= Date: Thu, 7 May 2020 21:34:32 +0200 Subject: [PATCH] compat: Add `org-newline-and-indent' * lisp/org-compat.el (org-newline-and-indent): New function. * lisp/org.el (org--newline): Use new function. --- lisp/org-compat.el | 6 ++++++ lisp/org.el | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 2b35535fa..caaf5ce58 100644 --- a/lisp/org-compat.el +++ b/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 diff --git a/lisp/org.el b/lisp/org.el index 5d5febe04..dd017e662 100644 --- a/lisp/org.el +++ b/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)