From: "Clément Pit--Claudel" <clement.pit@gmail.com>
To: emacs-devel@gnu.org
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Autoloads and subdirectories
Date: Sat, 28 May 2016 14:47:37 -0400 [thread overview]
Message-ID: <5749E7C9.3030300@gmail.com> (raw)
In-Reply-To: <jwvoa7qnj0l.fsf-monnier+gmane.emacs.devel@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 2317 bytes --]
On 2016-05-28 14:18, Stefan Monnier wrote:
>> be broken by future upstream fixes. One such solution is to statically
>> generate my autoloads (using code similar to the one you posted) and ship
>> these as part of my package, while adding an autoloaded form to a new file
>> in my content directory that just loads the additional autoloads file that
>> I ship. This isn't very pretty, though.
>
> The other option is to split your package into several packages.
Interesting, thanks Stefan! The context in which this comes up is ‘realgud’, a rewrite of gud that supports about 15 debuggers out of the box. I don't think it would be too great to split this into 15 packages.
I think I'll push an implementation of my suggestion above. I included a draft below; I'd be very happy to hear comments about it :) IOW, assuming I manually generate autoloads using the following snippet:
(defun realgud-refresh-subdirectory-autoloads ()
"Update subdirectory-autoloads.el.
This is needed because the package.el infrastructure doesn't
process autoloads in subdirectories; instead we create an
additional autoloads file of our own, and we load it from an
autoloaded form."
(interactive)
(let ((generated-autoload-file
(expand-file-name realgud-subdir-autoloads-name realgud-content-dir)))
(when (file-exists-p generated-autoload-file)
(delete-file generated-autoload-file))
(dolist (name (directory-files-recursively realgud-content-dir "" t))
(when (file-directory-p name)
(update-directory-autoloads name)))))
Then would it be enough to put the following in a file that lives in the package's root directory?
;;;###autoload
(defconst realgud-subdir-autoloads-name "subdirectory-autoloads.el")
;;;###autoload
(defconst realgud-content-dir
(file-name-directory
(or (and load-in-progress load-file-name)
(bound-and-true-p byte-compile-current-file)
buffer-file-name)))
;;;###autoload
(with-demoted-errors "Error loading autoloads: %s"
(load (expand-file-name realgud-subdir-autoloads-name realgud-content-dir) t t))
(btw, is there a more concise way of writing realgud-content-directory?)
Thanks!
Clément.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2016-05-28 18:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-28 4:25 Autoloads and subdirectories Clément Pit--Claudel
2016-05-28 5:00 ` Robert Weiner
2016-05-28 5:13 ` Clément Pit--Claudel
2016-05-28 18:18 ` Stefan Monnier
2016-05-28 18:47 ` Clément Pit--Claudel [this message]
2016-05-28 19:07 ` Stefan Monnier
2016-05-28 19:21 ` Clément Pit--Claudel
2016-05-29 15:01 ` Stefan Monnier
2016-05-29 15:39 ` Clément Pit--Claudel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5749E7C9.3030300@gmail.com \
--to=clement.pit@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.