From c737d6ed774746fde4ad0fc1447f92980b9ecc07 Mon Sep 17 00:00:00 2001 From: TEC Date: Sun, 19 Feb 2023 12:28:31 +0800 Subject: [PATCH] org-compat: Add ensure-list as org-ensure-list * lisp/org-compat.el (org-ensure-list): Add `ensure-list' from Emacs 28, as `org-ensure-list'. --- lisp/org-compat.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index bba21bd0e..bd9bf42e8 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -251,6 +251,18 @@ removed." default))) ": "))) +(if (fboundp 'ensure-list) + (defalias 'org-ensure-list #'ensure-list) + (defun org-ensure-list (object) + "Return OBJECT as a list. +If OBJECT is already a list, return OBJECT itself. If it's +not a list, return a one-element list containing OBJECT. + +Compatability substitute for `ensure-list' in Emacs 28." + (if (listp object) + object + (list object)))) + ;;; Emacs < 27.1 compatibility