profiles: Add hook for Emacs subdirs.

* guix/profiles.scm (emacs-subdirs): New variable.
(%default-profile-hooks): Add it here.
* guix/status.scm (hook-message): Add a message for emacs-subdirs.
This commit is contained in:
Leo Prikler 2021-04-17 19:06:16 +02:00
parent 45549e9f31
commit 68228d80dd
No known key found for this signature in database
GPG Key ID: 442A84B8C70E2F87
2 changed files with 43 additions and 0 deletions

@ -1115,6 +1115,46 @@ MANIFEST. Single-file bundles are required by programs such as Git and Lynx."
`((type . profile-hook)
(hook . ca-certificate-bundle))))
(define (emacs-subdirs manifest)
(define build
(with-imported-modules (source-module-closure
'((guix build profiles)
(guix build utils)))
#~(begin
(use-modules (guix build utils)
(guix build profiles)
(ice-9 ftw) ; scandir
(srfi srfi-1) ; append-map
(srfi srfi-26))
(let ((destdir (string-append #$output "/share/emacs/site-lisp"))
(subdirs
(append-map
(lambda (dir)
(filter
file-is-directory?
(map (cute string-append dir "/" <>)
(scandir dir (negate (cute member <> '("." "..")))))))
(filter file-exists?
(map (cute string-append <> "/share/emacs/site-lisp")
'#$(manifest-inputs manifest))))))
(mkdir-p destdir)
(with-directory-excursion destdir
(call-with-output-file "subdirs.el"
(lambda (port)
(write
`(normal-top-level-add-to-load-path
(list ,@subdirs))
port)
(newline port)
#t)))))))
(gexp->derivation "emacs-subdirs" build
#:local-build? #t
#:substitutable? #f
#:properties
`((type . profile-hook)
(hook . emacs-subdirs))))
(define (glib-schemas manifest)
"Return a derivation that unions all schemas from manifest entries and
creates the Glib 'gschemas.compiled' file."
@ -1672,6 +1712,7 @@ MANIFEST."
fonts-dir-file
ghc-package-cache-file
ca-certificate-bundle
emacs-subdirs
glib-schemas
gtk-icon-themes
gtk-im-modules

@ -379,6 +379,8 @@ the current build phase."
(G_ "building GHC package cache..."))
('ca-certificate-bundle
(G_ "building CA certificate bundle..."))
('emacs-subdirs
(G_ "listing Emacs subdirs..."))
('glib-schemas
(G_ "generating GLib schema cache..."))
('gtk-icon-themes