From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: Re: Emacs load path Date: Sat, 02 Jan 2016 17:13:44 +0300 Message-ID: <87wprsgjc7.fsf@gmail.com> References: <87io3frjcd.fsf@gnu.org> <87ziwpjpd9.fsf@gnu.org> <87oad51cxj.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFMwL-0002kg-4m for guix-devel@gnu.org; Sat, 02 Jan 2016 09:13:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aFMwG-0005GG-59 for guix-devel@gnu.org; Sat, 02 Jan 2016 09:13:53 -0500 In-Reply-To: (Federico Beffa's message of "Fri, 1 Jan 2016 17:53:08 +0100") 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 , KAction@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Federico Beffa (2016-01-01 19:53 +0300) wrote: > On Fri, Jan 1, 2016 at 5:28 PM, Alex Kost wrote: >> Ludovic Court=C3=A8s (2016-01-01 18:22 +0300) wrote: >> >>>> then we should definitely add code in a similar way to instruct emacs >>>> to look in the right places (".../guix.d") for our emacs packages out >>>> of the box. As Dmitry rightfully points out, having emacs packages >>>> which do not work out of the box is just a bug. >>> >>> Yeah. Alex, any idea how to add the guix.d subdirectories to the search >>> path without duplicating all of guix.el in the =E2=80=98emacs=E2=80=99 = package? >> >> Yeah, no need to duplicate all of the guix elisp files. Only >> "guix-emacs.el" (and its dependencies: "guix-profiles.el" and >> "guix-config.el") is needed. And instead of (require 'guix-init) the >> following code should be used to "activate" our .guix.d directories: > > there's no 'guix-config.el', but only 'guix-config.el.in'. It would be > great if you could provide a working patch. Hm, OK, so your "proof of concept patch" will have the same problem. Could you please answer , as I still don't understand how your suggestion can help Emacs to find packages in "guix.d" dirs of user profile. To make this work out of the box, Emacs should load some additional code (see below), but what you suggest is just adding guix-...el files ("guix-emacs.el" now should be enough) to Emacs site-lisp directory. Returning to 'guix-config' problem, we can make a "soft" dependency on 'guix-profiles' (see the attached patch), so the only file needed for finding emacs packages in "guix.d" will be "guix-emacs.el". And the code that should be loaded by Emacs to find guix emacs packages will be: (when (require 'guix-emacs nil t) (add-to-list 'load-path (guix-emacs-directory)) (guix-emacs-load-autoloads)) --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-emacs-Make-guix-emacs.el-independent.patch Content-Transfer-Encoding: quoted-printable >From 62d94b2e7253334f00251922c62c3fd700fd1e52 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Sat, 2 Jan 2016 16:52:39 +0300 Subject: [PATCH] emacs: Make "guix-emacs.el" independent. "guix-emacs.el" may be used just for "instructing" Emacs where to find Emacs packages installed with Guix, so it should have as minimal dependencies as possible. See . * emacs/guix-emacs.el: Require 'guix-profiles' optionally. (guix-emacs-load-autoloads): Use 'guix-profile-prompt' only if it is available. --- emacs/guix-emacs.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/emacs/guix-emacs.el b/emacs/guix-emacs.el index 2f809ed..311ab33 100644 --- a/emacs/guix-emacs.el +++ b/emacs/guix-emacs.el @@ -1,6 +1,6 @@ ;;; guix-emacs.el --- Emacs packages installed with Guix =20 -;; Copyright =C2=A9 2014 Alex Kost +;; Copyright =C2=A9 2014, 2015, 2016 Alex Kost =20 ;; This file is part of GNU Guix. =20 @@ -24,8 +24,9 @@ =20 ;;; Code: =20 -(require 'guix-profiles) (require 'cl-lib) +(unless (require 'guix-profiles nil t) + (defvar guix-user-profile (expand-file-name "~/.guix-profile"))) =20 (defcustom guix-emacs-activate-after-operation t "Activate Emacs packages after installing. @@ -90,7 +91,9 @@ Return nil if there are no emacs packages installed in PR= OFILE." "Load autoloads for Emacs packages installed in PROFILE. If PROFILE is nil, use `guix-user-profile'. Add autoloads directories to `load-path'." - (interactive (list (guix-profile-prompt))) + (interactive (list (if (fboundp 'guix-profile-prompt) + (funcall 'guix-profile-prompt) + guix-user-profile))) (let* ((autoloads (guix-emacs-find-autoloads profile)) (new-autoloads (cl-nset-difference autoloads guix-emacs-autoloads --=20 2.6.3 --=-=-=--