From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 65575@debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>,
Andrew Tropin <andrew@trop.in>,
Katherine Cox-Buday <cox.katherine.e+guix@gmail.com>,
Liliana Marie Prikler <liliana.prikler@gmail.com>
Subject: bug#65575: [PATCH 2/3] gnu: emacs: Factorize a 'guix-emacs--subdirs-files' procedure.
Date: Mon, 28 Aug 2023 01:11:33 -0400 [thread overview]
Message-ID: <633948875c3119ecb741940aa54ead7d1896b893.1693199493.git.maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <6715bc07d825d632140c63bd98c959d31cc5de47.1693199493.git.maxim.cournoyer@gmail.com>
* gnu/packages/aux-files/emacs/guix-emacs.el
(guix-emacs--subdirs-files): New procedure.
(guix-emacs-load-package-descriptors): Use it.
---
gnu/packages/aux-files/emacs/guix-emacs.el | 33 +++++++++++++---------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el b/gnu/packages/aux-files/emacs/guix-emacs.el
index c98e7fe369..ed0c913163 100644
--- a/gnu/packages/aux-files/emacs/guix-emacs.el
+++ b/gnu/packages/aux-files/emacs/guix-emacs.el
@@ -3,7 +3,7 @@
;; Copyright © 2014, 2015, 2016, 2017 Alex Kost <alezost@gmail.com>
;; Copyright © 2017 Kyle Meyer <kyle@kyleam.com>
-;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;; Copyright © 2019, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;; This file is part of GNU Guix.
@@ -47,6 +47,13 @@ The files in the list do not have extensions (.el, .elc)."
(string-match-p "/share/emacs/site-lisp" dir))
load-path))
+(defun guix-emacs--subdirs-files ()
+ "Return the Guix subdirs.el files found on the (non-core) load path."
+ (seq-filter #'file-exists-p
+ (mapcar (lambda (dir)
+ (expand-file-name "subdirs.el" dir))
+ (guix-emacs--non-core-load-path))))
+
;;;###autoload
(defun guix-emacs-autoload-packages ()
"Autoload Emacs packages found in EMACSLOADPATH.
@@ -63,19 +70,17 @@ The files in the list do not have extensions (.el, .elc)."
;;;###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)))))))))))
+ (dolist (subdirs-file (guix-emacs--subdirs-files))
+ (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)))))))))
;; If emacs built with tree-sitter, read the value of the environment variable
;; to make tree-sitter grammars available in emacs out-of-the-box.
--
2.41.0
next prev parent reply other threads:[~2023-08-28 5:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-28 4:50 bug#65575: guix-emacs-autoload-packages does not autoreload newly installed packages Maxim Cournoyer
2023-08-28 5:07 ` bug#65575: [PATCH 1/3] gnu: emacs: Use lexical binding for guix-emacs.el startup library Maxim Cournoyer
2023-08-28 5:11 ` Maxim Cournoyer
2023-08-28 5:11 ` Maxim Cournoyer [this message]
2023-08-28 5:11 ` bug#65575: [PATCH 3/3] gnu: emacs: Reload subdirs.el files in 'guix-emacs-autoload-packages' Maxim Cournoyer
2023-08-28 6:16 ` Liliana Marie Prikler
2023-08-28 15:20 ` Maxim Cournoyer
2023-08-29 20:07 ` Liliana Marie Prikler
2023-08-28 15:16 ` bug#65575: [PATCH v2 1/4] gnu: emacs: Use lexical binding for guix-emacs.el startup library Maxim Cournoyer
2023-08-28 15:16 ` bug#65575: [PATCH v2 2/4] gnu: emacs: Factorize a 'guix-emacs--subdirs-files' procedure Maxim Cournoyer
2023-08-28 15:16 ` bug#65575: [PATCH v2 3/4] gnu: emacs: Allow producing verbose messages when loading autoloads Maxim Cournoyer
2023-08-28 15:16 ` bug#65575: [PATCH v2 4/4] gnu: emacs: Reload subdirs.el files in 'guix-emacs-autoload-packages' Maxim Cournoyer
2023-08-28 16:55 ` Liliana Marie Prikler
2023-09-01 4:53 ` bug#65575: [PATCH v3 1/4] gnu: emacs: Use lexical binding for guix-emacs.el startup library Maxim Cournoyer
2023-09-01 4:53 ` bug#65575: [PATCH v3 2/4] gnu: emacs: Factorize a 'guix-emacs--subdirs-files' procedure Maxim Cournoyer
2023-09-01 4:53 ` bug#65575: [PATCH v3 3/4] gnu: emacs: Allow producing verbose messages when loading autoloads Maxim Cournoyer
2023-09-01 4:53 ` bug#65575: [PATCH v3 4/4] gnu: emacs: Reload subdirs.el files in 'guix-emacs-autoload-packages' Maxim Cournoyer
2023-09-02 4:49 ` Liliana Marie Prikler
2023-09-03 14:51 ` Maxim Cournoyer
2023-09-03 19:59 ` Liliana Marie Prikler
2023-09-09 8:20 ` Liliana Marie Prikler
2023-09-09 13:04 ` Maxim Cournoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=633948875c3119ecb741940aa54ead7d1896b893.1693199493.git.maxim.cournoyer@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=65575@debbugs.gnu.org \
--cc=andrew@trop.in \
--cc=cox.katherine.e+guix@gmail.com \
--cc=liliana.prikler@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.