guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/05: emacs: Move the code to load Emacs packages after installing.


From: Alex Kost
Subject: 02/05: emacs: Move the code to load Emacs packages after installing.
Date: Sun, 07 Feb 2016 08:30:57 +0000

alezost pushed a commit to branch master
in repository guix.

commit 09b634565d6102a2d87302bcf83a290fb6fe862a
Author: Alex Kost <address@hidden>
Date:   Sat Feb 6 01:34:33 2016 +0300

    emacs: Move the code to load Emacs packages after installing.
    
    This code should belong to "guix-backend" as it is run after a REPL
    operation to check if new Emacs packages have been installed and to
    autoload them if needed.
    
    * emacs/guix-emacs.el (guix-emacs-activate-after-operation)
    (guix-emacs-load-autoloads-maybe): Move and rename to...
    * emacs/guix-backend.el (guix-emacs-activate-after-operation)
    (guix-repl-autoload-emacs-packages-maybe): ... this.
    (guix-after-repl-operation-hook): Adjust for the renaming.
---
 emacs/guix-backend.el |   23 +++++++++++++++++++++--
 emacs/guix-emacs.el   |   18 ------------------
 2 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/emacs/guix-backend.el b/emacs/guix-backend.el
index 0736f85..8afbc9e 100644
--- a/emacs/guix-backend.el
+++ b/emacs/guix-backend.el
@@ -1,6 +1,6 @@
 ;;; guix-backend.el --- Making and using Guix REPL
 
-;; Copyright © 2014, 2015 Alex Kost <address@hidden>
+;; Copyright © 2014, 2015, 2016 Alex Kost <address@hidden>
 
 ;; This file is part of GNU Guix.
 
@@ -53,6 +53,7 @@
 (require 'guix-config)
 (require 'guix-external)
 (require 'guix-emacs)
+(require 'guix-profiles)
 
 (defvar guix-load-path guix-config-emacs-interface-directory
   "Directory with scheme files for \"guix.el\" package.")
@@ -101,6 +102,13 @@ The function is called without arguments."
                  (function :tag "Other function"))
   :group 'guix-repl)
 
+(defcustom guix-emacs-activate-after-operation t
+  "Activate Emacs packages after installing.
+If nil, do not load autoloads of the Emacs packages after
+they are successfully installed."
+  :type 'boolean
+  :group 'guix-repl)
+
 (defvar guix-repl-current-socket nil
   "Name of a socket file used by the current Guix REPL.")
 
@@ -121,7 +129,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-repl-autoload-emacs-packages-maybe
     guix-repl-operation-success-message)
   "Hook run after executing successful operation in Guix REPL.")
 
@@ -136,6 +144,17 @@ This internal variable is used to define what actions 
should be
 executed after the current operation succeeds.
 See `guix-eval-in-repl' for details.")
 
+(defun guix-repl-autoload-emacs-packages-maybe ()
+  "Load autoloads for Emacs packages if needed.
+See `guix-emacs-activate-after-operation' for details."
+  (and guix-emacs-activate-after-operation
+       ;; FIXME Since a user can work with a non-current profile (using
+       ;; C-u before `guix-search-by-name' and other commands), emacs
+       ;; 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-autoload-packages guix-current-profile)))
+
 (defun guix-repl-operation-success-message ()
   "Message telling about successful Guix operation."
   (message "Guix operation has been performed."))
diff --git a/emacs/guix-emacs.el b/emacs/guix-emacs.el
index 03f29ed..be1e170 100644
--- a/emacs/guix-emacs.el
+++ b/emacs/guix-emacs.el
@@ -36,13 +36,6 @@ avoid loading autoloads of Emacs packages installed in
   :type 'boolean
   :group 'guix)
 
-(defcustom guix-emacs-activate-after-operation t
-  "Activate Emacs packages after installing.
-If nil, do not load autoloads of the Emacs packages after
-they are successfully installed."
-  :type 'boolean
-  :group 'guix)
-
 (defvar guix-emacs-autoloads nil
   "List of the last loaded Emacs autoloads.")
 
@@ -120,17 +113,6 @@ If PROFILES are not specified, use `guix-user-profile'.
             (setq guix-emacs-autoloads
                   (append new-autoloads guix-emacs-autoloads))))))))
 
-(defun guix-emacs-load-autoloads-maybe ()
-  "Load autoloads for Emacs packages if needed.
-See `guix-emacs-activate-after-operation' for details."
-  (and guix-emacs-activate-after-operation
-       ;; FIXME Since a user can work with a non-current profile (using
-       ;; C-u before `guix-search-by-name' and other commands), emacs
-       ;; 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-autoload-packages guix-current-profile)))
-
 (when guix-package-enable-at-startup
   (guix-emacs-autoload-packages))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]