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

* lisp/org-compat.el (org-newline-and-indent): New function.
* lisp/org.el (org--newline): Use new function.
This commit is contained in:
Kévin Le Gouguec 2020-05-07 21:34:32 +02:00 committed by Nicolas Goaziou
parent e304d58978
commit e47b053d9a
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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)