guix-commits
[Top][All Lists]
Advanced

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

05/06: gnu: emacs: Reload subdirs.el files in ‘guix-emacs-autoload-packa


From: guix-commits
Subject: 05/06: gnu: emacs: Reload subdirs.el files in ‘guix-emacs-autoload-packages’.
Date: Sat, 9 Sep 2023 04:18:23 -0400 (EDT)

lilyp pushed a commit to branch emacs-team
in repository guix.

commit b02ad19305b8b35444e517318e85fefc4c8a31c9
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Fri Sep 1 00:53:21 2023 -0400

    gnu: emacs: Reload subdirs.el files in ‘guix-emacs-autoload-packages’.
    
    This fixes a regression introduced with 79cfe30f3 ("build-system: emacs: Use
    subdirectories again.") which caused the 'guix-emacs-autoload-packages' to 
no
    longer be able to autoload all packages.
    
    * gnu/packages/aux-files/emacs/guix-emacs.el
    (guix-emacs-autoload-packages): Reload subdirs.el files unless NO-RELOAD is
    provided.  Update docstring.
    * doc/guix.texi (Application Setup): Document that
    ‘guix-emacs-autoload-packages’ can be invoked interactively to auto-reload
    newly installed Emacs packages.
    * gnu/packages/emacs.scm (emacs)[arguments]<#:phases>: Call
    guix-emacs-autoload-packages with an argument in the site-start.el file.
    
    Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 doc/guix.texi                              | 11 +++++++----
 gnu/packages/aux-files/emacs/guix-emacs.el | 15 ++++++++++++---
 gnu/packages/emacs.scm                     |  2 +-
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 6105195bd9..89306c0b45 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2167,12 +2167,15 @@ which they are installed.  The Elisp libraries are made 
available to
 Emacs through the @env{EMACSLOADPATH} environment variable, which is
 set when installing Emacs itself.
 
+@cindex guix-emacs-autoload-packages, refreshing Emacs packages
 Additionally, autoload definitions are automatically evaluated at the
 initialization of Emacs, by the Guix-specific
-@code{guix-emacs-autoload-packages} procedure.  If, for some reason, you
-want to avoid auto-loading the Emacs packages installed with Guix, you
-can do so by running Emacs with the @option{--no-site-file} option
-(@pxref{Init File,,, emacs, The GNU Emacs Manual}).
+@code{guix-emacs-autoload-packages} procedure.  This procedure can be
+interactively invoked to have newly installed Emacs packages discovered,
+without having to restart Emacs.  If, for some reason, you want to avoid
+auto-loading the Emacs packages installed with Guix, you can do so by
+running Emacs with the @option{--no-site-file} option (@pxref{Init
+File,,, emacs, The GNU Emacs Manual}).
 
 @quotation Note
 Emacs can now compile packages natively.  Under the default
diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el 
b/gnu/packages/aux-files/emacs/guix-emacs.el
index 84284dde39..c253e64df8 100644
--- a/gnu/packages/aux-files/emacs/guix-emacs.el
+++ b/gnu/packages/aux-files/emacs/guix-emacs.el
@@ -65,12 +65,21 @@ The files in the list do not have extensions (.el, .elc)."
                       (guix-emacs--non-core-load-path))))
 
 ;;;###autoload
-(defun guix-emacs-autoload-packages ()
+(defun guix-emacs-autoload-packages (&optional no-reload)
   "Autoload Emacs packages found in EMACSLOADPATH.
 
 'Autoload' means to load the 'autoloads' files matching
-`guix-emacs-autoloads-regexp'."
-  (interactive)
+`guix-emacs-autoloads-regexp'.  By default, the subdirs.el files
+found on the load path are reloaded to discover newly installed
+packages, unless NO-RELOAD is provided."
+  (interactive "P")
+  ;; Reload the subdirs.el files such as the one generated by the Guix profile
+  ;; hook, so that newly installed Emacs packages located under
+  ;; sub-directories are put on the load-path without having to restart Emacs.
+  (unless no-reload
+    (mapc #'guix-emacs--load-file-no-error (guix-emacs--subdirs-files))
+    (setq load-path (delete-dups load-path)))
+
   (let ((autoloads (mapcan #'guix-emacs-find-autoloads
                            (guix-emacs--non-core-load-path))))
     (mapc #'guix-emacs--load-file-no-error autoloads)))
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index cbdc0598b1..25bfe40774 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -209,7 +209,7 @@
                     (display
                      (string-append
                       "(when (require 'guix-emacs nil t)\n"
-                      "  (guix-emacs-autoload-packages)\n"
+                      "  (guix-emacs-autoload-packages 'no-reload)\n"
                       "  (advice-add 'package-load-all-descriptors"
                       " :after #'guix-emacs-load-package-descriptors))"))))
                 ;; Remove the extraneous subdirs.el file, as it causes Emacs to



reply via email to

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