all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH 0/4] emacs: Various fixes.
@ 2016-02-05 12:13 Alex Kost
  2016-02-05 12:13 ` [PATCH 1/4] emacs: Factorize searching for Emacs packages Alex Kost
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Alex Kost @ 2016-02-05 12:13 UTC (permalink / raw)
  To: guix-devel

This patchset fixes a couple of issues discovered in bug #22550 (see the
bottom of <http://debbugs.gnu.org/cgi/bugreport.cgi?msg=14;bug=22550>).

[PATCH 1/4] emacs: Factorize searching for Emacs packages.
[PATCH 2/4] emacs: Find Emacs packages in a system profile.

[PATCH 3/4] system: Fix EMACSLOADPATH.

  This is an easy fix, however I've just thought that we can get rid of
  EMACSLOADPATH completely.  Since now our Emacs can load packages from
  guix directories ("~/.guix-profile" and "/run/current-system/profile")
  there is no need to use "/etc/emacs/site-start.el" anymore, because Emacs
  will load "guix-autoloads.el" and "geiser-autoloads.el" from a system
  profile.

  So I think this patch is OK as a current fix, but eventually we should
  remove "guix-init.el" and "/etc/emacs/site-start.el".  I'll send a
  patch for it later.

[PATCH 4/4] doc: Document 'guix-edit' Emacs command.

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

* [PATCH 1/4] emacs: Factorize searching for Emacs packages.
  2016-02-05 12:13 [PATCH 0/4] emacs: Various fixes Alex Kost
@ 2016-02-05 12:13 ` Alex Kost
  2016-02-06 12:45   ` Ludovic Courtès
  2016-02-05 12:13 ` [PATCH 2/4] emacs: Find Emacs packages in a system profile Alex Kost
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 17+ messages in thread
From: Alex Kost @ 2016-02-05 12:13 UTC (permalink / raw)
  To: guix-devel

* emacs/guix-emacs.el: (guix-emacs-directories): New procedure.
(guix-emacs-find-autoloads-in-directory): Rename to ...
(guix-emacs-find-autoloads): ... this.
(guix-emacs-load-autoloads): Replace with ...
(guix-emacs-autoload-packages): this.  New procedure.  At first, find a
list of directories with Emacs packages, then add them to 'load-path'
and finally, load autoloads.
(guix-emacs-load-autoloads-maybe): Rename to ...
(guix-emacs-autoload-packages-maybe): ... this.
* emacs/guix-backend.el (guix-after-repl-operation-hook): Adjust for the
renaming.
* doc/emacs.texi (Emacs Initial Setup): Likewise.
---
 doc/emacs.texi        |  2 +-
 emacs/guix-backend.el |  2 +-
 emacs/guix-emacs.el   | 70 +++++++++++++++++++++++++--------------------------
 3 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/doc/emacs.texi b/doc/emacs.texi
index 92a9107..19dc87f 100644
--- a/doc/emacs.texi
+++ b/doc/emacs.texi
@@ -106,7 +106,7 @@ for the built-in Emacs package system (@pxref{Package Installation,,,
 emacs, The GNU Emacs Manual}).
 
 You can activate Emacs packages installed in your profile whenever you
-want using @kbd{M-x@tie{}guix-emacs-load-autoloads}.
+want using @kbd{M-x@tie{}guix-emacs-autoload-packages}.
 
 
 @node Emacs Package Management
diff --git a/emacs/guix-backend.el b/emacs/guix-backend.el
index 0736f85..04e5c1f 100644
--- a/emacs/guix-backend.el
+++ b/emacs/guix-backend.el
@@ -121,7 +121,7 @@ This REPL is used for receiving information only if
   "Hook run before executing an operation in Guix REPL.")
 
 (defvar guix-after-repl-operation-hook
-  '(guix-emacs-load-autoloads-maybe
+  '(guix-emacs-autoload-packages-maybe
     guix-repl-operation-success-message)
   "Hook run after executing successful operation in Guix REPL.")
 
diff --git a/emacs/guix-emacs.el b/emacs/guix-emacs.el
index 37a0bb2..5c32f2f 100644
--- a/emacs/guix-emacs.el
+++ b/emacs/guix-emacs.el
@@ -57,7 +57,7 @@ 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-in-directory (directory)
+(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
@@ -76,45 +76,44 @@ The files in the list do not have extensions (.el, .elc)."
                       (not (file-directory-p file))))
                 (directory-files directory 'full-name nil 'no-sort)))
 
-(defun guix-emacs-find-autoloads (&optional profile)
-  "Return list of autoloads of Emacs packages installed in PROFILE.
+(defun guix-emacs-directories (&optional profile)
+  "Return a list of directories with Emacs packages installed in PROFILE.
 If PROFILE is nil, use `guix-user-profile'.
-Return nil if there are no emacs packages installed in PROFILE."
-  (let ((elisp-root-dir (guix-emacs-directory profile)))
-    (if (file-directory-p elisp-root-dir)
-        (let ((elisp-pkgs-dir (expand-file-name "guix.d" elisp-root-dir))
-              (root-autoloads (guix-emacs-find-autoloads-in-directory
-                               elisp-root-dir)))
-          (if (file-directory-p elisp-pkgs-dir)
-              (let ((pkgs-autoloads
-                     (cl-mapcan #'guix-emacs-find-autoloads-in-directory
-                                (guix-emacs-subdirs elisp-pkgs-dir))))
-                (append root-autoloads pkgs-autoloads))
-            root-autoloads))
-      (message "Directory '%s' does not exist." elisp-root-dir)
-      nil)))
+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)))))
 
 ;;;###autoload
-(defun guix-emacs-load-autoloads (&optional profile)
-  "Load autoloads for Emacs packages installed in PROFILE.
+(defun guix-emacs-autoload-packages (&optional profile)
+  "Autoload Emacs packages installed in PROFILE.
 If PROFILE is nil, use `guix-user-profile'.
-Add autoloads directories to `load-path'."
+
+'Autoload' means add directories with Emacs packages to
+`load-path' and load 'autoloads' files matching
+`guix-emacs-autoloads-regexp'."
   (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
-                                            :test #'string=)))
-    (dolist (file new-autoloads)
-      (cl-pushnew (directory-file-name (file-name-directory file))
-                  load-path
-                  :test #'string=)
-      (load file 'noerror))
-    (setq guix-emacs-autoloads
-          (append new-autoloads guix-emacs-autoloads))))
-
-(defun guix-emacs-load-autoloads-maybe ()
+  (let ((dirs (guix-emacs-directories (or profile guix-user-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))))))
+
+(defun guix-emacs-autoload-packages-maybe ()
   "Load autoloads for Emacs packages if needed.
 See `guix-emacs-activate-after-operation' for details."
   (and guix-emacs-activate-after-operation
@@ -123,11 +122,10 @@ See `guix-emacs-activate-after-operation' for details."
        ;; packages can be installed to another profile, and the
        ;; following code will not work (i.e., the autoloads for this
        ;; profile will not be loaded).
-       (guix-emacs-load-autoloads guix-current-profile)))
+       (guix-emacs-autoload-packages guix-current-profile)))
 
 (when guix-package-enable-at-startup
-  (add-to-list 'load-path (guix-emacs-directory))
-  (guix-emacs-load-autoloads))
+  (guix-emacs-autoload-packages guix-user-profile))
 
 (provide 'guix-emacs)
 
-- 
2.6.3

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

* [PATCH 2/4] emacs: Find Emacs packages in a system profile.
  2016-02-05 12:13 [PATCH 0/4] emacs: Various fixes Alex Kost
  2016-02-05 12:13 ` [PATCH 1/4] emacs: Factorize searching for Emacs packages Alex Kost
@ 2016-02-05 12:13 ` Alex Kost
  2016-02-06 12:46   ` Ludovic Courtès
  2016-02-05 12:13 ` [PATCH 3/4] system: Fix EMACSLOADPATH Alex Kost
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 17+ messages in thread
From: Alex Kost @ 2016-02-05 12:13 UTC (permalink / raw)
  To: guix-devel

Fixes <http://bugs.gnu.org/22550>.

* emacs/guix-emacs.el: Autoload Emacs packages installed in a system
  profile.
---
 emacs/guix-emacs.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/emacs/guix-emacs.el b/emacs/guix-emacs.el
index 5c32f2f..aa8e299 100644
--- a/emacs/guix-emacs.el
+++ b/emacs/guix-emacs.el
@@ -125,6 +125,7 @@ See `guix-emacs-activate-after-operation' for details."
        (guix-emacs-autoload-packages guix-current-profile)))
 
 (when guix-package-enable-at-startup
+  (guix-emacs-autoload-packages "/run/current-system/profile")
   (guix-emacs-autoload-packages guix-user-profile))
 
 (provide 'guix-emacs)
-- 
2.6.3

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

* [PATCH 3/4] system: Fix EMACSLOADPATH.
  2016-02-05 12:13 [PATCH 0/4] emacs: Various fixes Alex Kost
  2016-02-05 12:13 ` [PATCH 1/4] emacs: Factorize searching for Emacs packages Alex Kost
  2016-02-05 12:13 ` [PATCH 2/4] emacs: Find Emacs packages in a system profile Alex Kost
@ 2016-02-05 12:13 ` Alex Kost
  2016-02-06 12:48   ` Ludovic Courtès
  2016-02-05 12:13 ` [PATCH 4/4] doc: Document 'guix-edit' Emacs command Alex Kost
  2016-02-06 12:41 ` [PATCH 0/4] emacs: Various fixes Ludovic Courtès
  4 siblings, 1 reply; 17+ messages in thread
From: Alex Kost @ 2016-02-05 12:13 UTC (permalink / raw)
  To: guix-devel

After commit 13fe4891fa247d306e203ee14c6886513bd86b52, Emacs package
includes "site-start.el", and it has a priority over
"/etc/emacs/site-start.el" on GuixSD because "/etc/emacs" is added to
the end of 'load-path'.

* gnu/system.scm (operating-system-environment-variables): Change
  EMACSLOADPATH to prepend "/etc/emacs" to 'load-path' instead of
  appending.
---
 gnu/system.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/system.scm b/gnu/system.scm
index d4759a0..82dba7f 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -581,8 +581,8 @@ use 'plain-file' instead~%")
     ("SSL_CERT_DIR" . "/etc/ssl/certs")
     ("SSL_CERT_FILE" . "/etc/ssl/certs/ca-certificates.crt")
     ("GIT_SSL_CAINFO" . "/etc/ssl/certs/ca-certificates.crt")
-    ;; Append the directory of 'site-start.el' to the search path.
-    ("EMACSLOADPATH" . ":/etc/emacs")
+    ;; Prepend the directory of 'site-start.el' to the search path.
+    ("EMACSLOADPATH" . "/etc/emacs:")
     ;; By default, applications that use D-Bus, such as Emacs, abort at startup
     ;; when /etc/machine-id is missing.  Make sure these warnings are non-fatal.
     ("DBUS_FATAL_WARNINGS" . "0")))
-- 
2.6.3

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

* [PATCH 4/4] doc: Document 'guix-edit' Emacs command.
  2016-02-05 12:13 [PATCH 0/4] emacs: Various fixes Alex Kost
                   ` (2 preceding siblings ...)
  2016-02-05 12:13 ` [PATCH 3/4] system: Fix EMACSLOADPATH Alex Kost
@ 2016-02-05 12:13 ` Alex Kost
  2016-02-06 12:50   ` Ludovic Courtès
  2016-02-06 12:41 ` [PATCH 0/4] emacs: Various fixes Ludovic Courtès
  4 siblings, 1 reply; 17+ messages in thread
From: Alex Kost @ 2016-02-05 12:13 UTC (permalink / raw)
  To: guix-devel

* doc/emacs.texi (Emacs Commands): Document "M-x guix-edit".
* doc/guix.texi (Invoking guix edit): Mention it.
---
 doc/emacs.texi | 22 ++++++++++++++++++++++
 doc/guix.texi  |  6 +++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/doc/emacs.texi b/doc/emacs.texi
index 19dc87f..48107cb 100644
--- a/doc/emacs.texi
+++ b/doc/emacs.texi
@@ -219,6 +219,28 @@ With @kbd{C-u}, make it verbose.
 Once @command{guix pull} has succeeded, the Guix REPL is restared.  This
 allows you to keep using the Emacs interface with the updated Guix.
 
+Finally, there is an Emacs variant of @command{guix edit} command
+(@pxref{Invoking guix edit}):
+
+@table @kbd
+@item M-x guix-edit
+As with @kbd{M-x guix-packages-by-name}, you can press @key{TAB} to
+complete a package name.
+@end table
+
+If you are contributing to Guix, you may find it useful for @kbd{M-x
+guix-edit} to open package files from your git directory.  This can be
+done by setting @code{guix-directory} variable.  For example, after
+this:
+
+@example
+(setq guix-directory "~/src/guix")
+@end example
+
+@kbd{M-x guix-edit guix} will open
+@file{~/src/guix/gnu/packages/package-management.scm} file.
+
+
 @node Emacs General info
 @subsection General information
 
diff --git a/doc/guix.texi b/doc/guix.texi
index 66ab384..80a1621 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4201,9 +4201,9 @@ launches the program specified in the @code{VISUAL} or in the
 and that of Vim.
 
 If you are using Emacs, note that the Emacs user interface provides
-similar functionality in the ``package info'' and ``package list''
-buffers created by @kbd{M-x guix-search-by-name} and similar commands
-(@pxref{Emacs Commands}).
+@kbd{M-x guix-edit} command and a similar functionality in the ``package
+info'' and ``package list'' buffers created by @kbd{M-x
+guix-search-by-name} and similar commands (@pxref{Emacs Commands}).
 
 
 @node Invoking guix download
-- 
2.6.3

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

* Re: [PATCH 0/4] emacs: Various fixes.
  2016-02-05 12:13 [PATCH 0/4] emacs: Various fixes Alex Kost
                   ` (3 preceding siblings ...)
  2016-02-05 12:13 ` [PATCH 4/4] doc: Document 'guix-edit' Emacs command Alex Kost
@ 2016-02-06 12:41 ` Ludovic Courtès
  2016-02-10  8:48   ` Alex Kost
  4 siblings, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2016-02-06 12:41 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> [PATCH 3/4] system: Fix EMACSLOADPATH.
>
>   This is an easy fix, however I've just thought that we can get rid of
>   EMACSLOADPATH completely.  Since now our Emacs can load packages from
>   guix directories ("~/.guix-profile" and "/run/current-system/profile")
>   there is no need to use "/etc/emacs/site-start.el" anymore, because Emacs
>   will load "guix-autoloads.el" and "geiser-autoloads.el" from a system
>   profile.
>
>   So I think this patch is OK as a current fix, but eventually we should
>   remove "guix-init.el" and "/etc/emacs/site-start.el".  I'll send a
>   patch for it later.

Good, this is better.

Ludo’.

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

* Re: [PATCH 1/4] emacs: Factorize searching for Emacs packages.
  2016-02-05 12:13 ` [PATCH 1/4] emacs: Factorize searching for Emacs packages Alex Kost
@ 2016-02-06 12:45   ` Ludovic Courtès
  2016-02-07  8:35     ` Alex Kost
  0 siblings, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2016-02-06 12:45 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> * emacs/guix-emacs.el: (guix-emacs-directories): New procedure.
> (guix-emacs-find-autoloads-in-directory): Rename to ...
> (guix-emacs-find-autoloads): ... this.
> (guix-emacs-load-autoloads): Replace with ...
> (guix-emacs-autoload-packages): this.  New procedure.  At first, find a
> list of directories with Emacs packages, then add them to 'load-path'
> and finally, load autoloads.
> (guix-emacs-load-autoloads-maybe): Rename to ...
> (guix-emacs-autoload-packages-maybe): ... this.
> * emacs/guix-backend.el (guix-after-repl-operation-hook): Adjust for the
> renaming.
> * doc/emacs.texi (Emacs Initial Setup): Likewise.

[...]

> +(defun guix-emacs-directories (&optional profile)
> +  "Return a list of directories with Emacs packages installed in PROFILE.

Maybe: “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.”

Otherwise LGTM.

Ludo’.

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

* Re: [PATCH 2/4] emacs: Find Emacs packages in a system profile.
  2016-02-05 12:13 ` [PATCH 2/4] emacs: Find Emacs packages in a system profile Alex Kost
@ 2016-02-06 12:46   ` Ludovic Courtès
  2016-02-07  8:34     ` Alex Kost
  0 siblings, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2016-02-06 12:46 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> Fixes <http://bugs.gnu.org/22550>.

Please add “Reported by …”.

> * emacs/guix-emacs.el: Autoload Emacs packages installed in a system
>   profile.

OK!

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

* Re: [PATCH 3/4] system: Fix EMACSLOADPATH.
  2016-02-05 12:13 ` [PATCH 3/4] system: Fix EMACSLOADPATH Alex Kost
@ 2016-02-06 12:48   ` Ludovic Courtès
  2016-02-07  8:34     ` Alex Kost
  0 siblings, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2016-02-06 12:48 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> After commit 13fe4891fa247d306e203ee14c6886513bd86b52, Emacs package
> includes "site-start.el", and it has a priority over
> "/etc/emacs/site-start.el" on GuixSD because "/etc/emacs" is added to
> the end of 'load-path'.
>
> * gnu/system.scm (operating-system-environment-variables): Change
>   EMACSLOADPATH to prepend "/etc/emacs" to 'load-path' instead of
>   appending.

[...]

> +    ;; Prepend the directory of 'site-start.el' to the search path.

+ “so that it has higher precedence than the ‘site-start.el’ file our
Emacs package provides.”

OK!

Ludo’.

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

* Re: [PATCH 4/4] doc: Document 'guix-edit' Emacs command.
  2016-02-05 12:13 ` [PATCH 4/4] doc: Document 'guix-edit' Emacs command Alex Kost
@ 2016-02-06 12:50   ` Ludovic Courtès
  2016-02-07  8:34     ` Alex Kost
  0 siblings, 1 reply; 17+ messages in thread
From: Ludovic Courtès @ 2016-02-06 12:50 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> * doc/emacs.texi (Emacs Commands): Document "M-x guix-edit".
> * doc/guix.texi (Invoking guix edit): Mention it.

[...]

> +@kbd{M-x guix-edit guix} will open

s/will open/opens/

Otherwise OK.

Thank you!

Ludo’.

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

* Re: [PATCH 3/4] system: Fix EMACSLOADPATH.
  2016-02-06 12:48   ` Ludovic Courtès
@ 2016-02-07  8:34     ` Alex Kost
  0 siblings, 0 replies; 17+ messages in thread
From: Alex Kost @ 2016-02-07  8:34 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2016-02-06 15:48 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> After commit 13fe4891fa247d306e203ee14c6886513bd86b52, Emacs package
>> includes "site-start.el", and it has a priority over
>> "/etc/emacs/site-start.el" on GuixSD because "/etc/emacs" is added to
>> the end of 'load-path'.
>>
>> * gnu/system.scm (operating-system-environment-variables): Change
>>   EMACSLOADPATH to prepend "/etc/emacs" to 'load-path' instead of
>>   appending.
>
> [...]
>
>> +    ;; Prepend the directory of 'site-start.el' to the search path.
>
> + “so that it has higher precedence than the ‘site-start.el’ file our
> Emacs package provides.”
>
> OK!

Added, thanks!

-- 
Alex

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

* Re: [PATCH 4/4] doc: Document 'guix-edit' Emacs command.
  2016-02-06 12:50   ` Ludovic Courtès
@ 2016-02-07  8:34     ` Alex Kost
  0 siblings, 0 replies; 17+ messages in thread
From: Alex Kost @ 2016-02-07  8:34 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2016-02-06 15:50 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> * doc/emacs.texi (Emacs Commands): Document "M-x guix-edit".
>> * doc/guix.texi (Invoking guix edit): Mention it.
>
> [...]
>
>> +@kbd{M-x guix-edit guix} will open
>
> s/will open/opens/
>
> Otherwise OK.
>
> Thank you!

Fixed and pushed, thanks!

-- 
Alex

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

* Re: [PATCH 2/4] emacs: Find Emacs packages in a system profile.
  2016-02-06 12:46   ` Ludovic Courtès
@ 2016-02-07  8:34     ` Alex Kost
  0 siblings, 0 replies; 17+ messages in thread
From: Alex Kost @ 2016-02-07  8:34 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2016-02-06 15:46 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> Fixes <http://bugs.gnu.org/22550>.
>
> Please add “Reported by …”.

Added.

>> * emacs/guix-emacs.el: Autoload Emacs packages installed in a system
>>   profile.
>
> OK!

-- 
Alex

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

* Re: [PATCH 1/4] emacs: Factorize searching for Emacs packages.
  2016-02-06 12:45   ` Ludovic Courtès
@ 2016-02-07  8:35     ` Alex Kost
  0 siblings, 0 replies; 17+ messages in thread
From: Alex Kost @ 2016-02-07  8:35 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2016-02-06 15:45 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> * emacs/guix-emacs.el: (guix-emacs-directories): New procedure.
>> (guix-emacs-find-autoloads-in-directory): Rename to ...
>> (guix-emacs-find-autoloads): ... this.
>> (guix-emacs-load-autoloads): Replace with ...
>> (guix-emacs-autoload-packages): this.  New procedure.  At first, find a
>> list of directories with Emacs packages, then add them to 'load-path'
>> and finally, load autoloads.
>> (guix-emacs-load-autoloads-maybe): Rename to ...
>> (guix-emacs-autoload-packages-maybe): ... this.
>> * emacs/guix-backend.el (guix-after-repl-operation-hook): Adjust for the
>> renaming.
>> * doc/emacs.texi (Emacs Initial Setup): Likewise.
>
> [...]
>
>> +(defun guix-emacs-directories (&optional profile)
>> +  "Return a list of directories with Emacs packages installed in PROFILE.
>
> Maybe: “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.”
>
> Otherwise LGTM.

Done, thanks!

-- 
Alex

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

* Re: [PATCH 0/4] emacs: Various fixes.
  2016-02-06 12:41 ` [PATCH 0/4] emacs: Various fixes Ludovic Courtès
@ 2016-02-10  8:48   ` Alex Kost
  2016-03-17 10:21     ` [PATCHES] Do not use special site-start.el on GuixSD Alex Kost
  0 siblings, 1 reply; 17+ messages in thread
From: Alex Kost @ 2016-02-10  8:48 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2016-02-06 15:41 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> [PATCH 3/4] system: Fix EMACSLOADPATH.
>>
>>   This is an easy fix, however I've just thought that we can get rid of
>>   EMACSLOADPATH completely.  Since now our Emacs can load packages from
>>   guix directories ("~/.guix-profile" and "/run/current-system/profile")
>>   there is no need to use "/etc/emacs/site-start.el" anymore, because Emacs
>>   will load "guix-autoloads.el" and "geiser-autoloads.el" from a system
>>   profile.
>>
>>   So I think this patch is OK as a current fix, but eventually we should
>>   remove "guix-init.el" and "/etc/emacs/site-start.el".  I'll send a
>>   patch for it later.
>
> Good, this is better.

OK, so I'm sending the following patches for this change:

[PATCH 1/3] emacs: Autoload hooks instead of putting them in 'guix-init'.
[PATCH 2/3] system: Do not create "site-start.el".
[PATCH 3/3] emacs: Deprecate "guix-init.el".

However, they should be commited after updating guix-devel snapshot,
because with the current source, Emacs finds packages only in a user
profile, but not in the system one (it was introduced in commit
004ea62).

-- 
Alex

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

* [PATCHES] Do not use special site-start.el on GuixSD
  2016-02-10  8:48   ` Alex Kost
@ 2016-03-17 10:21     ` Alex Kost
  2016-03-17 21:33       ` Ludovic Courtès
  0 siblings, 1 reply; 17+ messages in thread
From: Alex Kost @ 2016-03-17 10:21 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

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

Alex Kost (2016-02-10 11:48 +0300) wrote:

> Ludovic Courtès (2016-02-06 15:41 +0300) wrote:
>
>> Alex Kost <alezost@gmail.com> skribis:
>>
>>> [PATCH 3/4] system: Fix EMACSLOADPATH.
>>>
>>>   This is an easy fix, however I've just thought that we can get rid of
>>>   EMACSLOADPATH completely.  Since now our Emacs can load packages from
>>>   guix directories ("~/.guix-profile" and "/run/current-system/profile")
>>>   there is no need to use "/etc/emacs/site-start.el" anymore, because Emacs
>>>   will load "guix-autoloads.el" and "geiser-autoloads.el" from a system
>>>   profile.
>>>
>>>   So I think this patch is OK as a current fix, but eventually we should
>>>   remove "guix-init.el" and "/etc/emacs/site-start.el".  I'll send a
>>>   patch for it later.
>>
>> Good, this is better.
>
> OK, so I'm sending the following patches for this change:
>
> [PATCH 1/3] emacs: Autoload hooks instead of putting them in 'guix-init'.
  This was committed as 19a9c6f.

> [PATCH 2/3] system: Do not create "site-start.el".
> [PATCH 3/3] emacs: Deprecate "guix-init.el".
>
> However, they should be commited after updating guix-devel snapshot,
> because with the current source, Emacs finds packages only in a user
> profile, but not in the system one (it was introduced in commit
> 004ea62).

Since guix-devel was updated (commit 092dd65), I think it's the time for
this change.  The patches can be found at ¹ and ², but I reattach them
to this message as well.  Also I attach another patch to clarify how to
set up "guix.el".

¹ http://lists.gnu.org/archive/html/guix-devel/2016-02/msg00362.html
² http://lists.gnu.org/archive/html/guix-devel/2016-02/msg00363.html


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-system-Do-not-create-site-start.el.patch --]
[-- Type: text/x-patch, Size: 3298 bytes --]

From c351f4e13e258b7b226c3bfed98fd84f1ecb7e6a Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Mon, 8 Feb 2016 20:24:23 +0300
Subject: [PATCH 1/3] system: Do not create "site-start.el".

After commits 004ea62 and 092dd65, Emacs can find packages in a system
profile, so it autoloads guix code without additional hacks, which can
be removed now.

* gnu/system.scm (emacs-site-file, emacs-site-directory): Remove.
(operating-system-etc-service): Adjust accordingly.
(operating-system-environment-variables): Remove EMACSLOADPATH.
---
 gnu/system.scm | 31 -------------------------------
 1 file changed, 31 deletions(-)

diff --git a/gnu/system.scm b/gnu/system.scm
index 5be24ba..c5edf4d 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -400,37 +400,11 @@ This is the GNU system.  Welcome.\n")
   "Return the default /etc/hosts file."
   (plain-file "hosts" (local-host-aliases host-name)))
 
-(define (emacs-site-file)
-  "Return the Emacs 'site-start.el' file.  That file contains the necessary
-settings for 'guix.el' to work out-of-the-box."
-  (scheme-file "site-start.el"
-               #~(progn
-                  ;; Add the "normal" elisp directory to the search path;
-                  ;; guix.el may be there.
-                  (add-to-list
-                   'load-path
-                   "/run/current-system/profile/share/emacs/site-lisp")
-
-                  ;; Attempt to load guix.el.
-                  (require 'guix-init nil t)
-
-                  ;; Attempt to load geiser.
-                  (require 'geiser-install nil t))))
-
-(define (emacs-site-directory)
-  "Return the Emacs site directory, aka. /etc/emacs."
-  (computed-file "emacs"
-                 #~(begin
-                     (mkdir #$output)
-                     (chdir #$output)
-                     (symlink #$(emacs-site-file) "site-start.el"))))
-
 (define* (operating-system-etc-service os)
   "Return a <service> that builds containing the static part of the /etc
 directory."
   (let ((login.defs (plain-file "login.defs" "# Empty for now.\n"))
 
-        (emacs      (emacs-site-directory))
         (issue      (plain-file "issue" (operating-system-issue os)))
         (nsswitch   (plain-file "nsswitch.conf"
                                 (name-service-switch->string
@@ -507,7 +481,6 @@ fi\n")))
      `(("services" ,#~(string-append #$net-base "/etc/services"))
        ("protocols" ,#~(string-append #$net-base "/etc/protocols"))
        ("rpc" ,#~(string-append #$net-base "/etc/rpc"))
-       ("emacs" ,#~#$emacs)
        ("login.defs" ,#~#$login.defs)
        ("issue" ,#~#$issue)
        ("nsswitch.conf" ,#~#$nsswitch)
@@ -587,10 +560,6 @@ use 'plain-file' instead~%")
     ("SSL_CERT_DIR" . "/etc/ssl/certs")
     ("SSL_CERT_FILE" . "/etc/ssl/certs/ca-certificates.crt")
     ("GIT_SSL_CAINFO" . "/etc/ssl/certs/ca-certificates.crt")
-    ;; Prepend the directory of 'site-start.el' to the search path, so
-    ;; that it has higher precedence than the 'site-start.el' file our
-    ;; Emacs package provides.
-    ("EMACSLOADPATH" . "/etc/emacs:")
     ;; By default, applications that use D-Bus, such as Emacs, abort at startup
     ;; when /etc/machine-id is missing.  Make sure these warnings are non-fatal.
     ("DBUS_FATAL_WARNINGS" . "0")))
-- 
2.6.3


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-emacs-Deprecate-guix-init.el.patch --]
[-- Type: text/x-patch, Size: 3910 bytes --]

From dd411c41c97514ec30d87d67a0998d665970c4e8 Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Mon, 8 Feb 2016 20:34:13 +0300
Subject: [PATCH 2/3] emacs: Deprecate "guix-init.el".

'guix-init' served 2 purposes:

- to autoload guix commands (by requiring 'guix-autoloads');
- and to autoload Emacs packages installed with Guix (by requiring
  'guix-emacs').

The second purpose is not actual anymore, as Emacs package handles this
task now, so there is no need in 'guix-init' anymore.

* emacs/guix-init.el: Do not require 'guix-emacs'.  Add a deprecation
  message.
* doc/emacs.texi (Emacs Initial Setup): Recommend to use
  'guix-autoloads' instead of 'guix-init'.
---
 doc/emacs.texi     | 33 +++++++++------------------------
 emacs/guix-init.el |  3 +--
 2 files changed, 10 insertions(+), 26 deletions(-)

diff --git a/doc/emacs.texi b/doc/emacs.texi
index 27f5365..527afe7 100644
--- a/doc/emacs.texi
+++ b/doc/emacs.texi
@@ -48,13 +48,13 @@ command (@pxref{Emacs Popup Interface}).
 
 @end itemize
 
-When it is done ``guix.el'' may be configured by requiring a special
-@code{guix-init} file---i.e., by adding the following code into your
-init file (@pxref{Init File,,, emacs, The GNU Emacs Manual}):
+When it is done, ``guix.el'' may be configured by requiring
+@code{guix-autoloads} file---i.e., by adding the following code into
+your init file (@pxref{Init File,,, emacs, The GNU Emacs Manual}):
 
 @example
 (add-to-list 'load-path "/path/to/directory-with-guix.el")
-(require 'guix-init nil t)
+(require 'guix-autoloads nil t)
 @end example
 
 So the only thing you need to figure out is where the directory with
@@ -74,9 +74,10 @@ then Guix is installed somewhere in the store, so the elisp files are
 placed in @file{/gnu/store/@dots{}-guix-0.8.2/share/emacs/site-lisp/} or
 alike.  However it is not recommended to refer directly to a store
 directory.  Instead you can install Guix using Guix itself with
-@command{guix package -i guix} command (@pxref{Invoking guix package})
-and add @file{~/.guix-profile/share/emacs/site-lisp/} directory to
-@code{load-path} variable.
+@command{guix package -i guix} command (@pxref{Invoking guix package}).
+No further actions are needed in this case, as @code{guix-autoloads}
+file will automatically be loaded by Emacs (if it is installed with
+Guix, of course) (@pxref{Application Setup}).
 
 @item
 If you did not install Guix at all and prefer a hacking way
@@ -88,26 +89,10 @@ same directory, so your final configuration will look like this:
 (let ((dir "/path/to/your-guix-git-tree/emacs"))
   (add-to-list 'load-path dir)
   (setq guix-load-path dir))
-(require 'guix-init nil t)
+(require 'guix-autoloads nil t)
 @end example
 @end itemize
 
-By default, along with autoloading (@pxref{Autoload,,, elisp, The GNU
-Emacs Lisp Reference Manual}) the main interactive commands for
-``guix.el'' (@pxref{Emacs Commands}), requiring @code{guix-init} will
-also autoload commands for the Emacs packages installed in your user
-profile.
-
-To disable automatic loading of installed Emacs packages, set
-@code{guix-package-enable-at-startup} variable to @code{nil} before
-requiring @code{guix-init}.  This variable has the same meaning for
-Emacs packages installed with Guix, as @code{package-enable-at-startup}
-for the built-in Emacs package system (@pxref{Package Installation,,,
-emacs, The GNU Emacs Manual}).
-
-You can activate Emacs packages installed in your profile whenever you
-want using @kbd{M-x@tie{}guix-emacs-autoload-packages}.
-
 
 @node Emacs Package Management
 @section Package Management
diff --git a/emacs/guix-init.el b/emacs/guix-init.el
index 1d7d258..bd75e54 100644
--- a/emacs/guix-init.el
+++ b/emacs/guix-init.el
@@ -1,4 +1,3 @@
 (require 'guix-autoloads)
-(require 'guix-emacs)
-
+(message "(require 'guix-init) is obsolete, use (require 'guix-autoloads) instead.")
 (provide 'guix-init)
-- 
2.6.3


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-doc-Clarify-installation-instructions-for-guix.el.patch --]
[-- Type: text/x-patch, Size: 2697 bytes --]

From 5332759fbd531226bdd54b723cdd789dcf21b42e Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Sat, 5 Mar 2016 11:39:35 +0300
Subject: [PATCH 3/3] doc: Clarify installation instructions for "guix.el".

* doc/emacs.texi (Emacs Initial Setup): Mention that "guix package -i
guix" is an easy way.  Warn that "make install" may lead to an outdated
code.
---
 doc/emacs.texi | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/doc/emacs.texi b/doc/emacs.texi
index 527afe7..c4fdfff 100644
--- a/doc/emacs.texi
+++ b/doc/emacs.texi
@@ -49,7 +49,13 @@ command (@pxref{Emacs Popup Interface}).
 @end itemize
 
 When it is done, ``guix.el'' may be configured by requiring
-@code{guix-autoloads} file---i.e., by adding the following code into
+@code{guix-autoloads} file.  If you install Guix in your user profile,
+this auto-loading is done automatically by our Emacs package
+(@pxref{Application Setup}), so a universal recipe for configuring
+``guix.el'' is: @command{guix package -i guix}.  If you do this, there
+is no need to read further.
+
+For the manual installation, you need to add the following code into
 your init file (@pxref{Init File,,, emacs, The GNU Emacs Manual}):
 
 @example
@@ -66,18 +72,19 @@ If it was installed by a package manager of your distribution or by a
 usual @code{./configure && make && make install} command sequence, then
 elisp files are placed in a standard directory with Emacs packages
 (usually it is @file{/usr/share/emacs/site-lisp/}), which is already in
-@code{load-path}, so there is no need to add that directory there.
+@code{load-path}, so there is no need to add that directory there.  Note
+that if you don't update this installation periodically, you may get an
+outdated Emacs code which does not work with the current Guile code of
+Guix.
 
 @item
 If you used a binary installation method (@pxref{Binary Installation}),
 then Guix is installed somewhere in the store, so the elisp files are
 placed in @file{/gnu/store/@dots{}-guix-0.8.2/share/emacs/site-lisp/} or
 alike.  However it is not recommended to refer directly to a store
-directory.  Instead you can install Guix using Guix itself with
-@command{guix package -i guix} command (@pxref{Invoking guix package}).
-No further actions are needed in this case, as @code{guix-autoloads}
-file will automatically be loaded by Emacs (if it is installed with
-Guix, of course) (@pxref{Application Setup}).
+directory, as it may be garbage-collected one day.  So a better choice
+would be to install Guix using Guix itself with @command{guix package -i
+guix}.
 
 @item
 If you did not install Guix at all and prefer a hacking way
-- 
2.6.3


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

* Re: [PATCHES] Do not use special site-start.el on GuixSD
  2016-03-17 10:21     ` [PATCHES] Do not use special site-start.el on GuixSD Alex Kost
@ 2016-03-17 21:33       ` Ludovic Courtès
  0 siblings, 0 replies; 17+ messages in thread
From: Ludovic Courtès @ 2016-03-17 21:33 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> Alex Kost (2016-02-10 11:48 +0300) wrote:
>
>> Ludovic Courtès (2016-02-06 15:41 +0300) wrote:
>>
>>> Alex Kost <alezost@gmail.com> skribis:
>>>
>>>> [PATCH 3/4] system: Fix EMACSLOADPATH.
>>>>
>>>>   This is an easy fix, however I've just thought that we can get rid of
>>>>   EMACSLOADPATH completely.  Since now our Emacs can load packages from
>>>>   guix directories ("~/.guix-profile" and "/run/current-system/profile")
>>>>   there is no need to use "/etc/emacs/site-start.el" anymore, because Emacs
>>>>   will load "guix-autoloads.el" and "geiser-autoloads.el" from a system
>>>>   profile.
>>>>
>>>>   So I think this patch is OK as a current fix, but eventually we should
>>>>   remove "guix-init.el" and "/etc/emacs/site-start.el".  I'll send a
>>>>   patch for it later.
>>>
>>> Good, this is better.
>>
>> OK, so I'm sending the following patches for this change:
>>
>> [PATCH 1/3] emacs: Autoload hooks instead of putting them in 'guix-init'.
>   This was committed as 19a9c6f.
>
>> [PATCH 2/3] system: Do not create "site-start.el".
>> [PATCH 3/3] emacs: Deprecate "guix-init.el".
>>
>> However, they should be commited after updating guix-devel snapshot,
>> because with the current source, Emacs finds packages only in a user
>> profile, but not in the system one (it was introduced in commit
>> 004ea62).
>
> Since guix-devel was updated (commit 092dd65), I think it's the time for
> this change.  The patches can be found at ¹ and ², but I reattach them
> to this message as well.  Also I attach another patch to clarify how to
> set up "guix.el".
>
> ¹ http://lists.gnu.org/archive/html/guix-devel/2016-02/msg00362.html
> ² http://lists.gnu.org/archive/html/guix-devel/2016-02/msg00363.html

Sure!

Thanks for keeping it in mind.

Ludo’.

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

end of thread, other threads:[~2016-03-17 21:33 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-05 12:13 [PATCH 0/4] emacs: Various fixes Alex Kost
2016-02-05 12:13 ` [PATCH 1/4] emacs: Factorize searching for Emacs packages Alex Kost
2016-02-06 12:45   ` Ludovic Courtès
2016-02-07  8:35     ` Alex Kost
2016-02-05 12:13 ` [PATCH 2/4] emacs: Find Emacs packages in a system profile Alex Kost
2016-02-06 12:46   ` Ludovic Courtès
2016-02-07  8:34     ` Alex Kost
2016-02-05 12:13 ` [PATCH 3/4] system: Fix EMACSLOADPATH Alex Kost
2016-02-06 12:48   ` Ludovic Courtès
2016-02-07  8:34     ` Alex Kost
2016-02-05 12:13 ` [PATCH 4/4] doc: Document 'guix-edit' Emacs command Alex Kost
2016-02-06 12:50   ` Ludovic Courtès
2016-02-07  8:34     ` Alex Kost
2016-02-06 12:41 ` [PATCH 0/4] emacs: Various fixes Ludovic Courtès
2016-02-10  8:48   ` Alex Kost
2016-03-17 10:21     ` [PATCHES] Do not use special site-start.el on GuixSD Alex Kost
2016-03-17 21:33       ` Ludovic Courtès

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.