From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: Re: emacs packages Date: Wed, 17 Jun 2015 21:21:20 +0300 Message-ID: <871thatcv3.fsf@gmail.com> 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]:34133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5Hxn-0000Ti-8h for guix-devel@gnu.org; Wed, 17 Jun 2015 14:21:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5Hxi-0004NC-Vt for guix-devel@gnu.org; Wed, 17 Jun 2015 14:21:27 -0400 In-Reply-To: (Federico Beffa's message of "Wed, 17 Jun 2015 09:42:44 +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: Federico Beffa Cc: Guix-devel Federico Beffa (2015-06-17 10:42 +0300) wrote: > On Tue, Jun 16, 2015 at 6:00 PM, Ludovic Court=C3=A8s wrot= e: [...] >>> 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, Ouch, what nasty things people do! > 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. I think double entry will do no harm, so I'm not sure if it's worth removing. > This is (part of) the code that I adapted from Emacs package.el to do tha= t: > > (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. The code for loading "=E2=80=A6-autoloads.el" files is placed in "guix-emacs.el", so perhaps it would be enough to adjust: - 'guix-emacs-find-autoloads' to make it look at subdirs; - 'guix-emacs-load-autoloads' to add the subdir to 'load-path' before loading "=E2=80=A6-autoloads.el". -------- You are working on a big feature (thank you very much for that!), so what about making "wip-emacs" (or whatever) branch for a more convenient working on it? --=20 Alex