unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body
@ 2024-02-14 11:16 Konstantin Kharlamov
  2024-02-14 15:23 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Konstantin Kharlamov @ 2024-02-14 11:16 UTC (permalink / raw)
  To: 69120

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.





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-02-15 15:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-14 11:16 bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body Konstantin Kharlamov
2024-02-14 15:23 ` Eli Zaretskii
2024-02-14 15:28   ` Konstantin Kharlamov
2024-02-14 16:07     ` Eli Zaretskii
2024-02-14 16:10       ` Konstantin Kharlamov
2024-02-14 16:38         ` Eli Zaretskii
2024-02-14 16:58           ` Konstantin Kharlamov
2024-02-15  3:57             ` Konstantin Kharlamov
2024-02-15  4:00               ` Konstantin Kharlamov
2024-02-15  6:51                 ` Eli Zaretskii
2024-02-15 15:21                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).