From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: Defvar not called at top level Date: Wed, 24 Nov 2021 11:47:16 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12495"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 24 11:58:14 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mppyf-0002yZ-2A for ged-emacs-devel@m.gmane-mx.org; Wed, 24 Nov 2021 11:58:13 +0100 Original-Received: from localhost ([::1]:44680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mppye-0004y2-1H for ged-emacs-devel@m.gmane-mx.org; Wed, 24 Nov 2021 05:58:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mppoD-0004YX-Bw for emacs-devel@gnu.org; Wed, 24 Nov 2021 05:47:25 -0500 Original-Received: from mail-db8eur05olkn2107.outbound.protection.outlook.com ([40.92.89.107]:59905 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mppo9-0001Ls-18 for emacs-devel@gnu.org; Wed, 24 Nov 2021 05:47:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aUTUWpNIieXgYHQFMLH1lOGIYX0PHe5Uzp5uw1ImSCamCeKHCxOIAdShNmwNp1zb7OZrlvOOd01uGDYuIj2E80VEHKQOjfSdb/cp/UyeYwJqILsKWzcrpXSYxGZ+MhCetik9xKyT98ndlWXckHnO5PoSS6HUwD6oQJdNpfmOolYuDovtkguGrkVYuRJ8531f19eNNbtJ5355VhL5X12uZS2JwItdorJIAR0elQWui4oH0bqp3R48LhwVzjPv/q3gxm/a1SIP21lRCLt2dT1x2UBRGqJEP5uvSmCo2VcKe7TuTQbWZWu1mD68bvvRBML2E5HTTc51fWAzWf40ugdpdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2LngLZEnXVM9hbOBsihvKnGWr4zKgbQm+ebj23KoYgI=; b=FBqdIcBxxWynJONBqkkipT42yXIKpG4zqGqrgBWMp1hc3faQQdTDDCDLyW5e9+GvJkYtHeM0Cva3jvzXI+CkxX4Jn59MXahcwI0fbUGmAn4TSKImGiVfsjQdCMOj6fGdcCrkdLSo101weQikbzoMSyVHxpqI5S9BsDgW+F2+ZoYed3PY1F+sfN0TaO9ooG818wjNUQDUNwsY9+4Fa6jUDmAb9EOxD6yW2QpD+i06bp8S5xgANLfrjxDFjk9/sI0UhICH8FwaxToK/1rkXmGNLvcYJSi4JqLFRRW4ito3a4ahzPc4jVivul4ZVC6kj+MGseD11DhR0L5vANFneltq1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2LngLZEnXVM9hbOBsihvKnGWr4zKgbQm+ebj23KoYgI=; b=pRdIVnvxA426frpAL3dpv4a8ALKtE8koOA3CT1YmZwIzgOQYzNiNkbW1RDtRNm/ImKNSuuo5drbcKcm/p11bIe9nNjIkYZ6q3z0sNvE7Ch/R3Vz3L9I1CkoIvSWzQWo1b7i9xhkYP49t1XUoEoXe34j26ta7ALTnKPqYFT7uzxDfy8og8NoBp5djmFtDcGKFZi203k6QedJdRkR1GMWluDnVQlZqT4IB2Cel2I5HRMoMrmz5w4OQn27vB75/PWr/WfcpYKFE3JEPpCsO41cSjd7gwR5a2pEWB6LgvD3QaJCMPsYLdpkwCaTuqS9bs2gEd+wZwtFTO0wmo2qfuibyFw== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM0PR09MB2897.eurprd09.prod.outlook.com (2603:10a6:208:131::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22; Wed, 24 Nov 2021 10:47:18 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c05b:e2ca:5b8a:56d2]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c05b:e2ca:5b8a:56d2%9]) with mapi id 15.20.4734.021; Wed, 24 Nov 2021 10:47:18 +0000 In-Reply-To: (Stefan Monnier's message of "Tue, 23 Nov 2021 08:58:22 -0500") X-TMN: [4PPKNbPAqyWwvtWOAS+n6jeo1tF0BJMG] X-ClientProxiedBy: AM5PR1001CA0021.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::34) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87lf1dq18r.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM5PR1001CA0021.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 24 Nov 2021 10:47:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3b328f68-0b07-4188-4612-08d9af37c84b X-MS-TrafficTypeDiagnostic: AM0PR09MB2897: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kJ/wW6KPZcTciGIf360Lk4YPg784zG7EOZBxVWGUaftSRy/dOGrwoTvpq5aTngv9ADvF8Zw1o/SgHZHVmcy+Fa9lYlSAsHNaCB/LkTs87mze2zAaxHa8sX1sm1nnDU41cTrQ+xjWehGxZdNdmHrc4YNkkSgB8UMzvduGRPe6tbsUKEfFXKVzdRHRqb8pe2RGjDqgAFdxRHzEvWILqeFAoMLLNPpz/6JaLQlaBe1OZLBUeHD4MoQ98HXOHyixispbUSnTH9nEorvcBaWFASAf7jR+m1V1haRVjZWYGj6k12dTv77+HW+UuA170MNIX/4FAm41BKUYeFI8bj2UPlMMzT4aesqJL5pwrXlUBIfhr8dxJJx3lJn3KOlkZ40y/0RqtPUJeTd0BwEAiMmO6xWD1yV/B9hC/lRfMkueSmhXGPqDruixRHIT0iUIzH9W95+LaG6sdgf9sA3exxZ5PDBZiMavDA4bjCDeN4iVAvlMAOtH9phVpbTvB8gVS0dLsZbXUZ79RlZrefA4LYHPJco7Gxxvh09MjEb9EGb5q5ighhCKhoFkJyBV2AkCK6K/YpFFN/GCpAC0WRE9QC5WovDGeQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mlJJ/hAhTLGYCSExlbh1msVjCrmaEoUA0+lUa8ZK4dIK8yMnZeSTPFHKDTSsDhByczvUGCTK4+rPi/MPih9meuq7Pj9Q9NWyrC0HY3D5nzDpoLscNkwuMgPUPSi3oBJSnqLb06BUInjFYIQmFtYTYYueKezZk2vw1bFn6VCkBSwTC9R8IqWFkVy0n5NQS33RHRZ4mU0QwwQLcHrBgrMnW8tSF9GxFmjXz/RAbrJlRApVjMyWOr+QC48lLLCnTNP6oWbcGFq89fUVfsWGq0MlqWrgJoZ3M8OFc+RIhhSmSAR37HSFb+qG1eirIcCMPhNyG6x9OUehhUOviqt+zcmErEkBWOw0dnFvPESEQkyvF1FTlTS0Zw2RQX59S0tEGxlPYLNOYLA/drh+duQrr7NStKyHrlbShCPMZvjzHaFANvIz0mxGHhXOB1fqvkWxA/opbPZqh+Lt3T7tk/Xww/A0ZgXELNV/L3TZlnWvmLBXuTiCb/4i1U8748SBei8vVbcPBsg0eKrkD0NGEh3bFLseCp7qzHTFu72VHgkc+7eGqYBTOPqqwnagexOQ1kBcA+IJLzdi0Gf2QkSusrWqjwuMr+pLwWTldv6iz12NGezd4/XOZ5otYhJnveQvrp3fepYPO/2+xSsMBs/vdyqO2mkSnd1c0Sv8zKJaDnQK1NuoOJyQPZaneRoOeseK0Hdezkux35/iFzlTeQsayfWYej8CxA== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 3b328f68-0b07-4188-4612-08d9af37c84b X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2021 10:47:18.0907 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR09MB2897 Received-SPF: pass client-ip=40.92.89.107; envelope-from=arthur.miller@live.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:279988 Archived-At: Stefan Monnier writes: > Arthur Miller [2021-11-23 14:28:04] wrote: >> Just a question: why is it important to call defvar from top level? >> I would like to have some code that generates some other code, amongs that to >> declare few global symbols with auto generated docs as well. > > Presumably you can do this with > > (defmacro FOO (..) ... `(defvar ...) ...) > > (FOO ...) > >> If I call those from a defun/macro normally I get that warning that defvar is >> not called at top level; > > Can you show the actual warning? Thank you for the answer; it seems like I can't :). I am sorry, I had too many things in my head and confused things. It was not "defvar" it was "defvar-local". I appologize. This one: (defun byte-compile-make-variable-buffer-local (form) (if (and (eq (car-safe (car-safe (cdr-safe form))) 'quote) (byte-compile-warning-enabled-p 'make-local)) (byte-compile-warn "`make-variable-buffer-local' not called at toplevel")) (byte-compile-normal-call form)) I copy-pasted a bunch of defvar-local statements somewhere into a defun to save some typing; and I got that warning, so I have put them back. By the way after second thought I think I understand why it could be bad thing, but I am not sure: if a form would be evaluated in a non-buffer context?