From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oGpNArWJMGIhkwAAgWs5BA (envelope-from ) for ; Tue, 15 Mar 2022 13:42:29 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id KKJuOrSJMGJEWQAAauVa8A (envelope-from ) for ; Tue, 15 Mar 2022 13:42:28 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8C438322D6 for ; Tue, 15 Mar 2022 13:42:28 +0100 (CET) Received: from localhost ([::1]:38876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nU6VP-0000DZ-Og for larch@yhetil.org; Tue, 15 Mar 2022 08:42:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nU6P3-0003qI-Qm for emacs-orgmode@gnu.org; Tue, 15 Mar 2022 08:35:53 -0400 Received: from mail-oln040092069054.outbound.protection.outlook.com ([40.92.69.54]:27014 helo=EUR02-VE1-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 1nU6P1-0004P4-LO for emacs-orgmode@gnu.org; Tue, 15 Mar 2022 08:35:53 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OBB3qcotnGQx6DCn++BO3oG4AySBnKxjZqYn3kXpmAAu0ecuLMfJgc+D/2eJs1ZZ5Q+CjEEnKSsOUspwi20/8MxHINF08/ncvABgsLnaB53Z0GnuttnV+CYygB7LL27ny/7NrR1iInnzjWV4QtlVjUwjQhFyyZyMEfc1gt6BjiEl0EudTPv0SWj0kKa/joPkkHumYVKNbBwALr0c1dvBqhPQo6jd8XaOsDCL6jfT6RWFKWeMjQuEOb638D5XjXBCmeYfnBnpQbTC5vawG/eDf3PlmFTI2aru6uehCN33jjg1apkUq0QaZBFehQRDYdSAxxdEn6pQjKlrdYz0YciJdA== 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=xSbN9Pyiugx1bzYe7kXpRkYqHS1he0PxWWHPPfM6hm4=; b=ThfXEDvgyPtEV8EU0vM22h/zI3iv1Bmb2u7mfbaxwftcRkCmyFo5at0uU2SzXFbqiX9q68QDm1gzZKfbb8HxdAvnIKwqJpcGEvY4UhwaN5D6EXM4D1cqGTnsdjwiFscYF8ME1Pa0+obQ+u5kH5MWKvwuL2/5h69IVTiaAMZY+/oNu+Y9zliVQWAk0vKsL94VcyROt5i1YaUzhawUXA5J/33q6zKv4Ja/tqb7edTZyXNCeycNYlNYRSZGhF+gIGCz5EuDeK8iqQpdl+cJO7iiZbk3UaEp6LFxjkxWv6pbZuHf5WtPEPWNnA8fqKopHCF4R3l4nIZQu/QaDJWgX3WIKw== 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=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xSbN9Pyiugx1bzYe7kXpRkYqHS1he0PxWWHPPfM6hm4=; b=j0CMWTEnRTndOGLuQtpZVVSTqGEXXFNmzYOBOZtrYeJWUKe1hYxd7AxLJqgPdxh2lca0cEVUw2R1H5j18hsSLYA7BLt5EPsKifphzDrwbcnafQRbNB/UyQss8ICeNJzteyr6n7ysItfBXDJm6jSNlB8xxQ93GvLGKongpnvdXCyfijeiJ8f2zA95ljF7XdDnW/CxPYshLFox5eoLHB8h60RRQ7Ic3jxKk6Il4QLuQuiovZwR2DwWQ3rDOWAByBEpKENZyMkdjTHa3vct6xMQfWIPFO/7Kp6pkKSc5K2wxCacojPa4dOUZwe31hVth0SYjCth6wcJcR7Df4QvIQgR9g== Received: from PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) by AM7PR06MB6520.eurprd06.prod.outlook.com (2603:10a6:20b:11d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Tue, 15 Mar 2022 12:35:49 +0000 Received: from PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::e05a:8d81:8648:b10f]) by PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::e05a:8d81:8648:b10f%9]) with mapi id 15.20.5061.028; Tue, 15 Mar 2022 12:35:49 +0000 References: <87mthw8b74.fsf@gmail.com> <87tuc0mjjj.fsf@gmail.com> User-agent: mu4e 1.6.10; emacs 29.0.50 From: Ignacio Casso To: Max Nikulin Subject: Re: [BUG] org-capture autoload bug? [9.5.2 (9.5.2-gfbff08 @ /home/ignacio/.emacs.d/elpa/org-9.5.2/)] Date: Tue, 15 Mar 2022 13:26:43 +0100 In-reply-to: Message-ID: Content-Type: text/plain X-TMN: [0axJ/QTVSmO5HGbRMGciNY6BP5TY9jiQ] X-ClientProxiedBy: MRXP264CA0036.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:14::24) To PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) X-Microsoft-Original-Message-ID: <87ilsfxuju.fsf@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 39292701-a70e-435a-36e5-08da0680533a X-MS-TrafficTypeDiagnostic: AM7PR06MB6520:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 39llD6vtHzRSd2RptEjJMX/sIFiGv9UHbaww7B3iUvQrNk8wBjXAeFhqWjrblcfiRP1IbkPAY9olVgrzDMpTCP1/drXal1Xj3cEV3B9ymC/uwHmvlIzkR0qdA0g0999PLRBHLBPFe17/hS0DfMIJKcIHy8ODWV5wTWge4YtWP4lqCay5NJ3ooQJspZCuPaa3zMqt71qpuC9ZyOp12Enfe4HNVroyP8Nbc7bDjMrIN81+lLBgO4eHBPWQfKl4uiY/EQnfqifvYzwJA+9L1B5/9JhPw7DRU0heQLZVyD5/T8Hzx/GTgwHtbi28ifOH9PPGlQLZlaPm+HCXRpPArhoKGx3L+dIBkFdfQO7FmKZZRNp7bbbReqlN/jcdzb5Tcrqc7zFlqsvZ0ad0FyrF6Rq7Mbtatm7w1po/ecHHVtuKgour8bRVgUvOSZzN4CXpir8ddFn3JzPlA8ycijHZWGym0NpYs68zz+x30U1bhoIEmsXghglUIveXoYLfQBhxaFe/kRiDeXkzAqLTuNPY9GxnkuzE+EMwUUL0BHLKyxXUSYsXzw4jeKBmPzoWRFvnzLydZIC9E8vnGYiLGkaR03uzKQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?KsTQGdQ3Jb+NhLLx2fnwYJp01t4FZj/ujPuVcWsFX3fmOjI+tiwNq4JJ8qbc?= =?us-ascii?Q?Lg4b3io7dpgg9k+kI2Ma+KCtzWHGF9t98qKdrPVC0gMg5nwSnocUbc1LV3xo?= =?us-ascii?Q?go+t0K0LTRTWcNLTA/7ql6+1jh0zmL/wobDKAntNt4teocRy0YSvC2RQfb1i?= =?us-ascii?Q?xlPhl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ihZ?= =?us-ascii?Q?QUnBQlwdLTXiQOpoWRTBzMFsJXkayzFJBFMOrA6W45OmZslFdmZ8BfpOSiAK?= =?us-ascii?Q?KtzfYaVa+oSPdKAPz/CxulD35NVs4Q68IA=3D=3D?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6e454.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 39292701-a70e-435a-36e5-08da0680533a X-MS-Exchange-CrossTenant-AuthSource: PAXPR06MB7760.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2022 12:35:49.4040 (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: AM7PR06MB6520 Received-SPF: pass client-ip=40.92.69.54; envelope-from=ignaciocasso@hotmail.com; helo=EUR02-VE1-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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1647348148; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=xSbN9Pyiugx1bzYe7kXpRkYqHS1he0PxWWHPPfM6hm4=; b=Ts2MjJ1V1tZesiC+sUCu7Dg7S6IWGXNEQgpSczQZI03YZx9UPpaPlkIZWd+4K/pcSy3+Y2 Dv+wOXvlGx/6oKAx/5G770LgzhqwQpTJhu4G7jo5XcuRZywodHTR0ESxXIkn0S9TDPtqmA r1zZlnkh20oVsGu5gZDnZIXOdbta8X2hZdaIMcCvKB0bOkzryPYweNdLYh1xO+RRQjRi80 aub2nbjUvgFg2JdbxATjDX0WhbiO14Z1sxAGkRV93z+FK2n/2gCipT8C3/tPxqTSncHWld GtPA9tTUts5qNqgSO98NJeZYFiKwATGEQrpvlIAG9S/lh+5cY4NfikyS6dF5uQ== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1647348148; a=rsa-sha256; cv=pass; b=AEB/qvoIrCo4z4/r6WTCc6N1VbnZVyMMEM3F1Q/3H2L6ujQ/Z7iO13x/jYizL92KqnMj0v VHF9D1Kxvy+XsLvTHIhDgWJAKo/bVKHbg4yJ3MmlD9+ZdL/LvBioPNWZaK1A3gdP7d8Fm2 /KbxAB+pBRJR0lD4Q3ZljDg8Btho7VnmGJG+1dRYLHScsfRPh5gzUBhb67MbGxPvtIM8/n dIasuUTPlHK6hAI8h43O1uZaRGliD8ryEv27juueT30k9nJSysgDnkeMu4Nn6ep+Qr80S2 K02sBuCeuzT/rFHsejthN+T+APJfpoZRVDt1Zr5cfHcxno7HbdY60/jxKsmdfQ== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=j0CMWTEn; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=hotmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -10.97 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=hotmail.com header.s=selector1 header.b=j0CMWTEn; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=hotmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 8C438322D6 X-Spam-Score: -10.97 X-Migadu-Scanner: scn0.migadu.com X-TUID: ikN8DHJhmyoN >>> For `defcustom' autoload generates no more than >>> >>> (defvar org-capture-templates nil "...") >>> >>> It seems, behavior depends on whether `org-capture-templates' has the :set >>> attribute. >> Not really, all defcustoms have a :set attribute, be it passed >> explicitly as a parameter or the default value, set-default. This issue >> happens with all autoload functions that use a custom variable: if they >> are called inside a let form binding that variable and the feature was >> not loaded yet, the let-binding will have no effect. > > To avoid misunderstanding. I was testing with Emacs-26.3 (Ubuntu-20.04 > focal LTS system package) and did not explicitly set lexical binding > cookie in an .el file. However defcustom autoloading was assumed. > > ;; simulate effect of ;;;###autoload > (defvar org-capture-templates nil) > > (defun print-org-capture-templates () > (message "print-org-capture-templates") > (pp org-capture-templates) > (message "-----")) > (let ((org-capture-templates > '(("d" "default" entry > (file "/tmp/capture-test.org") > "* %?")))) > (print-org-capture-templates) > (require 'org-capture) > (print-org-capture-templates)) > > Second call of print-org-capture templates prints nil with original > definition of `org-capture-templates' but it prints locally let-bound > value if I comment out the :set attribute. > > I am not disputing any observation from your thorough study > mid:PAXPR06MB7760A3031924BA897FD082E4C60F9@PAXPR06MB7760.eurprd06.prod.outlook.com > (it seems message delivery took several hours, so I noticed it after I > sent my message). Yes, I was wrong about that. Instead of testing it without :set argument, I had tested it with a :set argument that was just set-default plus some messages for debugging. I assumed that it was equivalent since the documentation says that set-default is the default value for :set. However it turns out that the actual default value that is used when no argument is passed is set-default-toplevel-value. With the later it works (with dynamic binding or autoload variable), but with the former it doesn't. I think I tested once without :set argument, but I must have used lexical binding so it didn't work anyway, so I concluded that it didn't work either in that case.