From mboxrd@z Thu Jan 1 00:00:00 1970 From: Federico Beffa Subject: Re: emacs packages Date: Wed, 17 Jun 2015 09:42:44 +0200 Message-ID: References: <878ubjskwj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z57zi-00036y-Em for guix-devel@gnu.org; Wed, 17 Jun 2015 03:42:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z57zh-0002RR-Cq for guix-devel@gnu.org; Wed, 17 Jun 2015 03:42:46 -0400 In-Reply-To: <878ubjskwj.fsf@gnu.org> 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: =?UTF-8?Q?Ludovic_Court=C3=A8s?= Cc: Guix-devel On Tue, Jun 16, 2015 at 6:00 PM, Ludovic Court=C3=A8s wrote: >> - An ELPA package importer >> - An 'emacs-build-system' > > Sounds very useful to me! Thanks for the interest! >> To make those packages automatically available in Emacs without the >> need for any code in the user '.emacs' file, I would suggest to >> include in our Emacs package site initialization file some custom code >> (to activate our ELPA emacs packages) such as the one in the attached >> 'guix-elpa.el' file. > > guix.el already takes care of that (info "(guix) Emacs Initial Setup"), > so that should be enough. Unfortunately this doesn't work without modification. The reason is that I follow the emacs package.el strategy to install each ELPA package in it's own sub-directory. Specifically, I'm installing each package into ".../site-lisp/guix.d/PACKAGE-NAME-VERSION/". The code in 'guix.el', however, doesn't look in sub-directories below the profile's '.../site-lisp'. Another needed detail is the fact that some package's autoload file (e.g., the one used by AUCTeX) includes a (require 'XXX) statement, where XXX is a library file provided by the same package. For this to work, I need to add the directory with the '.el' files to 'load-path' before loading the autoload file. Then, some package's autoload file add themselves to the 'load-path'. Therefore we need to remove the double entry. This is (part of) the code that I adapted from Emacs package.el to do that: (defun guix-package-load-all (dir) "Activate all packages below DIR. (Adapted from Emacs 'package-activate-1' in 'package.el'.)" (when (file-directory-p dir) (dolist (subdir (directory-files dir)) (let ((pkg-dir (expand-file-name subdir dir))) (when (file-directory-p pkg-dir) (let* ((pkg-desc (guix-package-load-descriptor pkg-dir)) (name (guix-package-desc-name pkg-desc)) (pkg-file (expand-file-name (format "%s-autoloads.el" name) pkg-dir))) (when (file-exists-p pkg-file) ;; For some packages to be properly loaded (e.g., ;; AUCTeX), they must be on the load-path. However, ;; some packages add themselves to the load-path. Hence ;; the check to avoid duplications. (push pkg-dir load-path) (let ((old-lp load-path)) (with-demoted-errors (load pkg-file nil t)) (unless (eq old-lp load-path) (setq load-path old-lp)))))))))) The reason for using separate sub-directory is to avoid name clashes (README, ...). Would be nice to adapt the code in guix.el to look into subdirectories as well. Regards, Fede