GNU bug report logs - #69120
Spurious "function is not known to be defined" if defined in `use-package` body

Previous Next

Package: emacs;

Reported by: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>

Date: Wed, 14 Feb 2024 11:17:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
To: 69120 <at> debbugs.gnu.org
Subject: bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body
Date: Wed, 14 Feb 2024 14:16:09 +0300
I have many functions that are only useful inside a specific mode. So I
group them with `use-package`, by defining them inside `:init` or
`:config` section, depending on the use.

It turns out, byte-compiler does not consider such functions to be
defined and prints a warning about it.

# Steps to reproduce (in terms of terminal commands)

    λ cat test.el
    ;;; -*- lexical-binding: t -*-
    (use-package prog-mode
      :init
      (defun hello()
        (print "hello"))
      (hello))
    λ emacs -batch -f batch-byte-compile test.el

    In end of data:
    test.el:6:4: Warning: the function ‘hello’ is not known to be defined.

## Expected

File gets compiled with no warnings

## Actual

There's a warning

    test.el:6:4: Warning: the function ‘hello’ is not known to be defined.

# Additional information

Emacs version: commit d4d5830f8a0 built two weeks ago from master.




This bug report was last modified 1 year and 125 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.