diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2021-12-05 19:17:41 +0100 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2021-12-05 19:17:41 +0100 |
commit | 9bc0f45df5d6aed217020b1183dca54989844fb0 (patch) | |
tree | d927e89949ff7f65b5059bc94273c53fd43d0763 /gnu/packages/aux-files/emacs | |
parent | 6db3c536e89deb8a204e756f427614925a7d2582 (diff) | |
parent | 10554e0a57feeea470127a1d0441957d1776b0bd (diff) | |
download | guix-patches-9bc0f45df5d6aed217020b1183dca54989844fb0.tar guix-patches-9bc0f45df5d6aed217020b1183dca54989844fb0.tar.gz |
Merge remote-tracking branch 'origin/master' into core-updates-frozen
Diffstat (limited to 'gnu/packages/aux-files/emacs')
-rw-r--r-- | gnu/packages/aux-files/emacs/guix-emacs.el | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el b/gnu/packages/aux-files/emacs/guix-emacs.el index ca9146c535..eff44bfe90 100644 --- a/gnu/packages/aux-files/emacs/guix-emacs.el +++ b/gnu/packages/aux-files/emacs/guix-emacs.el @@ -26,6 +26,7 @@ ;;; Code: (require 'seq) +(declare-function package-load-descriptor "package" (pkg-dir)) (defvar guix-emacs-autoloads-regexp (rx (* any) "-autoloads.el" (zero-or-one "c") string-end) @@ -39,6 +40,12 @@ The files in the list do not have extensions (.el, .elc)." (directory-files directory 'full-name guix-emacs-autoloads-regexp)))) +(defun guix-emacs--non-core-load-path () + ;; Filter out core Elisp directories, which are already handled by Emacs. + (seq-filter (lambda (dir) + (string-match-p "/share/emacs/site-lisp" dir)) + load-path)) + ;;;###autoload (defun guix-emacs-autoload-packages () "Autoload Emacs packages found in EMACSLOADPATH. @@ -46,18 +53,29 @@ The files in the list do not have extensions (.el, .elc)." 'Autoload' means to load the 'autoloads' files matching `guix-emacs-autoloads-regexp'." (interactive) - (let* ((emacs-non-core-load-path-directories - ;; Filter out core Elisp directories, which are already autoloaded - ;; by Emacs. - (seq-filter (lambda (dir) - (string-match-p "/share/emacs/site-lisp" dir)) - load-path)) - (autoloads (mapcan #'guix-emacs-find-autoloads - emacs-non-core-load-path-directories))) + (let ((autoloads (mapcan #'guix-emacs-find-autoloads + (guix-emacs--non-core-load-path)))) (mapc (lambda (f) (load f 'noerror)) autoloads))) +;;;###autoload +(defun guix-emacs-load-package-descriptors () + "Load descriptors for packages found in EMACSLOADPATH via subdirs.el." + (dolist (dir (guix-emacs--non-core-load-path)) + (let ((subdirs-file (expand-file-name "subdirs.el" dir))) + (when (file-exists-p subdirs-file) + (with-temp-buffer + (insert-file-contents subdirs-file) + (goto-char (point-min)) + (let ((subdirs (read (current-buffer)))) + (and (equal (car-safe subdirs) 'normal-top-level-add-to-load-path) + (equal (car-safe (cadr subdirs)) 'list) + (dolist (subdir (cdadr subdirs)) + (let ((pkg-dir (expand-file-name subdir dir))) + (when (file-directory-p pkg-dir) + (package-load-descriptor pkg-dir))))))))))) + (provide 'guix-emacs) ;;; guix-emacs.el ends here |