Function: ensure-proper-list

ensure-proper-list is a byte-compiled function defined in compat-31.el.

Signature

(ensure-proper-list OBJECT)

Documentation

[Compatibility function for ensure-proper-list, defined in Emacs 31.0.50. See
(compat) Emacs 31.0.50' for more details.]

Return OBJECT as a list. If OBJECT is already a proper list, return OBJECT itself. If it's not a proper list, return a one-element list containing OBJECT.

ensure-list is usually preferable because that function runs in constant time, but this one has to traverse the whole of OBJECT.

Source Code

;; Defined in ~/.emacs.d/elpa/compat-31.0.0.2/compat-31.el
(compat-defun ensure-proper-list (object) ;; <compat-tests:ensure-proper-list>
  "Return OBJECT as a list.
If OBJECT is already a proper list, return OBJECT itself.  If it's not a
proper list, return a one-element list containing OBJECT.

`ensure-list' is usually preferable because that function runs in
constant time, but this one has to traverse the whole of OBJECT."
  (declare (side-effect-free error-free))
  (if (proper-list-p object)
      object
    (list object)))