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: autoload cl-defstruct constructor? Date: Wed, 04 Sep 2019 11:53:34 -0700 Message-ID: <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="129488"; 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 Wed Sep 04 20:56:30 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 1i5aSD-000XXe-5B for ged-emacs-devel@m.gmane.org; Wed, 04 Sep 2019 20:56:29 +0200 Original-Received: from localhost ([::1]:36386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5aSB-0008Gx-OQ for ged-emacs-devel@m.gmane.org; Wed, 04 Sep 2019 14:56:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34758) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5aQZ-0008CU-TT for emacs-devel@gnu.org; Wed, 04 Sep 2019 14:54:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5aQY-0006Nm-9q for emacs-devel@gnu.org; Wed, 04 Sep 2019 14:54:47 -0400 Original-Received: from gateway22.websitewelcome.com ([192.185.46.234]:47609) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5aQY-0005yc-03 for emacs-devel@gnu.org; Wed, 04 Sep 2019 14:54:46 -0400 Original-Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway22.websitewelcome.com (Postfix) with ESMTP id CB08D581E for ; Wed, 4 Sep 2019 13:53:38 -0500 (CDT) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with SMTP id 5aPSijneA3Qi05aPSiNpMg; Wed, 04 Sep 2019 13:53:38 -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:Date: 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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=X9bVCbSHHxgqHysDzziwoML7nDQq2XyO9DG9fnHR/ac=; b=IqST0f81wkb/mls6/dzFKGN0Sc OCkccXbdB/WQQ1HlFsMenraJ/er3QwyKIyqK7/9EkYjorjLc36+7wkIEfzMSdDsvGZRov9ucD8zlc h3XMZelId5pR+PjohYBIyYTSf7K7gi2V+A+1d10pc1ia1VMzRE+h6AWGApmIEVVZmS1/kWaoMRoMc gi3KvHytf5frIT0UjOr7AToOfJMcRS/Xlk4NAOcCdn+aUcPzSHWTL3+05GaE4Lox1Ra8LkqTCyTud DrvnrUzNKsFgkGkbsJ7rSpNE4jfECr0oD4YDKyD0LCETSq0xF4qk2bDB6kle9Yn5KNs/8PuSBhQUC PBZ7TQLg==; Original-Received: from [76.77.182.20] (port=64537 helo=Takver4) by host2007.hostmonster.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1i5aPS-0012i8-72 for emacs-devel@gnu.org; Wed, 04 Sep 2019 12:53:38 -0600 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: 1i5aPS-0012i8-72 X-Source-Sender: (Takver4) [76.77.182.20]:64537 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 1 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.46.234 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:239845 Archived-At: I have code like: In ada-core.el: (defun ada-prj-make-compiler (label) (funcall (intern (format "make-%s-compiler" (symbol-name label))))) where 'label' is a user variable indicating choice of Ada compiler. In gnat-core.el: (cl-defstruct (gnat-compiler :include wisi-compiler) ...) In foo-core.el, for another Ada compiler: (cl-defstruct (foo-compiler :include wisi-compiler) ...) The question is how to arrange autoloads so the correct constructor is available, without loading the file(s) containing the unneeded one(s). 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. Is there a way to influence the order of files included in autoloads (short of renaming the files so alphabetical is correct)? I could rename the constructor: (:constructor create-gnat-compiler) and provide an ordinary autoloaded defun: (defun make-gnat-compiler (...) (create-gnat-compiler ...)) But that seems inelegant, and maintaining the arg lists is tedious and error-prone. Is there a way to autoload just the created constructor? -- -- Stephe