unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#38015] Emacs in multiple profiles
       [not found]                                 ` <877e4l5c9h.fsf@ambrevar.xyz>
@ 2019-11-01  4:25                                   ` Maxim Cournoyer
  2019-11-01 19:06                                     ` Pierre Neidhardt
  2019-11-12  5:14                                     ` Chris Marusich
  0 siblings, 2 replies; 9+ messages in thread
From: Maxim Cournoyer @ 2019-11-01  4:25 UTC (permalink / raw)
  To: 38015, mail; +Cc: Alex Kost, myglc2, help-guix

[-- Attachment #1: Type: text/plain, Size: 1703 bytes --]

[+ guix-patches]

Hello!

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> I've reviewed and tested the patch:
>
> - review: 5/5 stars :D
> - test: pass!
>
> I've tested the following:
>
> $ /home/ambrevar/projects/guix/pre-inst-env guix package -i emacs-2048-game emacs -p ~/temp/foo
> $ cd ~/temp
> $ env -i $(which bash) --login --noprofile --norc
> bash-5.0$ /run/current-system/profile/bin/env DISPLAY=:1 emacs
>
>
> Content of *Messages*:
>
> Loading /gnu/store/ghdkfqnvrxipp4ikakags5rl7flywb72-profile/share/emacs/site-lisp/guix.d/2048-game-20151026.1233/2048-game-autoloads.el (source)...done
> For information about GNU Emacs and the GNU system, type C-h C-a.
>
>
> And 
>
> M-x 2048-game RET
>
> works!

I'm glad it works and fixes your use case :-).

> Can we merge this on master?  We have some 700 emacs packages that are
> going to be rebuilt, but it's rather light for the build farm.  What do
> you think?

I'm not worried about the 700 Emacs packages that will need to be
rebuild, but I'd prefer to take a bit of time to let people comment on
this non-trivial change.

The new behavior (of not always loading stuff from the user profile and
system profiles) is different and may break the flow of some people.

For one, I think restarting my Emacs server (started at login) won't be
enough to discover newly installed packages to my profile.  Emacs-Magit
may also be impacted, I haven't reviewed if it uses that autoload
function from site-start.el.

Refreshing an environment variable value for a process (such as Emacs)
is not as convenient as re-scanning a directory.

I'll let some time pass (2 weeks), and if nobody objects, I'll merge it
to master.

Thanks for the review!

Maxim


[-- Attachment #2: 0001-gnu-emacs-Locate-Elisp-libraries-via-EMACSLOADPATH.patch --]
[-- Type: text/x-patch, Size: 1717 bytes --]

From d5dc7fd8a2406939346b44457859764a98afece0 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 3 Jun 2017 12:56:36 -0700
Subject: [PATCH 1/3] gnu: emacs: Locate Elisp libraries via EMACSLOADPATH.

* gnu/packages/emacs.scm (emacs): Add a search path specification for
EMACSLOADPATH.
---
 gnu/packages/emacs.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 6c6f0e4567..16f9af0a0a 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -9,7 +9,7 @@
 ;;; Copyright © 2016 David Thompson <dthompson2@worcester.edu>
 ;;; Copyright © 2016 ng0 <ng0@n0.is>
 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
-;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2017, 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
@@ -185,6 +185,13 @@
 
     (native-search-paths
      (list (search-path-specification
+            (variable "EMACSLOADPATH")
+            ;; The versioned entries are for the Emacs' builtin libraries.
+            (files (list (string-append "share/emacs/" version "/site-lisp")
+                         (string-append "share/emacs/" version "/lisp")
+                         "share/emacs/site-lisp"))
+            (file-pattern ".*"))        ;recursively add any sub directory
+           (search-path-specification
             (variable "INFOPATH")
             (files '("share/info")))))
 
-- 
2.23.0


[-- Attachment #3: 0002-build-system-emacs-Simplify-the-SET-EMACS-LOAD-PATH-.patch --]
[-- Type: text/x-patch, Size: 4014 bytes --]

From 9c4897347bee7f3b6afb97a6c766d57f0bee1b9d Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 28 Oct 2019 08:09:03 -0400
Subject: [PATCH 2/3] build-system: emacs: Simplify the SET-EMACS-LOAD-PATH
 phase.

It is no longer necessary to search for the Elisp libraries manually, as Emacs
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-system.scm
index 47a9eda9e6..f0c41812f1 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
 ;;; Copyright © 2016 David Thompson <davet@gnu.org>
 ;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
-;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2018, 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -74,40 +74,14 @@ archive, a directory, or an Emacs Lisp file."
         #t)
       (gnu:unpack #:source source)))
 
-(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-install-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 found."
+(define* (add-source-to-load-path #:key dummy #:allow-other-keys)
+  "Augment the EMACSLOADPATH environment variable with the source directory."
   (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)))
 
 (define* (build #:key outputs inputs #:allow-other-keys)
   "Compile .el files."
@@ -269,7 +243,7 @@ second hyphen.  This corresponds to 'name-version' as used 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
-- 
2.23.0


[-- Attachment #4: 0003-gnu-emacs-Adapt-the-autoloads-auxiliary-code-to-use-.patch --]
[-- Type: text/x-patch, Size: 6961 bytes --]

From 39b31bb30b8ecab67bd6de315b5aa1bb59a3ee20 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Tue, 29 Oct 2019 22:07:55 -0400
Subject: [PATCH 3/3] gnu: emacs: Adapt the autoloads auxiliary code to use
 EMACSLOADPATH.

The Elisp directories to scan for autoloads are now taken from EMACSLOADPATH
instead of from the user profile, environment profile or system profile.
Manually adding the Elisp directories to the `load-path' is no longer
necessary, as this is covered by Emacs when they are in EMACSLOADPATH.  The
caching logic is also removed, as this code is not typically run often and the
gain is marginal (loading autoloads files is cheap).

* gnu/packages/aux-files/emacs/guix-emacs.el (guix-emacs-directory)
(guix-emacs-subdirs, guix-emacs-directories): Remove procedures.
(guix-emacs-find-autoloads): Filter the directory entries by passing the
regexp to `directory-files' directly, which is ten times faster.  Remove
deduplication.
(guix-emacs-autoloads-regexp): Remove the group, which used to filter out the
file extension; it no longer works this way due to passing the regexp to the
`directory-files' procedure directly, which doesn't care about groups.
(guix-emacs-autoload-packages): Update doc.  Search package directories from
EMACSLOADPATH.  Do not populate the load-path.  Remove cache.
---
 gnu/packages/aux-files/emacs/guix-emacs.el | 98 ++++++----------------
 1 file changed, 24 insertions(+), 74 deletions(-)

diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el b/gnu/packages/aux-files/emacs/guix-emacs.el
index 9a49e8861c..46ee557f20 100644
--- a/gnu/packages/aux-files/emacs/guix-emacs.el
+++ b/gnu/packages/aux-files/emacs/guix-emacs.el
@@ -2,6 +2,7 @@
 
 ;; Copyright © 2014, 2015, 2016, 2017 Alex Kost <alezost@gmail.com>
 ;; Copyright © 2017 Kyle Meyer <kyle@kyleam.com>
+;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 
 ;; This file is part of GNU Guix.
 
@@ -24,91 +25,40 @@
 ;; installed with Guix.
 
 ;;; Code:
-
-(require 'cl-lib)
-
-(defvar guix-user-profile (expand-file-name "~/.guix-profile"))
-
-(defvar guix-emacs-autoloads nil
-  "List of the last loaded Emacs autoloads.")
+(require 'seq)
 
 (defvar guix-emacs-autoloads-regexp
-  (rx (group (* any) "-autoloads")
-      ".el" (zero-or-one "c") string-end)
+  (rx (* any) "-autoloads.el" (zero-or-one "c") string-end)
   "Regexp to match Emacs 'autoloads' file.")
 
-(defun guix-emacs-directory (&optional profile)
-  "Return directory with Emacs packages installed in PROFILE.
-If PROFILE is nil, use `guix-user-profile'."
-  (expand-file-name "share/emacs/site-lisp"
-                    (or profile guix-user-profile)))
-
 (defun guix-emacs-find-autoloads (directory)
   "Return a list of Emacs 'autoloads' files in DIRECTORY.
 The files in the list do not have extensions (.el, .elc)."
-  (cl-remove-duplicates
-   (delq nil
-        (mapcar (lambda (file)
-                  (when (string-match guix-emacs-autoloads-regexp file)
-                    (match-string 1 file)))
-                (directory-files directory 'full-name nil 'no-sort)))
-   :test #'string=))
-
-(defun guix-emacs-subdirs (directory)
-  "Return list of DIRECTORY subdirectories."
-  (cl-remove-if (lambda (file)
-                  (or (string-match-p (rx "/." string-end) file)
-                      (string-match-p (rx "/.." string-end) file)
-                      (not (file-directory-p file))))
-                (directory-files directory 'full-name nil 'no-sort)))
-
-(defun guix-emacs-directories (&optional profile)
-  "Return the list of directories under PROFILE that contain Emacs packages.
-This includes both `share/emacs/site-lisp/guix.d/PACKAGE'
-sub-directories and `share/emacs/site-lisp' itself.
-
-If PROFILE is nil, use `guix-user-profile'.
-Return nil, if Emacs packages are not installed in PROFILE."
-  (let ((root-dir (guix-emacs-directory (or profile guix-user-profile))))
-    (when (file-directory-p root-dir)
-      (let* ((pkgs-dir  (expand-file-name "guix.d" root-dir))
-             (pkgs-dirs (when (file-directory-p pkgs-dir)
-                          (guix-emacs-subdirs pkgs-dir))))
-        (cons root-dir pkgs-dirs)))))
+  ;; `directory-files' doesn't honor group in regexp.
+  (mapcar #'file-name-sans-extension
+          (directory-files directory 'full-name guix-emacs-autoloads-regexp)))
 
 ;;;###autoload
-(defun guix-emacs-autoload-packages (&rest profiles)
-  "Autoload Emacs packages installed in PROFILES.
-If PROFILES are not specified, use a default user and system
-profiles.
+(defun guix-emacs-autoload-packages ()
+  "Autoload Emacs packages found in EMACSLOADPATH.
 
-'Autoload' means add directories with Emacs packages to
-`load-path' and load 'autoloads' files matching
+'Autoload' means to load the 'autoloads' files matching
 `guix-emacs-autoloads-regexp'."
-  (interactive (list (if (fboundp 'guix-read-package-profile)
-                         (funcall 'guix-read-package-profile)
-                       guix-user-profile)))
-  (let* ((env      (getenv "GUIX_ENVIRONMENT"))
-         (profiles (or profiles
-                       (append (list "/run/current-system/profile"
-                                     guix-user-profile)
-                               (and env (list env))))))
-    (dolist (profile profiles)
-      (let ((dirs (guix-emacs-directories profile)))
-        (when dirs
-          (let* ((autoloads     (cl-mapcan #'guix-emacs-find-autoloads
-                                           dirs))
-                 (new-autoloads (cl-nset-difference autoloads
-                                                    guix-emacs-autoloads
-                                                    :test #'string=)))
-            (dolist (dir dirs)
-              (cl-pushnew (directory-file-name dir)
-                          load-path
-                          :test #'string=))
-            (dolist (file new-autoloads)
-              (load file 'noerror))
-            (setq guix-emacs-autoloads
-                  (append new-autoloads guix-emacs-autoloads))))))))
+  ;; FIXME: The autoloads generated by the emacs-build-system are not byte
+  ;; compiled.
+  (interactive)
+  (let* ((emacs-load-path (getenv "EMACSLOADPATH"))
+         (emacs-non-core-load-path-directories
+          ;; Filter out core Elisp directories, which are already autoloaded
+          ;; by Emacs.
+          (seq-filter (lambda (dir)
+                        (string-match-p "/share/emacs/site-lisp" dir))
+                      (split-string emacs-load-path ":")))
+          (autoloads (mapcan #'guix-emacs-find-autoloads
+                             emacs-non-core-load-path-directories)))
+    (mapc (lambda (f)
+            (load f 'noerror))
+          autoloads)))
 
 (provide 'guix-emacs)
 
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#38015] Emacs in multiple profiles
  2019-11-01  4:25                                   ` [bug#38015] Emacs in multiple profiles Maxim Cournoyer
@ 2019-11-01 19:06                                     ` Pierre Neidhardt
  2019-11-02  1:12                                       ` Maxim Cournoyer
  2019-11-12  5:14                                     ` Chris Marusich
  1 sibling, 1 reply; 9+ messages in thread
From: Pierre Neidhardt @ 2019-11-01 19:06 UTC (permalink / raw)
  To: maxim.cournoyer, 38015; +Cc: Alex Kost, myglc2, help-guix

[-- Attachment #1: Type: text/plain, Size: 547 bytes --]

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> For one, I think restarting my Emacs server (started at login) won't be
> enough to discover newly installed packages to my profile.

Hmmm, I don't understand why this would be an issue.  With updated
environment variables, a new instance of Emacs should successfully find
everything, shouldn't it?

> I'll let some time pass (2 weeks), and if nobody objects, I'll merge it
> to master.

Sounds great, thanks for this awesome fix!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#38015] Emacs in multiple profiles
  2019-11-01 19:06                                     ` Pierre Neidhardt
@ 2019-11-02  1:12                                       ` Maxim Cournoyer
  2019-11-02  9:41                                         ` Pierre Neidhardt
  0 siblings, 1 reply; 9+ messages in thread
From: Maxim Cournoyer @ 2019-11-02  1:12 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: alezost, myglc2, help-guix, 38015

Hello Pierre,

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> For one, I think restarting my Emacs server (started at login) won't be
>> enough to discover newly installed packages to my profile.
>
> Hmmm, I don't understand why this would be an issue.  With updated
> environment variables, a new instance of Emacs should successfully find
> everything, shouldn't it?

Yes, when the instance is really *new*, forked from a session where
EMACSLOADPATH is set right.  I typically start Emacs in server mode
using a shepherd user service, so rarely restart Emacs.  And even if I
was to do 'herd restart emacs', its variables would still be inherited
from the login process that spawned its service.

But that's not too big an issue for Emacs when using Emacs-Guix, as one
can do `guix-set-emacs-environment' and choose a profile to re-read and
set (in Emacs itself) its environment variables.  Re-running
'guix-emacs-autoload-packages' would then refresh the autoloads
corectly, given that EMACSLOADPATH would have been refreshed with an
updated profile.

>> I'll let some time pass (2 weeks), and if nobody objects, I'll merge it
>> to master.
>
> Sounds great, thanks for this awesome fix!

Thank you for your interested in it, you motivated me to dust off a year
old (maybe more) patch and fix the remaining bits.

Maxim

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#38015] Emacs in multiple profiles
  2019-11-02  1:12                                       ` Maxim Cournoyer
@ 2019-11-02  9:41                                         ` Pierre Neidhardt
  0 siblings, 0 replies; 9+ messages in thread
From: Pierre Neidhardt @ 2019-11-02  9:41 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: alezost, myglc2, help-guix, 38015

[-- Attachment #1: Type: text/plain, Size: 610 bytes --]

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> But that's not too big an issue for Emacs when using Emacs-Guix, as one
> can do `guix-set-emacs-environment' and choose a profile to re-read and
> set (in Emacs itself) its environment variables.  Re-running
> 'guix-emacs-autoload-packages' would then refresh the autoloads
> corectly, given that EMACSLOADPATH would have been refreshed with an
> updated profile.

Damn, didn't know about those 2 functions, it's awesome!
I could have used them many times in the past, had I known about them :p

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#38015] Emacs in multiple profiles
  2019-11-01  4:25                                   ` [bug#38015] Emacs in multiple profiles Maxim Cournoyer
  2019-11-01 19:06                                     ` Pierre Neidhardt
@ 2019-11-12  5:14                                     ` Chris Marusich
  2019-11-12  7:16                                       ` Pierre Neidhardt
  1 sibling, 1 reply; 9+ messages in thread
From: Chris Marusich @ 2019-11-12  5:14 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: myglc2, 38015, mail, help-guix, Alex Kost

[-- Attachment #1: Type: text/plain, Size: 2421 bytes --]

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> [+ guix-patches]
>
> Hello!
>
> Pierre Neidhardt <mail@ambrevar.xyz> writes:
>
>> I've reviewed and tested the patch:
>>
>> - review: 5/5 stars :D
>> - test: pass!
>>
>> I've tested the following:
>>
>> $ /home/ambrevar/projects/guix/pre-inst-env guix package -i emacs-2048-game emacs -p ~/temp/foo
>> $ cd ~/temp
>> $ env -i $(which bash) --login --noprofile --norc
>> bash-5.0$ /run/current-system/profile/bin/env DISPLAY=:1 emacs
>>
>>
>> Content of *Messages*:
>>
>> Loading /gnu/store/ghdkfqnvrxipp4ikakags5rl7flywb72-profile/share/emacs/site-lisp/guix.d/2048-game-20151026.1233/2048-game-autoloads.el (source)...done
>> For information about GNU Emacs and the GNU system, type C-h C-a.
>>
>>
>> And 
>>
>> M-x 2048-game RET
>>
>> works!
>
> I'm glad it works and fixes your use case :-).
>
>> Can we merge this on master?  We have some 700 emacs packages that are
>> going to be rebuilt, but it's rather light for the build farm.  What do
>> you think?
>
> I'm not worried about the 700 Emacs packages that will need to be
> rebuild, but I'd prefer to take a bit of time to let people comment on
> this non-trivial change.
>
> The new behavior (of not always loading stuff from the user profile and
> system profiles) is different and may break the flow of some people.
>
> For one, I think restarting my Emacs server (started at login) won't be
> enough to discover newly installed packages to my profile.  Emacs-Magit
> may also be impacted, I haven't reviewed if it uses that autoload
> function from site-start.el.
>
> Refreshing an environment variable value for a process (such as Emacs)
> is not as convenient as re-scanning a directory.
>
> I'll let some time pass (2 weeks), and if nobody objects, I'll merge it
> to master.
>
> Thanks for the review!
>
> Maxim

I'd like to test this, but I can't build Guix, so I can't test it.  I
don't know when I'll be able to test it, since I don't know when I'll be
able to build Guix:

"configure: error: Guix requires zlib."
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38175

Is there a specific commit that you can recommend I use when applying
the patches?  Perhaps one you built successfully yourself?  If you could
also give me your currently installed Guix version so I can "guix pull"
to it, that would be helpful.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#38015] Emacs in multiple profiles
  2019-11-12  5:14                                     ` Chris Marusich
@ 2019-11-12  7:16                                       ` Pierre Neidhardt
  2019-11-13  7:18                                         ` Chris Marusich
  0 siblings, 1 reply; 9+ messages in thread
From: Pierre Neidhardt @ 2019-11-12  7:16 UTC (permalink / raw)
  To: Chris Marusich, Maxim Cournoyer; +Cc: 38015, myglc2, help-guix, Alex Kost

[-- Attachment #1: Type: text/plain, Size: 274 bytes --]

My guix describe:


  guix 2ffae26
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: 2ffae2689aef8efb325f97ec54abcdeee8588aa0

Note that I'm using substitutes.

Good luck!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#38015] Emacs in multiple profiles
  2019-11-12  7:16                                       ` Pierre Neidhardt
@ 2019-11-13  7:18                                         ` Chris Marusich
  2019-11-13 11:08                                           ` Pierre Neidhardt
  2019-11-18  5:50                                           ` Maxim Cournoyer
  0 siblings, 2 replies; 9+ messages in thread
From: Chris Marusich @ 2019-11-13  7:18 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 38015, myglc2, help-guix, Alex Kost, Maxim Cournoyer

[-- Attachment #1: Type: text/plain, Size: 5150 bytes --]

Hi Pierre and Maxim,

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> Good luck!

Thank you, Pierre - and Maxim!  I was able to apply the 3 patches (using
commit 18a69803e2eea4f7555d6eafb6497a645c2d094f, which is on master)
cleanly.  I built a profile using the following manifest:

--8<---------------cut here---------------start------------->8---
(use-modules (gnu packages))

(specifications->manifest
 '(
   "emacs"
   "emacs-bbdb"
   ;; ... a whole lot of omitted packages ...
   "emacs-sr-speedbar"
   "emacs-terraform-mode"
   ))
--8<---------------cut here---------------end--------------->8---

I installed it like this:

  ./pre-inst-env guix package -m  /home/marusich/Documents/guix-manifests/emacs.scm -p ~/.guix-extra-profiles/emacs/emacs

I then emptied my default profile and added this to ~/.bash_profile:

--8<---------------cut here---------------start------------->8---
GUIX_EXTRA_PROFILES="$HOME/.guix-extra-profiles"
for i in $GUIX_EXTRA_PROFILES/*; do
	profile=$i/$(basename "$i")
	if [ -f "$profile"/etc/profile ]; then
		GUIX_PROFILE="$profile"
		. "$profile"/etc/profile
        export INFOPATH="$profile/share/info${INFOPATH:+:}$INFOPATH"
        export MANPATH="$profile/share/man${MANPATH:+:}$MANPATH"
	fi
	unset profile
done
--8<---------------cut here---------------end--------------->8---

I logged out and logged back in.  It seems to work so far.  I started
Emacs from a GNOME terminal bash shell.  There were no errors in my
Messages buffer after I started Emacs.  There were no error messages
from the Emacs process, either.  I'm enjoying my new Emacs right now!

So far, I've noticed three things:

- The fonts were different than I remember.  Not sure why it happened,
  but I'm guessing it had to do with the fact that I emptied my default
  profile, and thus got rid of a lot of fonts accidentally.  At this
  time, I doubt it's because of your changes.

- In the GNOME application picker, when I type "emacs" into the search
  bar, there are no longer any results.  Previously, Emacs showed up in
  the search.  This is true for IceCat, too, which I also moved into its
  own separate profile, so I think it's probably an issue with our GNOME
  package instead of your changes.

- Aspell does not work: "ispell-init-process: Error: No word lists can
  be found for the language "en_US"."  I think this happens because
  the Guix package for aspell refers to the default profile:

  (add-after 'install 'wrap-aspell
   (lambda* (#:key outputs #:allow-other-keys)
     (let ((bin/aspell (string-append (assoc-ref outputs "out")
                                      "/bin/aspell")))
       (wrap-program bin/aspell
         '("ASPELL_CONF" "" =
           ("${ASPELL_CONF:-\"dict-dir ${GUIX_PROFILE:-$HOME/.guix-profile}/lib/aspell\"}")))
       #t)))

We should probably follow up on these issues in separate bug reports.
Other than the above, it all just works.  I don't see any reason not to
merge it into master, since even with these issues it is a strict
improvement over the current situation in which we cannot use Emacs
nearly at all in non-default profiles.

If I notice anything else, I'll let you know!

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> Subject: [PATCH 1/3] gnu: emacs: Locate Elisp libraries via EMACSLOADPATH.

LGTM!

> Subject: [PATCH 2/3] build-system: emacs: Simplify the SET-EMACS-LOAD-PATH
>  phase.
>
> +(define* (add-source-to-load-path #:key dummy #:allow-other-keys)
> +  "Augment the EMACSLOADPATH environment variable with the source directory."
>    (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)))

It looks like the change is as follows: previously, we added multiple
directories, including the source-directory, to the load path; after
this change, we append just the source-directory to the EMACSLOADPATH.
Can you remind me why we don't need to add the other elisp directories
to the EMACSLOADPATH, too?  It seems to work, so I'm probably just
missing something obvious.

> Subject: [PATCH 3/3] gnu: emacs: Adapt the autoloads auxiliary code to use
>  EMACSLOADPATH.

As far as I can tell, this looks good to me, too.

Finally: do you anticipate that this will cause any user-visible or
backwards-incompatible changes that we should mention in the Guix
channel's news file (and in the Guix NEWS file)?

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#38015] Emacs in multiple profiles
  2019-11-13  7:18                                         ` Chris Marusich
@ 2019-11-13 11:08                                           ` Pierre Neidhardt
  2019-11-18  5:50                                           ` Maxim Cournoyer
  1 sibling, 0 replies; 9+ messages in thread
From: Pierre Neidhardt @ 2019-11-13 11:08 UTC (permalink / raw)
  To: Chris Marusich; +Cc: 38015, myglc2, help-guix, Alex Kost, Maxim Cournoyer

[-- Attachment #1: Type: text/plain, Size: 1686 bytes --]

Hi Chris,

Thanks for testing!

> - The fonts were different than I remember.  Not sure why it happened,
>   but I'm guessing it had to do with the fact that I emptied my default
>   profile, and thus got rid of a lot of fonts accidentally.  At this
>   time, I doubt it's because of your changes.

Indeed, Emacs will only load fonts from the default profile.  Not sure
why.  But this is unrelated to this change (it also affects current Guix).

> - Aspell does not work: "ispell-init-process: Error: No word lists can
>   be found for the language "en_US"."  I think this happens because
>   the Guix package for aspell refers to the default profile:
>
>   (add-after 'install 'wrap-aspell
>    (lambda* (#:key outputs #:allow-other-keys)
>      (let ((bin/aspell (string-append (assoc-ref outputs "out")
>                                       "/bin/aspell")))
>        (wrap-program bin/aspell
>          '("ASPELL_CONF" "" =
>            ("${ASPELL_CONF:-\"dict-dir ${GUIX_PROFILE:-$HOME/.guix-profile}/lib/aspell\"}")))
>        #t)))

More precisely, it's because of the patch applied to ASPELL.
See bug #29686 for a discussion.  I have a clue how to patch this
properly, just need to get down to it.

> Finally: do you anticipate that this will cause any user-visible or
> backwards-incompatible changes that we should mention in the Guix
> channel's news file (and in the Guix NEWS file)?

As far I can see, the only incompatibility would arise if the user
explicitly referred to the guix-emacs.el variables that are now gone.

This change is cool enough I'm all for a NEWS entry nonetheless!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#38015] Emacs in multiple profiles
  2019-11-13  7:18                                         ` Chris Marusich
  2019-11-13 11:08                                           ` Pierre Neidhardt
@ 2019-11-18  5:50                                           ` Maxim Cournoyer
  1 sibling, 0 replies; 9+ messages in thread
From: Maxim Cournoyer @ 2019-11-18  5:50 UTC (permalink / raw)
  To: Chris Marusich; +Cc: myglc2, 38015, Pierre Neidhardt, help-guix, Alex Kost

Hello Chris,

Chris Marusich <cmmarusich@gmail.com> writes:

[...]

I've skipped your previous questions, as I believe they were well
answered by Pierre (thank you, Pierre!).

>> Subject: [PATCH 2/3] build-system: emacs: Simplify the SET-EMACS-LOAD-PATH
>>  phase.
>>
>> +(define* (add-source-to-load-path #:key dummy #:allow-other-keys)
>> +  "Augment the EMACSLOADPATH environment variable with the source directory."
>>    (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)))
>
> It looks like the change is as follows: previously, we added multiple
> directories, including the source-directory, to the load path; after
> this change, we append just the source-directory to the EMACSLOADPATH.
> Can you remind me why we don't need to add the other elisp directories
> to the EMACSLOADPATH, too?  It seems to work, so I'm probably just
> missing something obvious.

The magic is in the set-paths phase that is inherited from the
gnu-build-system.  It uses the search path specification now specified in
the Emacs package to set the EMACSLOADPATH environment variable itself.

When building Elisp packages, it is useful to add the current source
directory to that environment variable, so that 'require' directives are
able to find the package's own modules (say, when running its test
suite).

>> Subject: [PATCH 3/3] gnu: emacs: Adapt the autoloads auxiliary code to use
>>  EMACSLOADPATH.
>
> As far as I can tell, this looks good to me, too.
>
> Finally: do you anticipate that this will cause any user-visible or
> backwards-incompatible changes that we should mention in the Guix
> channel's news file (and in the Guix NEWS file)?

Thanks for the review!  I can't anticipate any user-visible changes
except the current (incorrect) behavior.

This change is now live on master, with commit
47b3b4c2aa49e21f4cc32c97ff7bbbd069bb849c.  Thanks for testing :-).

Maxim

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-11-18  5:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <9c395fd0-9458-7894-af8b-9294d212c60b@fastmail.net>
     [not found] ` <878tajzu03.fsf@gmail.com>
     [not found]   ` <m1efkb6x7v.fsf@ordinateur-de-catherine--konrad.home>
     [not found]     ` <87a7uyd7qy.fsf@gmail.com>
     [not found]       ` <m17eq17jsb.fsf@ordinateur-de-catherine--konrad.home>
     [not found]         ` <874ll51mq3.fsf@gmail.com>
     [not found]           ` <m1zi2v5jo0.fsf@ordinateur-de-catherine--konrad.home>
     [not found]             ` <87zi2t4jgh.fsf@gmail.com>
     [not found]               ` <877ep4z44b.fsf@gmail.com>
     [not found]                 ` <87tv88ihzc.fsf@ambrevar.xyz>
     [not found]                   ` <878spgo7ex.fsf@gmail.com>
     [not found]                     ` <87o8yccwtq.fsf@ambrevar.xyz>
     [not found]                       ` <871rv1ed8v.fsf@gmail.com>
     [not found]                         ` <87mudpm5nt.fsf@ambrevar.xyz>
     [not found]                           ` <874kzscpgs.fsf@gmail.com>
     [not found]                             ` <87eeyvespq.fsf@ambrevar.xyz>
     [not found]                               ` <87zhhhbhzl.fsf@gmail.com>
     [not found]                                 ` <877e4l5c9h.fsf@ambrevar.xyz>
2019-11-01  4:25                                   ` [bug#38015] Emacs in multiple profiles Maxim Cournoyer
2019-11-01 19:06                                     ` Pierre Neidhardt
2019-11-02  1:12                                       ` Maxim Cournoyer
2019-11-02  9:41                                         ` Pierre Neidhardt
2019-11-12  5:14                                     ` Chris Marusich
2019-11-12  7:16                                       ` Pierre Neidhardt
2019-11-13  7:18                                         ` Chris Marusich
2019-11-13 11:08                                           ` Pierre Neidhardt
2019-11-18  5:50                                           ` Maxim Cournoyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).