summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2017-02-18 11:44:52 +0300
committerAlex Kost <alezost@gmail.com>2017-02-27 16:44:58 +0300
commit9bd94544be43b7d028e1aaeb4069b07bdb24610f (patch)
tree3d84d8d5aedeb3de44b81227911fa9a12506e609
parent59d04f63dfe8b68906e4cccc60ca27cbd546db78 (diff)
downloadguix-9bd94544be43b7d028e1aaeb4069b07bdb24610f.tar.gz
gnu: emacs: Simplify "guix-emacs.el".
* gnu/packages/aux-files/emacs/guix-emacs.el: Do not try to require
'guix-profiles'.  Do not call 'guix-emacs-autoload-packages' in the top
level.
(guix-package-enable-at-startup): Remove.  This variable can't be set by
a user since this file is loaded before user config.
(guix-emacs-autoload-packages): Use 'guix-read-package-profile' instead
of 'guix-profile-prompt' in interactive clause (it was renamed in
Emacs-Guix).
* gnu/packages/emacs.scm (emacs)[arguments]: Call
'guix-emacs-autoload-packages' in "site-start.el" after requiring
'guix-emacs'.
-rw-r--r--gnu/packages/aux-files/emacs/guix-emacs.el21
-rw-r--r--gnu/packages/emacs.scm4
2 files changed, 8 insertions, 17 deletions
diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el b/gnu/packages/aux-files/emacs/guix-emacs.el
index 099261a013..2bbd639ffd 100644
--- a/gnu/packages/aux-files/emacs/guix-emacs.el
+++ b/gnu/packages/aux-files/emacs/guix-emacs.el
@@ -1,6 +1,6 @@
 ;;; guix-emacs.el --- Emacs packages installed with Guix
 
-;; Copyright © 2014, 2015, 2016 Alex Kost <alezost@gmail.com>
+;; Copyright © 2014, 2015, 2016, 2017 Alex Kost <alezost@gmail.com>
 
 ;; This file is part of GNU Guix.
 
@@ -19,22 +19,14 @@
 
 ;;; Commentary:
 
-;; This file provides auxiliary code for working with Emacs packages
+;; This file provides auxiliary code to autoload Emacs packages
 ;; installed with Guix.
 
 ;;; Code:
 
 (require 'cl-lib)
-(unless (require 'guix-profiles nil t)
-  (defvar guix-user-profile (expand-file-name "~/.guix-profile")))
 
-(defcustom guix-package-enable-at-startup t
-  "If non-nil, activate Emacs packages installed in a user profile.
-Set this variable to nil before requiring `guix-emacs' file to
-avoid loading autoloads of Emacs packages installed in
-`guix-user-profile'."
-  :type 'boolean
-  :group 'guix)
+(defvar guix-user-profile (expand-file-name "~/.guix-profile"))
 
 (defvar guix-emacs-autoloads nil
   "List of the last loaded Emacs autoloads.")
@@ -92,8 +84,8 @@ profiles.
 '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)
+  (interactive (list (if (fboundp 'guix-read-package-profile)
+                         (funcall 'guix-read-package-profile)
                        guix-user-profile)))
   (let ((profiles (or profiles
                       (list "/run/current-system/profile"
@@ -115,9 +107,6 @@ profiles.
             (setq guix-emacs-autoloads
                   (append new-autoloads guix-emacs-autoloads))))))))
 
-(when guix-package-enable-at-startup
-  (guix-emacs-autoload-packages))
-
 (provide 'guix-emacs)
 
 ;;; guix-emacs.el ends here
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 3e722c326b..ca3b832dc0 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -144,7 +144,9 @@
                           (string-append lisp-dir "/guix-emacs.el"))
                (with-output-to-file (string-append lisp-dir "/site-start.el")
                  (lambda ()
-                   (display "(require 'guix-emacs nil t)")))
+                   (display
+                    (string-append "(when (require 'guix-emacs nil t)\n"
+                                   "  (guix-emacs-autoload-packages))\n"))))
                #t))))))
     (inputs
      `(("gnutls" ,gnutls)