[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
autoload cl-defstruct constructor?
From: |
Stephen Leake |
Subject: |
autoload cl-defstruct constructor? |
Date: |
Wed, 04 Sep 2019 11:53:34 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt) |
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
- autoload cl-defstruct constructor?,
Stephen Leake <=
- Re: autoload cl-defstruct constructor?, Stefan Monnier, 2019/09/04
- Re: autoload cl-defstruct constructor?, Stephen Leake, 2019/09/05
- Re: autoload cl-defstruct constructor?, Stefan Monnier, 2019/09/06
- Re: autoload cl-defstruct constructor?, Stephen Leake, 2019/09/06
- Re: autoload cl-defstruct constructor?, Stefan Monnier, 2019/09/07
- Re: autoload cl-defstruct constructor?, Stephen Leake, 2019/09/09
- Re: autoload cl-defstruct constructor?, Stephen Leake, 2019/09/09
- Re: autoload cl-defstruct constructor?, Stefan Monnier, 2019/09/09