From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: Re: guix.el vs. Emacs packages Date: Thu, 28 Aug 2014 18:12:31 +0400 Message-ID: <871ts0n1o0.fsf@gmail.com> References: <87fvgipa85.fsf@gnu.org> <8761hcn9lu.fsf@gmail.com> <87zjeode80.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN0RR-00064J-AN for guix-devel@gnu.org; Thu, 28 Aug 2014 10:12:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XN0RI-0002Uj-9k for guix-devel@gnu.org; Thu, 28 Aug 2014 10:12:45 -0400 In-Reply-To: <87zjeode80.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 28 Aug 2014 13:51:27 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s (2014-08-28 15:51 +0400) wrote: > Alex Kost skribis: > > [...] > >> So for the real =E2=80=9Cdrop-in replacement=E2=80=9D, the following sho= uld be done >> (IMHO): Guix recipes for emacs packages should be modified to >> additionally generate "...-autoloads.el" (like it is done by >> =E2=80=9Cpackage.el=E2=80=9D: for example using =E2=80=98update-director= y-autoloads=E2=80=99 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 =E2=80=98emacs-build-system=E2=80=99 with an a= dditional phase > that does the autoloads generations. However, looking at the packages > in emacs.scm, it seems there=E2=80=99s 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 =E2=80=9Cguix.el=E2=80=9D. >> And after an Emacs package is installed with =E2=80=9Cguix.el=E2=80=9D, = its >> "...-autoloads.el" file may be loaded just like it is done by >> =E2=80=9Cpackage.el=E2=80=9D. >> >> 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 =E2=80=9C(autoload 'foo "foo-mode" ...)= =E2=80=9D 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 =E2=80=98package-initialize=E2=80=99 function (if =E2=80=98package-en= able-at-startup=E2=80=99 is non-nil), which does the job: it cycles through all subdirs (for the newest packages, as there may be several versions installed) from =E2=80=98package-user-dir=E2=80=99 and =E2=80=98package-directory-list=E2= =80=99 vars and loads all autoloads from those subdirs. So "guix-init.el" may provide analogous function: --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline Content-Transfer-Encoding: quoted-printable (defvar guix-package-enable-at-startup t "If non-nil, activate all packages installed with Guix.") (defun guix-package-initialize () "Load Emacs packages installed with Guix, and activate them." (interactive) (mapc #'load (directory-files "~/.guix-profile/share/emacs/site-lisp" t "-autoloads.el$"))) ;; Load autoloads for all packages or only for guix package. (if guix-package-enable-at-startup (guix-package-initialize) (require 'guix-autoloads)) (provide 'guix-init) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Thus with =E2=80=9C(require 'guix-init)=E2=80=9D in ".emacs" a user will ge= t all needed autoloads (and it will work even faster than =E2=80=9Cpackage.el=E2=80=9D as "guix-init.el" will be tiny while =E2=80=9Cpackage.el=E2=80=9D is rather bi= g). -- Alex --=-=-=--