From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#58801: [PATCH] Autoload the `calc-eval-error' variable Date: Thu, 7 Sep 2023 00:51:57 -0700 Message-ID: References: <87fsfaa56t.fsf@rfc20.org> <8735ak6pq7.fsf@rfc20.org> <87o7std54i.fsf@rfc20.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30988"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58801@debbugs.gnu.org To: Matt Armstrong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 07 09:53:16 2023 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 1qe9pD-0007rO-Pp for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 07 Sep 2023 09:53:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qe9p3-0007My-RD; Thu, 07 Sep 2023 03:53:06 -0400 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 1qe9oy-0007Me-VR for bug-gnu-emacs@gnu.org; Thu, 07 Sep 2023 03:53:00 -0400 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 1qe9oy-0007TY-Kv for bug-gnu-emacs@gnu.org; Thu, 07 Sep 2023 03:53:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qe9p0-0007B9-4T for bug-gnu-emacs@gnu.org; Thu, 07 Sep 2023 03:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Sep 2023 07:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58801 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58801-submit@debbugs.gnu.org id=B58801.169407313227523 (code B ref 58801); Thu, 07 Sep 2023 07:53:02 +0000 Original-Received: (at 58801) by debbugs.gnu.org; 7 Sep 2023 07:52:12 +0000 Original-Received: from localhost ([127.0.0.1]:38443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qe9oB-00079q-5b for submit@debbugs.gnu.org; Thu, 07 Sep 2023 03:52:12 -0400 Original-Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]:46289) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qe9o5-00079I-Pc for 58801@debbugs.gnu.org; Thu, 07 Sep 2023 03:52:09 -0400 Original-Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5007c8308c3so1041925e87.0 for <58801@debbugs.gnu.org>; Thu, 07 Sep 2023 00:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694073118; x=1694677918; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=Wo8fpwsrvwtwH6GXh4OAAwlZEcwqlzyJjyxbo6ce5zo=; b=YwSaoTUbmdAGACTNKgO6eEiPithfmQl6lwr5FJZbAKFTr1dvHZa9bUaa5xMpoOG29f 1FafUyex1fKrs3JbeNGLgNYvpl1fDSGt4IUAnrQHOfkfHL+EWIryHT5zFzB457QxYznv 5jBOafyXQJNbZB6KyiyfgK/CgfoxTJ7Od9UyFHNqHmBRhrkg+7XG8kRh0DOp0irbrXJQ 2lIJtt3RwZhqqLOCyt4MwNFZEZ+wj0WQfAPW8NUhFSYhsyH5urNZtOGzFhmgg9OoD4WP KdlR+htBG50ZlefNRdYk3OXhfXULWUG0Tu5XlpQiDmabaE2/eiqQC1BiuEuST6DxwrpT HQfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694073118; x=1694677918; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Wo8fpwsrvwtwH6GXh4OAAwlZEcwqlzyJjyxbo6ce5zo=; b=QMFbeqhnbqfHhBDssiq3sfhIBVzyOd/h+MgCJA0fg4UzBCxMzIK//+uazqRoJANtQO a2wPwf8yWS6EJAyR2L/1b+V+QiAEw5bBtvXfU9P2MNT2INLj71DHHBbO5ezNWE6bqz6P E2IUP/MvnBa0uTl8uLJizDsW2E5g1+Mu18vrSi9grVfdBL1Vbhp5sxwvT2SksusTm/40 pR9jUW2NC9BNjdFfzIulUI2jHPNGM9ixR0A1ixJWzp6wTLa5xoS2rOhpJkcU2hCdGcL9 Al0xexzSi3NNEwd6Y0FlOL23O6yzyxRSnwccoKL672snBRzKnPFaQG4Db8LO4T+Mw4Iw bq7A== X-Gm-Message-State: AOJu0YwGlmtSJwIXb3beXWLzn3tXJfD9SxYFc+PFdDPVPbx/C08J5ca6 Mf0Yd7R+5PeaHwLVyNSHPqIZQncPXN4+pW6NPVAom0yWVw0= X-Google-Smtp-Source: AGHT+IEJhKvsWVzQ/IoUYeu4bZQEyBWERFbLm3jtuuvdjc6eENDh8cUfets76DpbdBopOSaATy6bWB6wUC6a45KzpBM= X-Received: by 2002:a19:6404:0:b0:4f8:5635:2cd8 with SMTP id y4-20020a196404000000b004f856352cd8mr4046829lfb.32.1694073117796; Thu, 07 Sep 2023 00:51:57 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 7 Sep 2023 00:51:57 -0700 In-Reply-To: <87o7std54i.fsf@rfc20.org> (Matt Armstrong's message of "Sat, 26 Nov 2022 08:58:53 -0800") 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:269612 Archived-At: Matt Armstrong writes: > Stefan Kangas writes: > >> Matt Armstrong writes: >> >>> Note that in my case I had (require 'calc) in the file that used the >>> `calc-eval-error' symbol. The info docs for calc state that (require >>> 'calc) loads nearly everything you need from calc. I may not understand >>> something about the design constraints here, but it seems strange to >>> refrain from autoloading this symbol, since (require 'calc) already >>> (auto)loads a *lot* of stuff. >> >> So you are saying that if you have a file foo.el, that requires calc, >> and then tries to use calc-eval-error variable (documented as part of >> the external API), you get a byte-compiler warning? >> >> I agree that this doesn't sound very intuitive. > > I regret typing about `require' at all, as my line of argument is > simpler than that. > > Running "emacs -Q" comes with `calc-eval' autoloaded. Since calc > documentation mentions `calc-eval-error' as a configuration variable for > the `calc-eval' behavior, it is makes most sense to autoload either > neither of them or both of them. Thanks, now I understand the situation better. We typically avoid autoloading variables, and I'm not sure it's justified here. See (info "(elisp) When to Autoload") for details. Could we instead just declare it in calc.el? I believe that should silence any warnings from the byte-compiler. It's a one line change: (defvar calc-eval-error) Or will that not work in your use case for some reason? > (In the particular case of the Calc package, dozens of functions and > variables are already autoloaded. The omission of `calc-eval-error' > also seems more an oversight than intentional.) FWIW, I couldn't find any autoloaded variables in calc-loaddefs.el. What am I missing?