From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxim Cournoyer Subject: Re: Emacs in multiple profiles Date: Mon, 28 Oct 2019 21:25:39 -0400 Message-ID: <874kzscpgs.fsf@gmail.com> References: <9c395fd0-9458-7894-af8b-9294d212c60b@fastmail.net> <878tajzu03.fsf@gmail.com> <87a7uyd7qy.fsf@gmail.com> <874ll51mq3.fsf@gmail.com> <87zi2t4jgh.fsf@gmail.com> <877ep4z44b.fsf@gmail.com> <87tv88ihzc.fsf@ambrevar.xyz> <878spgo7ex.fsf@gmail.com> <87o8yccwtq.fsf@ambrevar.xyz> <871rv1ed8v.fsf@gmail.com> <87mudpm5nt.fsf@ambrevar.xyz> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:47429) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPGGW-0003WG-T3 for help-guix@gnu.org; Mon, 28 Oct 2019 21:25:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPGGV-0006jh-GA for help-guix@gnu.org; Mon, 28 Oct 2019 21:25:44 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:37675) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iPGGV-0006jS-A5 for help-guix@gnu.org; Mon, 28 Oct 2019 21:25:43 -0400 Received: by mail-qt1-x842.google.com with SMTP id g50so17729189qtb.4 for ; Mon, 28 Oct 2019 18:25:43 -0700 (PDT) In-Reply-To: <87mudpm5nt.fsf@ambrevar.xyz> (Pierre Neidhardt's message of "Fri, 25 Oct 2019 13:21:58 +0200") List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Pierre Neidhardt Cc: Alex Kost , myglc2@gmail.com, help-guix@gnu.org --=-=-= Content-Type: text/plain I sent a patch earlier that had unstaged changes... So I'm sorry if you tried it but it was broken. Here's a functional one. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-build-system-emacs-Simplify-the-SET-EMACS-LOAD-PATH-.patch Content-Transfer-Encoding: quoted-printable >From 1007969505b450fe12284bf81751ae6de25c367e Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Mon, 28 Oct 2019 08:09:03 -0400 Subject: [PATCH] build-system: emacs: Simplify the SET-EMACS-LOAD-PATH phas= e. It is no longer necessary to search for the Elisp libraries manually, as Em= acs now include a search path specification serving that purpose. * guix/build/emacs-build-system.scm (set-emacs-load-path): Replace by... (add-source-to-load-path): ...this. (%standard-phases): Adjust accordingly. --- guix/build/emacs-build-system.scm | 42 ++++++------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-sys= tem.scm index 47a9eda9e6..f0c41812f1 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -2,7 +2,7 @@ ;;; Copyright =C2=A9 2015 Federico Beffa ;;; Copyright =C2=A9 2016 David Thompson ;;; Copyright =C2=A9 2016 Alex Kost -;;; Copyright =C2=A9 2018 Maxim Cournoyer +;;; Copyright =C2=A9 2018, 2019 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -74,40 +74,14 @@ archive, a directory, or an Emacs Lisp file." #t) (gnu:unpack #:source source))) =20 -(define* (set-emacs-load-path #:key source inputs #:allow-other-keys) - (define (inputs->directories inputs) - "Extract the directory part from INPUTS." - (match inputs - (((names . directories) ...) directories))) - - (define (input-directory->el-directory input-directory) - "Return the correct Emacs Lisp directory in INPUT-DIRECTORY or #f, if = there -is no Emacs Lisp directory." - (let ((legacy-elisp-directory (string-append input-directory %legacy-i= nstall-suffix)) - (guix-elisp-directory - (string-append - input-directory %install-suffix "/" - (store-directory->elpa-name-version input-directory)))) - (cond - ((file-exists? guix-elisp-directory) guix-elisp-directory) - ((file-exists? legacy-elisp-directory) legacy-elisp-directory) - (else #f)))) - - (define (input-directories->el-directories input-directories) - "Return the list of Emacs Lisp directories in INPUT-DIRECTORIES." - (filter-map input-directory->el-directory input-directories)) - - "Set the EMACSLOADPATH environment variable so that dependencies are fou= nd." +(define* (add-source-to-load-path #:key dummy #:allow-other-keys) + "Augment the EMACSLOADPATH environment variable with the source director= y." (let* ((source-directory (getcwd)) - (input-elisp-directories (input-directories->el-directories - (inputs->directories inputs))) - (emacs-load-path-value - (string-join - (append input-elisp-directories (list source-directory)) - ":" 'suffix))) + (emacs-load-path-value (string-append (getenv "EMACSLOADPATH") ":" + source-directory))) (setenv "EMACSLOADPATH" emacs-load-path-value) - (format #t "environment variable `EMACSLOADPATH' set to ~a\n" - emacs-load-path-value))) + (format #t "source directory ~s appended to the `EMACSLOADPATH' \ +environment variable\n" source-directory))) =20 (define* (build #:key outputs inputs #:allow-other-keys) "Compile .el files." @@ -269,7 +243,7 @@ second hyphen. This corresponds to 'name-version' as u= sed in ELPA packages." (define %standard-phases (modify-phases gnu:%standard-phases (replace 'unpack unpack) - (add-after 'unpack 'set-emacs-load-path set-emacs-load-path) + (add-after 'unpack 'add-source-to-load-path add-source-to-load-path) (delete 'bootstrap) (delete 'configure) ;; Move the build phase after install: the .el files are byte compiled --=20 2.23.0 --=-=-= Content-Type: text/plain I'll rework the 'gnu: emacs: Remove custom guix-emacs code.' patch, as removing it means losing having the autoloads definitions loaded. Someone in the #emacs channel suggested making use of the builtin package.el code to take care of this. To be continued :-) Maxim --=-=-=--