Here's my declare-function form in file A:

(declare-function 'my-function "file-B" (my-func-arg &optional args))

and here's the definition of my-function in file B:

(defun my-function (my-func-arg &optional args)

During compilation, I receive the following warning:

file-A.el:1223:1:Warning: the function ‘my-function’ is not
    known to be defined.

It was my understanding that when the byte compiler sees the declare-function form, it assumes from there on that my-function is defined. Running M-x check-declare-file on file-A succeeds, so what's gone wrong?

  • I think it's because you're quoting 'my-function, which is unnecessary because declare-function is a macro. See (elisp) Declaring Functions.
    – Basil
    Jan 20, 2018 at 18:14
  • @Basil doh! yes, it's a macro. I must've been blind to that little quote – let me give it a shot. Jan 20, 2018 at 18:15
  • @Basil Yep, that was it; do you want to convert your comment to an answer? Jan 20, 2018 at 18:18
  • I don't claim authority on this, but IME simple support issues like this can just be closed as they offer limited help to other users. I lack a strong opinion on this.
    – Basil
    Jan 20, 2018 at 18:20
  • Too bad there's no 'too localized' option like that which existed on TeX.SX years ago… Jan 20, 2018 at 18:26

1 Answer 1


You shouldn't quote the first argument to declare-function, as it is a macro; i.e. it receives its arguments implicitly quoted and unevaluated. See also (elisp) Declaring Functions.

This should work:

(declare-function my-function "file-B" (my-func-arg &optional args))

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.