From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: autoload cl-defstruct constructor? Date: Thu, 05 Sep 2019 16:36:09 -0700 Message-ID: <86ef0u8geu.fsf@stephe-leake.org> References: <86k1anriz5.fsf@stephe-leake.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="120655"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 06 01:36:29 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i61Ih-000VAD-8t for ged-emacs-devel@m.gmane.org; Fri, 06 Sep 2019 01:36:27 +0200 Original-Received: from localhost ([::1]:50390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i61If-0000tl-U8 for ged-emacs-devel@m.gmane.org; Thu, 05 Sep 2019 19:36:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44696) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i61IZ-0000tf-QS for emacs-devel@gnu.org; Thu, 05 Sep 2019 19:36:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i61IX-0005EH-Qa for emacs-devel@gnu.org; Thu, 05 Sep 2019 19:36:18 -0400 Original-Received: from gateway34.websitewelcome.com ([192.185.148.212]:14032) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i61IX-00058C-CA for emacs-devel@gnu.org; Thu, 05 Sep 2019 19:36:17 -0400 Original-Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway34.websitewelcome.com (Postfix) with ESMTP id A272A81EF5B for ; Thu, 5 Sep 2019 18:36:13 -0500 (CDT) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with SMTP id 61ITiaeeE2qH761ITiVuz5; Thu, 05 Sep 2019 18:36:13 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stephe-leake.org; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:To:From:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5z6LAO3FcVQ8Aaav9pooWywUWqsQnteDwgiL/G5B0Ls=; b=M/4uys9mvuME2ftBT2L7SkmtD VFmHviiI+1v4X2mPuSfpHDMk6MKdWyA8WBHEUalkJ4kMD+FrpSm1ZKXQVaeXto8Hc12Vm2Oi0pTGv OJ8sWLne3rycHdv98dQrgVXrWrhAqMlvomFVDLMWe4ijyWCdxR4bpvDuKBD6mkdJ7BcBQh3MNG4u0 nrhS4CDhFFUhgxespT1WACoFzXoAZQF5sTXCXAgD6E2hcAytTEe3lu66FHcK+xhKjQl1nMLwC0f5N VuK6/+s7BJ9UmnjAlXoYqAIIQ6zrY7/ttKCXt7WjpyKCVFGvSFY9qDfiV+bIDEEex6NMFy8mfzCmD Nq6Dpn3QQ==; Original-Received: from [76.77.182.20] (port=65203 helo=Takver4) by host2007.hostmonster.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1i61IT-000fqA-2S for emacs-devel@gnu.org; Thu, 05 Sep 2019 17:36:13 -0600 In-Reply-To: (Stefan Monnier's message of "Wed, 04 Sep 2019 15:03:42 -0400") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2007.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stephe-leake.org X-BWhitelist: no X-Source-IP: 76.77.182.20 X-Source-L: No X-Exim-ID: 1i61IT-000fqA-2S X-Source-Sender: (Takver4) [76.77.182.20]:65203 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 2 X-Source-Cap: c3RlcGhlbGU7c3RlcGhlbGU7aG9zdDIwMDcuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 192.185.148.212 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:239883 Archived-At: Stefan Monnier writes: >> I tried adding an autoload cookie to the cl-defstruct. That almost >> works, but update-directory-autoloads doesn't respect the order implied >> by :include, so wisi-compiler is declared in autoloads.el after it is >> needed. > > Could you give details about this ordering problem? Hmm. Attempting to reproduce this, I ran into a different but related problem. If I add an autoload cookie to a cl-defstruct, running update-directory-autoloads on the above gives: --- ;;; Generated autoloads from gnat-core.el (cl-defstruct gnat-compiler "\ Used with wisi-compiler-* generic functions." gpr-file run-buffer-name project-path target runtime gnat-stub-opts gnat-stub-cargs) --- There is no "autoload" call, as there would be with a normal function. So even though 'make-gnat-compiler' is defined, calling it does not load gnat-core.el, so no other functions are defined. So more autoloads are required. Not really a problem, but unexpected. > It sounds like a bug (tho fixing it will probably not help you in the > short-run if you need your solution to work in Emacs-26). The files are included in autoloads.el in file name alphabetical order (although there do seem to be exceptions?). So with my real code, I get: --- ;;; Generated autoloads from ada-core.el ... (cl-defstruct (ada-prj (:include wisi-prj) (:copier nil) (:constructor nil) (:constructor make-ada-prj (&key name compile-env (compiler-label ada-compiler) (xref-label ada-xref-tool) source-path plist file-pred &aux (compiler (ada-prj-make-compiler compiler-label)) (xref (ada-prj-make-xref xref-label))))) plist) ... ;;; Generated autoloads from wisi-prj.el (cl-defstruct wisi-prj name compile-env file-env compiler xref (case-exception-files nil) (case-full-exceptions 'nil) (case-partial-exceptions 'nil) source-path file-pred) --- At the point where 'ada-prj' is declared, 'wisi-prj' is unknown. I can create a simple reproducer for a bug report, if you think that's warrented. For now, I'll try the renamed constructor approach. -- -- Stephe