[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to avoid "unknown function" warning for *very* optional function
From: |
Konstantin Kharlamov |
Subject: |
Re: How to avoid "unknown function" warning for *very* optional functional |
Date: |
Sat, 10 Feb 2024 11:55:14 +0300 |
User-agent: |
Evolution 3.50.3 |
Thank you, that works!
On Sat, 2024-02-10 at 01:08 +0100, Joost Kremers wrote:
>
> On Sat, Feb 10 2024, Konstantin Kharlamov wrote:
> > I'm fixing warnings in some of Emacs packages I'm using, and I
> > found in
> > `meson-mode` this construct:
> >
> > (defun meson-lookup-doc (identifier)
> > …
> > (when (bound-and-true-p evil-mode)
> > (evil-local-set-key 'normal (kbd "q") 'bury-buffer)))
> > …
> >
> > This basically a small help to those using both evil-mode and
> > `meson-mode`. And this
> > triggers a byte-compilation warning:
> >
> > meson-mode.el:958:12: Warning: the function ‘evil-local-set-
> > key’ is not known to be defined.
> >
> > I'm not exactly sure what's the proper way to fix this? It's not
> > even an optional
> > package, so `require` or `(cl-eval-when 'compile …` are not
> > suitable here. It's just
> > that: "change behavior in this one function if another mode is
> > present".
>
> You can use `declare-function` to let the byte-compiler know that the
> function
> exists but that there is no need to actually check to make sure.