How do I fix this? cl-defstruct is an autoloaded macro in /usr/local/share/emacs/28.2/lisp/emacs-lisp/cl-macs.elc, which is definitely in my load path (checked under an emacs session started with emacs -Q).

I already have flycheck-emacs-lisp-load-path set to inherit, and I can see the ...lisp/emacs-lisp directory in my load-path.

Similarly, let* and if-let*, also under that path are hidden from flycheck.

1 Answer 1


You need (require cl-lib) before you use cl-defstruct in your library (or wherever you use cl-defstruct).

Check the bottom of cl-macs.el. There will you find:

;; Local variables:
;; generated-autoload-file: "cl-loaddefs.el"
;; End:

I.e., the autoloads go into cl-loaddefs.el.

Now check cl-lib.el. There you will find:

(unless (load "cl-loaddefs" 'noerror 'quiet)
  ;; When bootstrapping, cl-loaddefs hasn't been built yet!
  (require 'cl-macs)
  (require 'cl-seq))

Only the (load "cl-loaddefs" 'noerror 'quiet) is really interesting for us. This makes the autoloads from cl-loaddefs known to Emacs.

  • Thank you! I found admonishment to use (eval-when-compile (require 'subr-x)), which solved the let* and if-let* issues.
    – petermao
    Commented Feb 14, 2023 at 2:30

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.