emacs: Search subdirectories of site-lisp
in NIX_PROFILES
This adds subdirectories of `share/emacs/site-lisp/` in every path in `NIX_PROFILES` to `load-path` to allow loading of more complex libraries like `mu4e`. Fixes #33412
This commit is contained in:
parent
1543c8cc01
commit
7cfdb2b1b5
@ -5,11 +5,22 @@ least specific (the system profile)"
|
|||||||
(reverse (split-string (or (getenv "NIX_PROFILES") ""))))
|
(reverse (split-string (or (getenv "NIX_PROFILES") ""))))
|
||||||
|
|
||||||
;;; Extend `load-path' to search for elisp files in subdirectories of
|
;;; Extend `load-path' to search for elisp files in subdirectories of
|
||||||
;;; all folders in `NIX_PROFILES'
|
;;; all folders in `NIX_PROFILES'. Also search for one level of
|
||||||
(setq load-path
|
;;; subdirectories in these directories to handle multi-file libraries
|
||||||
(append (mapcar (lambda (x) (concat x "/share/emacs/site-lisp/"))
|
;;; like `mu4e'.'
|
||||||
(nix--profile-paths))
|
(require 'seq)
|
||||||
load-path))
|
(let* ((subdirectory-sites (lambda (site-lisp)
|
||||||
|
(when (file-exists-p site-lisp)
|
||||||
|
(seq-filter (lambda (f) (file-directory-p (file-truename f)))
|
||||||
|
;; Returns all files in `site-lisp', excluding `.' and `..'
|
||||||
|
(directory-files site-lisp 'full "^\\([^.]\\|\\.[^.]\\|\\.\\..\\)")))))
|
||||||
|
(paths (apply #'append
|
||||||
|
(mapcar (lambda (profile-dir)
|
||||||
|
(let ((site-lisp (concat profile-dir "/share/emacs/site-lisp/")))
|
||||||
|
(cons site-lisp (funcall subdirectory-sites site-lisp))))
|
||||||
|
(nix--profile-paths)))))
|
||||||
|
(setq load-path (append paths load-path)))
|
||||||
|
|
||||||
|
|
||||||
;;; Make `woman' find the man pages
|
;;; Make `woman' find the man pages
|
||||||
(eval-after-load 'woman
|
(eval-after-load 'woman
|
||||||
|
Loading…
x
Reference in New Issue
Block a user