Fixes <http://bugs.gnu.org/22550>.
Reported by myglc2 <myglc2@gmail.com>.
* emacs/guix-emacs.el (guix-emacs-autoload-packages): Autoload Emacs
packages installed in a system profile.
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-emacs.el: (guix-emacs-directories): New procedure.
(guix-emacs-find-autoloads-in-directory): Rename to...
(guix-emacs-find-autoloads): ... this.
(guix-emacs-load-autoloads): Remove. 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.
* doc/emacs.texi (Emacs Initial Setup): Adjust accordingly.
"guix-emacs.el" may be used just for "instructing" Emacs where to find
Emacs packages installed with Guix, so it should have as few
dependencies as possible.
See <http://lists.gnu.org/archive/html/guix-devel/2016-01/msg00022.html>.
* emacs/guix-emacs.el: Require 'guix-profiles' optionally.
(guix-emacs-load-autoloads): Use 'guix-profile-prompt' only if it is
available.
* emacs/guix-emacs.el (guix-emacs-autoloads-regexp): New variable.
(guix-emacs-find-autoloads-in-directory): Return a list of autoloads
without extensions.
* emacs/guix-emacs.el (guix-emacs-load-autoloads): Use 'profile'
as an optional argument.
(guix-emacs-load-autoloads-maybe): Adjust accordingly.
* emacs/guix-init.el: Likewise.
This is a followup to commit 7741139080.
* emacs/guix-emacs.el (guix-emacs-find-autoloads): Fix variable
reference to 'elisp-root-dir'.
Signed-off-by: Alex Kost <alezost@gmail.com>
Co-authored-by: Federico Beffa <beffa@fbengineering.ch>.
* emacs/guix-emacs.el (guix-emacs-find-autoloads-in-directory,
guix-emacs-subdirs): New functions.
(guix-emacs-find-autoloads): Search for autoloads in "guix.d"
subdirectories.
(guix-emacs-load-autoloads): Add subdirectories to 'load-path'.
* emacs/guix-init.el.in: Do not add guix emacs directory to 'load-path'
because it will be done by 'guix-emacs-load-autoloads'. Move
requiring 'guix-emacs' from the top-level to a clause for checking for
'guix-package-enable-at-startup'.