From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uK/7HhZhI2PrHgAAbAwnHQ (envelope-from ) for ; Thu, 15 Sep 2022 19:29:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id aP73HhZhI2OsBAAAauVa8A (envelope-from ) for ; Thu, 15 Sep 2022 19:29:58 +0200 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 258F1FD39 for ; Thu, 15 Sep 2022 19:29:58 +0200 (CEST) Received: from localhost ([::1]:42220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYsgW-0000VD-Th for larch@yhetil.org; Thu, 15 Sep 2022 13:29:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYsg8-0000V4-2T for emacs-orgmode@gnu.org; Thu, 15 Sep 2022 13:29:32 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:58433) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYsg5-0002m7-7A for emacs-orgmode@gnu.org; Thu, 15 Sep 2022 13:29:30 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6FF5580390; Thu, 15 Sep 2022 13:29:27 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6CC8680172; Thu, 15 Sep 2022 13:29:21 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1663262961; bh=+EFQJ+V+BmZcYoD+eXIR9V4urxKjqt5wEMTfRiyMW9k=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=H6UunavTc3XarK0/xciYNEP6wBGe0TzHFWI0m7XT+JW3j5O/Y91mJbeCMNBU6Zcez JOoQEZFFXAKzsXEHMZfaEdRMaq+2+Cjwx7KEGc4hXYo7jtnvr1JGKtxVD5ptNKiW3p NIHaB6a/JBUaKwb7YgSO6T5w6UWsfdYjtIF7B3ZZyJP/5YJgafVGW8SuWzoS31vG87 8dsvRQ+t35FbStESxEQ89E2dirOwYwzcRLEctz56xkxWKA8Vt6EKliGNsfg7LU6Rh0 q6yTEBOqt5OtpflG1WqLEwMcDQBzES8EDcjPFA1GZodiWFzFyWz/X8OOOrEemWlUjV KS8LbCWxlFojQ== Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 46FA11201B3; Thu, 15 Sep 2022 13:29:21 -0400 (EDT) From: Stefan Monnier To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: Use lexical-scoping in tests In-Reply-To: <87mtb0vhsx.fsf@localhost> (Ihor Radchenko's message of "Thu, 15 Sep 2022 22:22:22 +0800") Message-ID: References: <87illqxhje.fsf@localhost> <87mtb0vhsx.fsf@localhost> Date: Thu, 15 Sep 2022 13:29:20 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , 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=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663262998; 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=BvJlL4ySbVAEt/ZoTmqI5vSdV5Q0Ci4tXUpBmOlqzps=; b=Cop3rcsgQ74cG0idxMQ+JT/KdbuAIwoEmA8V6q92u655bTvgLgzsZGmhg/wS4S/7lKaTJb V9NcOA5h7PIGmVOy4XdGSh//qxxK/OgHnXXpu7bJiSATZxLpmhqcol9rZS7wl/YbtrCD0U lcacO99NVt380iwvVYOOO5lSQg1TbN6KfGy7QBkB7JXdJrNjHe9nxEBiZ3XMR/uJK5ppg0 rjwIflW4Sk2yCEYxigWae6rOSwf0iqA5u6hir1885cxDAhu0g9BU4aOZNQe8YmHSRsaeM/ VEPar5b5ksw4GfPbJl66QnO4dUqRUbA1l4mg4CpvyhCF/AUcuoxwSSFoRHHuMg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663262998; a=rsa-sha256; cv=none; b=TOh2Y7Tzcgr6J9xoY9dDRUzk37523KeQ6IzAvsE9LY3KK8eUQH0d9+TaJPQkxQ1J61xRs0 feVLm1zJ/702b1b0giWsSm//ksV9JGL5lR2VB2oPg8MOioIcSPPdSThBtC2CdQWF6sKRi6 VyBXKmDCxzXwdWdYZhLscznJ2i/Mx/rLYKCEinUGhPhM3EqJaEg0HoogLb03zPvq94QCgI oeTh2XALQbq0WOCA0oO/x3CVKfRYI94zM4Hd54YoAr+ME40RVi3MYblisDmydbgxlt3G9s SsyiHlyCB8hlsnXiRax/5Y1h0eLmFS93fUtfyQFVDDjW+o6ebmUU0QO5FvXYqg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=iro.umontreal.ca header.s=mail header.b=H6UunavT; dmarc=pass (policy=quarantine) header.from=iro.umontreal.ca; 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: -3.53 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=iro.umontreal.ca header.s=mail header.b=H6UunavT; dmarc=pass (policy=quarantine) header.from=iro.umontreal.ca; 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: 258F1FD39 X-Spam-Score: -3.53 X-Migadu-Scanner: scn1.migadu.com X-TUID: hc3WODWKgzHH >> + ;; FIXME: `s' is a symbol, so (car-safe s) is always nil. >> + ;;(when (eq 'autoload (car-safe s)) >> + ;; (unintern s obarray)) >> + )))) > > If I understand correctly, the intended version of this code is supposed > to be > > (when (autoloadp (symbol-function s)) > (unintern s obarray)) > > the idea being "unloading" all the built-in org-related staff. > However, make test will be failing then with byte-compiler error. > I feel that the idea of the code is reasonable, but some detail of how > autoloads work in Emacs is missed. I don't see why you'd need to remove the existing autoloads: they don't specify which directory the file will come from, so if the file still exists in the new Org, the (old) autoload will load from the new Org, as needed. I mean it's OK to remove those autoloads, but really, those are usually harmless and they are the least of your problems. I think the things we'd want/need to "remove" are those things which *aren't* autoloads. Also `unintern` is a fairly powerful operation which can come with undesirable side-effects, so I'd rather replace it with something less risky like `fmakunbound`. >> + ;; FIXME: For the rare cases where we do need to mess with windows, >> + ;; we should let `body' take care of displaying this buffer! >> (setq buffer (find-file file)) > > Could you please elaborate about this fixme? `find-file` displays the buffer in a window. In most uses of this code we don't care whether the buffer is displayed or not, so we should probably use `find-file-noselect` instead. [ As a rule of thumb, most uses of `find-file` (and `switch-to-buffer`) in ELisp code are the result of a misunderstanding from the coder who just uses the commands he's familiar with as a user. But in Elisp, you generally want to use `find-file-noselect` (and `set-buffer`, or maybe `pop-to-buffer`) instead. ] I didn't make the change, tho, because some parts of the tests do care about which buffer is displayed in which window, apparently, so it would take more work. Stefan