emacs-build-system: Ensure the core libraries appear last in the load path.

Fixes bug #38568 (see: https://bugs.gnu.org/38568).

* guix/build/emacs-build-system.scm (add-source-to-load-path): Ensure the core
libraries appear last in the load path.

Reported-by: Jelle Licht <jlicht@fsfe.org>
This commit is contained in:
Maxim Cournoyer 2019-12-13 10:33:42 +09:00
parent d057c52f95
commit e34e02707d
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -76,8 +76,18 @@ (define* (unpack #:key source #:allow-other-keys)
(define* (add-source-to-load-path #:key dummy #:allow-other-keys)
"Augment the EMACSLOADPATH environment variable with the source directory."
(let* ((source-directory (getcwd))
(emacs-load-path-value (string-append source-directory ":"
(getenv "EMACSLOADPATH"))))
(emacs-load-path (string-split (getenv "EMACSLOADPATH") #\:))
;; XXX: Make sure the Emacs core libraries appear at the end of
;; EMACSLOADPATH, to avoid shadowing any other libraries depended
;; upon.
(emacs-load-path-non-core (filter (cut string-contains <>
"/share/emacs/site-lisp")
emacs-load-path))
(emacs-load-path-value (string-append
(string-join (cons source-directory
emacs-load-path-non-core)
":")
":")))
(setenv "EMACSLOADPATH" emacs-load-path-value)
(format #t "source directory ~s prepended to the `EMACSLOADPATH' \
environment variable\n" source-directory)))