In order to include Common Lisp compatibility I've seen both

(require 'cl)


(require 'cl-lib)

Which is correct? As I understand the cl-lib is the later of the two, but is it safe to use just it?


1 Answer 1


The first is the old library, the second is the new one.

The old one defines things like defstruct, symbol-macrolet, incf, whereas the second defines instead cl-defstruct, cl-symbol-macrolet, and cl-incf.

The old one is deprecated because it does not obey the general rule that packages should use a "package prefix" for all their definitions to try and avoid conflicts with other packages. IOW the old one messes up the namespace whereas the new one is careful to only use identifiers which start with cl-.

Old versions of Emacs only come with cl but you can install the cl-lib forward-compatibility package from GNU ELPA which internally uses the old cl and just re-exports the same definitions under their new name.

New versions of Emacs come with a real cl-lib which does not use cl internally and instead they have a cl backward-compatibility package which internally uses cl-lib and just re-exports the same definitions under their old name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.