aboutsummaryrefslogtreecommitdiff
path: root/emacs/guix-emacs.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-12-03 13:03:19 +0300
committerAlex Kost <alezost@gmail.com>2015-12-11 14:34:03 +0300
commit98f4a9004b1e7ce18de8537799de43bb1a9a1c0b (patch)
treeb9f61a87e8107f90ed92d9b8e2085577d6722fe4 /emacs/guix-emacs.el
parent7534370435e40b11b0b254753d63d2c27cc9a9a5 (diff)
downloadguix-98f4a9004b1e7ce18de8537799de43bb1a9a1c0b.tar
guix-98f4a9004b1e7ce18de8537799de43bb1a9a1c0b.tar.gz
emacs: Handle compiled autoloads.
* emacs/guix-emacs.el (guix-emacs-autoloads-regexp): New variable. (guix-emacs-find-autoloads-in-directory): Return a list of autoloads without extensions.
Diffstat (limited to 'emacs/guix-emacs.el')
-rw-r--r--emacs/guix-emacs.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/emacs/guix-emacs.el b/emacs/guix-emacs.el
index 6515b3dc30..2f809ed16e 100644
--- a/emacs/guix-emacs.el
+++ b/emacs/guix-emacs.el
@@ -37,6 +37,11 @@ they are successfully installed."
(defvar guix-emacs-autoloads nil
"List of the last loaded Emacs autoloads.")
+(defvar guix-emacs-autoloads-regexp
+ (rx (group (* any) "-autoloads")
+ ".el" (zero-or-one "c") string-end)
+ "Regexp to match Emacs 'autoloads' file.")
+
(defun guix-emacs-directory (&optional profile)
"Return directory with Emacs packages installed in PROFILE.
If PROFILE is nil, use `guix-user-profile'."
@@ -44,8 +49,15 @@ If PROFILE is nil, use `guix-user-profile'."
(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))
+ "Return a list of Emacs 'autoloads' files in DIRECTORY.
+The files in the list do not have extensions (.el, .elc)."
+ (cl-remove-duplicates
+ (delq nil
+ (mapcar (lambda (file)
+ (when (string-match guix-emacs-autoloads-regexp file)
+ (match-string 1 file)))
+ (directory-files directory 'full-name nil 'no-sort)))
+ :test #'string=))
(defun guix-emacs-subdirs (directory)
"Return list of DIRECTORY subdirectories."