From: Alex Kost <alezost@gmail.com>
To: Federico Beffa <beffa@ieee.org>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: emacs packages
Date: Fri, 19 Jun 2015 12:56:03 +0300 [thread overview]
Message-ID: <87si9oqax8.fsf@gmail.com> (raw)
In-Reply-To: <CAKrPhPNg2qtQXqsb_A31i-+Xp=3Zdh0Q_n5gNY2OcxppwHnTww@mail.gmail.com> (Federico Beffa's message of "Thu, 18 Jun 2015 20:32:43 +0200")
[-- Attachment #1: Type: text/plain, Size: 888 bytes --]
Federico Beffa (2015-06-18 21:32 +0300) wrote:
> On Wed, Jun 17, 2015 at 8:21 PM, Alex Kost <alezost@gmail.com> wrote:
>> The code for loading "…-autoloads.el" files is placed in
>> "guix-emacs.el", so perhaps it would be enough to adjust:
>>
>> - 'guix-emacs-find-autoloads' to make it look at subdirs;
>>
>> - 'guix-emacs-load-autoloads' to add the subdir to 'load-path' before
>> loading "…-autoloads.el".
>
> If you feel like wanting to adapt it yourself, please go on. I have no
> experience with elisp apart from trivial things in my ./emacs. file.
>
> Otherwise, I will look into it.
Thanks, I would like to adapt it myself. I think the attached patch
should be enough to make the packages installed in
"~/.guix-profile/share/emacs/site-lisp/guix.d" be properly autoloaded.
I'll push this commit into "wip-emacs" when it appears, if you don't
mind.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-emacs-Find-autoloads-in-guix.d-subdirectories.patch --]
[-- Type: text/x-diff, Size: 3138 bytes --]
From 7110d5d4a795f91259af37b48a2909ad9451a42d Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Fri, 19 Jun 2015 12:31:59 +0300
Subject: [PATCH] emacs: Find autoloads in "guix.d" subdirectories.
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-emacs.el | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/emacs/guix-emacs.el b/emacs/guix-emacs.el
index 512a2e2..8be2f36 100644
--- a/emacs/guix-emacs.el
+++ b/emacs/guix-emacs.el
@@ -42,13 +42,33 @@ If PROFILE is nil, use `guix-user-profile'."
(expand-file-name "share/emacs/site-lisp"
(or profile guix-user-profile)))
+(defun guix-emacs-find-autoloads-in-directory (directory)
+ "Return list of Emacs 'autoloads' files in DIRECTORY."
+ (directory-files directory 'full-name "-autoloads\\.el\\'" 'no-sort))
+
+(defun guix-emacs-subdirs (directory)
+ "Return list of DIRECTORY subdirectories."
+ (cl-remove-if (lambda (file)
+ (or (string-match-p (rx "/." string-end) file)
+ (string-match-p (rx "/.." string-end) file)
+ (not (file-directory-p file))))
+ (directory-files directory 'full-name nil 'no-sort)))
+
(defun guix-emacs-find-autoloads (&optional profile)
"Return list of autoloads of Emacs packages installed in PROFILE.
If PROFILE is nil, use `guix-user-profile'.
Return nil if there are no emacs packages installed in PROFILE."
- (let ((dir (guix-emacs-directory profile)))
- (if (file-directory-p dir)
- (directory-files dir 'full-name "-autoloads\\.el\\'")
+ (let ((elisp-root-dir (guix-emacs-directory profile)))
+ (if (file-directory-p elisp-root-dir)
+ (let ((elisp-pkgs-dir (expand-file-name "guix.d" elisp-root-dir))
+ (root-autoloads (guix-emacs-find-autoloads-in-directory
+ elisp-root-dir)))
+ (if (file-directory-p elisp-pkgs-dir)
+ (let ((pkgs-autoloads
+ (cl-mapcan #'guix-emacs-find-autoloads-in-directory
+ (guix-emacs-subdirs elisp-pkgs-dir))))
+ (append root-autoloads pkgs-autoloads))
+ root-autoloads))
(message "Directory '%s' does not exist." dir)
nil)))
@@ -63,7 +83,10 @@ installed in `guix-user-profile'."
(files (if all
autoloads
(cl-nset-difference autoloads guix-emacs-autoloads
- :test #'string=))))
+ :test #'string=)))
+ (dirs (mapcar #'file-name-directory files))
+ (dirs (cl-remove-duplicates dirs :test #'string=)))
+ (setq load-path (append dirs load-path))
(dolist (file files)
(load file 'noerror))
(setq guix-emacs-autoloads autoloads)))
--
2.4.2
next prev parent reply other threads:[~2015-06-19 9:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-15 10:20 emacs packages Federico Beffa
2015-06-15 10:45 ` Mathieu Lirzin
2015-06-16 16:00 ` Ludovic Courtès
2015-06-16 16:21 ` Pjotr Prins
2015-06-17 7:42 ` Federico Beffa
2015-06-17 18:21 ` Alex Kost
2015-06-18 18:32 ` Federico Beffa
2015-06-19 9:56 ` Alex Kost [this message]
2015-06-19 12:13 ` Ludovic Courtès
2015-06-19 16:06 ` Federico Beffa
2015-06-21 21:12 ` Ludovic Courtès
2015-06-22 7:30 ` Federico Beffa
2015-06-22 19:43 ` Ludovic Courtès
2015-06-23 6:48 ` Federico Beffa
2015-06-23 12:47 ` Ludovic Courtès
2015-06-16 16:24 ` Mark H Weaver
2015-06-16 19:31 ` Federico Beffa
2015-06-17 18:42 ` Mark H Weaver
2015-06-17 20:00 ` Alex Kost
2015-06-18 18:24 ` Federico Beffa
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=87si9oqax8.fsf@gmail.com \
--to=alezost@gmail.com \
--cc=beffa@ieee.org \
--cc=guix-devel@gnu.org \
/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.