Function: ensure-list
ensure-list is a byte-compiled function defined in subr.el.gz.
Signature
(ensure-list OBJECT)
Documentation
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.
Other relevant functions are documented in the list group.
Probably introduced at or before Emacs version 28.1.
Shortdoc
;; list
(ensure-list "foo")
=> ("foo")
(ensure-list '(1 2 3))
=> (1 2 3)
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun 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."
(if (listp object)
object
(list object)))