emacs: 'guix-emacs-load-autoloads' takes a profile.
* 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 commit is contained in:
parent
c67e344f21
commit
a65f007524
|
@ -74,29 +74,33 @@ Return nil if there are no emacs packages installed in PROFILE."
|
||||||
nil)))
|
nil)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun guix-emacs-load-autoloads (&optional all)
|
(defun guix-emacs-load-autoloads (&optional profile)
|
||||||
"Load autoloads for Emacs packages installed in a user profile.
|
"Load autoloads for Emacs packages installed in PROFILE.
|
||||||
Add autoloads directories to `load-path'.
|
If PROFILE is nil, use `guix-user-profile'.
|
||||||
If ALL is nil, activate only those packages that were installed
|
Add autoloads directories to `load-path'."
|
||||||
after the last activation, otherwise activate all Emacs packages
|
(interactive (list (guix-profile-prompt)))
|
||||||
installed in `guix-user-profile'."
|
(let* ((autoloads (guix-emacs-find-autoloads profile))
|
||||||
(interactive "P")
|
(new-autoloads (cl-nset-difference autoloads
|
||||||
(let* ((autoloads (guix-emacs-find-autoloads))
|
guix-emacs-autoloads
|
||||||
(files (if all
|
:test #'string=)))
|
||||||
autoloads
|
(dolist (file new-autoloads)
|
||||||
(cl-nset-difference autoloads guix-emacs-autoloads
|
(cl-pushnew (directory-file-name (file-name-directory file))
|
||||||
:test #'string=))))
|
load-path
|
||||||
(dolist (file files)
|
|
||||||
(cl-pushnew (file-name-directory file) load-path
|
|
||||||
:test #'string=)
|
:test #'string=)
|
||||||
(load file 'noerror))
|
(load file 'noerror))
|
||||||
(setq guix-emacs-autoloads autoloads)))
|
(setq guix-emacs-autoloads
|
||||||
|
(append new-autoloads guix-emacs-autoloads))))
|
||||||
|
|
||||||
(defun guix-emacs-load-autoloads-maybe ()
|
(defun guix-emacs-load-autoloads-maybe ()
|
||||||
"Load autoloads for Emacs packages if needed.
|
"Load autoloads for Emacs packages if needed.
|
||||||
See `guix-emacs-activate-after-operation' for details."
|
See `guix-emacs-activate-after-operation' for details."
|
||||||
(and guix-emacs-activate-after-operation
|
(and guix-emacs-activate-after-operation
|
||||||
(guix-emacs-load-autoloads)))
|
;; 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-load-autoloads guix-current-profile)))
|
||||||
|
|
||||||
(provide 'guix-emacs)
|
(provide 'guix-emacs)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ avoid loading autoloads of Emacs packages installed in
|
||||||
(add-to-list 'load-path (guix-emacs-directory))
|
(add-to-list 'load-path (guix-emacs-directory))
|
||||||
|
|
||||||
(when guix-package-enable-at-startup
|
(when guix-package-enable-at-startup
|
||||||
(guix-emacs-load-autoloads 'all))
|
(guix-emacs-load-autoloads))
|
||||||
|
|
||||||
(add-hook 'scheme-mode-hook 'guix-devel-activate-mode-maybe)
|
(add-hook 'scheme-mode-hook 'guix-devel-activate-mode-maybe)
|
||||||
(add-hook 'shell-mode-hook 'guix-build-log-minor-mode-activate-maybe)
|
(add-hook 'shell-mode-hook 'guix-build-log-minor-mode-activate-maybe)
|
||||||
|
|
Loading…
Reference in New Issue