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

> Ludovic Courtès (2016-02-06 15:41 +0300) wrote:
>
>> Alex Kost <alez...@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

>From c351f4e13e258b7b226c3bfed98fd84f1ecb7e6a Mon Sep 17 00:00:00 2001
From: Alex Kost <alez...@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

>From dd411c41c97514ec30d87d67a0998d665970c4e8 Mon Sep 17 00:00:00 2001
From: Alex Kost <alez...@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

>From 5332759fbd531226bdd54b723cdd789dcf21b42e Mon Sep 17 00:00:00 2001
From: Alex Kost <alez...@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

Reply via email to