Ludovic Courtès (2014-08-28 15:51 +0400) wrote: > Alex Kost skribis: > > [...] > >> So for the real “drop-in replacement”, the following should be done >> (IMHO): Guix recipes for emacs packages should be modified to >> additionally generate "...-autoloads.el" (like it is done by >> “package.el”: for example using ‘update-directory-autoloads’ function if >> a package has appropriate "autoload cookies"). > > I think it should be quite easy to extend the emacs-utils module that > Mark added with a procedure to generate an autoloads file. > > I would be nice to have an ‘emacs-build-system’ with an additional phase > that does the autoloads generations. However, looking at the packages > in emacs.scm, it seems there’s almost no common denominator. So maybe > emacs-build-system would gnu-build-system + autoload-generation phase. > > Thoughts? You are right, I think. No thoughts actually until I cope with your notes on scheme code for “guix.el”. >> And after an Emacs package is installed with “guix.el”, its >> "...-autoloads.el" file may be loaded just like it is done by >> “package.el”. >> >> Moreover if each installed emacs package will have "...-autoloads.el", >> these files may be loaded on emacs startup simply like this: >> >> (mapc load >> (directory-files "~/.guix-profile/share/emacs/site-lisp" >> t "-autoloads.el$")) >> >> So there would be no need to put “(autoload 'foo "foo-mode" ...)” in >> your ".emacs" for all those commands you want to use. > > Indeed. > > How does package.el handles that actually? Everything package installed > with it is automatically loaded on startup, without having to add a > single line to ~/.emacs. After a user's "~/.emacs" (or "~/.emacs.d/init.el") is loaded, Emacs calls ‘package-initialize’ function (if ‘package-enable-at-startup’ is non-nil), which does the job: it cycles through all subdirs (for the newest packages, as there may be several versions installed) from ‘package-user-dir’ and ‘package-directory-list’ vars and loads all autoloads from those subdirs. So "guix-init.el" may provide analogous function: