I'd like to use ERT with Emacs23. ERT is bundled with Emacs24. Latest version of ERT does not work with Emacs23 because of lack of define-error.

Is there an offical way of using ERT with Emacs23?

  • Copy-paste one from Emacs 24.4. It's only a convenience function and should work in Emacs 23.3. Commented Jan 22, 2015 at 20:43
  • It is not working. Commented Jan 22, 2015 at 22:13

2 Answers 2


You can obtain legacy ERT versions for use with Emacs 23 from the old repository of ERT, at commit fb3c278d. Note that this version significantly differs from recent ERT versions. Notably, it lacks test skipping, and many bug fixes.

I would not copy ERT from Emacs 24, though. In recent Emacs releases, ERT uses lexical-binding: t, so the code may easily depend on lexical binding to work correctly, which is simply not available on Emacs 23.

And generally, I'd not write new test suites for Emacs 23 anymore. It's just not worth the effort, imho. The last release of Emacs 23 was three years ago, and we are—albeit slowly—heading towards Emacs 25.

  • Meanwhile latest Mac OS X comes with preinstalled Emacs: GNU Emacs 22.1.1 (mac-apple-darwin) of 2014-04-18 on osx102.apple.com Copyright (C) 2007 Free Software Foundation, Inc. I'm trying to gauge how much effort is it to support Emacs23. Does not have to be 100% working, just should not horribly break. Commented Jan 22, 2015 at 21:55
  • @GracjanPolak I don't think that anyone still uses this Emacs version on OS X. It's easy enough to install a decent one...
    – user227
    Commented Jan 22, 2015 at 22:36

Answer for other lost souls:

mkdir compat
git clone git://git.savannah.gnu.org/emacs.git
cd emacs
git show bc715d67b3997988e2a48286410d45404e49342c:lisp/emacs-lisp/ert.el > ../compat/ert.el
cd ../compat
curl -L http://elpa.gnu.org/packages/cl-lib-0.5.el -o cl-lib.el

Now add compat to load-path either by using -L command line switch or by using (add-to-list 'load-path (expand-file-name "compat").

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.