From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#69120: Spurious "function is not known to be defined" if defined in `use-package` body Date: Wed, 14 Feb 2024 17:23:02 +0200 Message-ID: <86eddfxe7d.fsf@gnu.org> References: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38038"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69120@debbugs.gnu.org To: Konstantin Kharlamov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 14 16:24:04 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1raH7E-0009h9-8P for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Feb 2024 16:24:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raH6w-0001Bi-4c; Wed, 14 Feb 2024 10:23:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raH6u-0001BZ-Mg for bug-gnu-emacs@gnu.org; Wed, 14 Feb 2024 10:23:44 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1raH6u-0001yG-Ep for bug-gnu-emacs@gnu.org; Wed, 14 Feb 2024 10:23:44 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1raH7C-00030S-G3 for bug-gnu-emacs@gnu.org; Wed, 14 Feb 2024 10:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Feb 2024 15:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69120 X-GNU-PR-Package: emacs Original-Received: via spool by 69120-submit@debbugs.gnu.org id=B69120.170792421011512 (code B ref 69120); Wed, 14 Feb 2024 15:24:02 +0000 Original-Received: (at 69120) by debbugs.gnu.org; 14 Feb 2024 15:23:30 +0000 Original-Received: from localhost ([127.0.0.1]:52766 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raH6g-0002zc-2w for submit@debbugs.gnu.org; Wed, 14 Feb 2024 10:23:30 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48976) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raH6d-0002zP-Oq for 69120@debbugs.gnu.org; Wed, 14 Feb 2024 10:23:28 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raH6G-0001sN-7K; Wed, 14 Feb 2024 10:23:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=SZ+KNHf/HJn3WFkfyDaG7wkdrf7sHZmYrJl8F15OhNQ=; b=mv7DpsJScgQAP7FVadeH yTnBxe2NUXfANPTcWL77wUQt9I5e+1TCf3uvwBz5iKNRDSOo3Lku+nBck/uxSQha5oBM4oaWAc+i3 /zNxuqTUcgUFyCuvR9qtMQUzT2mtMngbEmyt6YRvfja8egkABOdEz+CWkc0nD5hQI4rLBjzK9r+Nr g5VzpQoKpY6cuVjrlGH2pDzpY57J5sJBQiXe0rKtfo9e5e6639nfTbiUrXMdha6u7HLpmxo9XCNKF 7N1VJQingFZT03m1WlM8KT40uZkrsoXt/N3W6jmfv6Jf+9a3BT8Kd9BhczUJpzuR/HrJpeu/wz5KU WLa+dC3CNMNR0Q==; In-Reply-To: <7f4f61be9fbdb5d07b9420d9b75a7ed9d1522744.camel@yandex.ru> (message from Konstantin Kharlamov on Wed, 14 Feb 2024 14:16:09 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280009 Archived-At: > From: Konstantin Kharlamov > 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. What do you get if you macro-expand your code?