aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorJanneke Nieuwenhuizen <janneke@gnu.org>2024-12-08 15:36:38 +0100
committerJanneke Nieuwenhuizen <janneke@gnu.org>2024-12-08 17:23:27 +0100
commite46bc3d928282c74a7b2d9af6af81972002f0a17 (patch)
treeeb484b201fa797a468fca37f404790aef6cde633 /gnu
parenteafd91c26232f039a3170b73e40b0a2d5983c474 (diff)
downloadguix-e46bc3d928282c74a7b2d9af6af81972002f0a17.tar.gz
guix-e46bc3d928282c74a7b2d9af6af81972002f0a17.zip
gnu: guile-emacs: Support running emacs from the store.
* gnu/packages/emacs.scm (guile-emacs)[argumets]: Replace stage "wrap-emacs-paths" to restrict EMACSLOADPATH. [native-search-paths]: Remove. Change-Id: Ie2c222a53a5bd79b1a8a0b8424a90e6e06b77fb9
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/emacs.scm44
1 files changed, 34 insertions, 10 deletions
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index c32d28b404..8140f61882 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -678,6 +678,39 @@ editor (with wide ints)" )
(delete 'restore-emacs-pdmp)
(delete 'build-trampolines)
(delete 'install-site-start)
+ (replace 'wrap-emacs-paths
+ ;; Restrict EMACSLOADPATH to builtin packages.
+ (lambda _
+ (let ((lisp-dirs (list (string-append
+ #$output "/share/emacs/"
+ #$upstream-version "/lisp")))
+ (inputs '#$(map (match-lambda
+ ((name directory)
+ #~(#$name . #$directory)))
+ (package-inputs this-package))))
+ (for-each
+ (lambda (prog)
+ (wrap-program prog
+ ;; Some variants rely on uname being in PATH for Tramp.
+ ;; Tramp paths can't be hardcoded, because they need to
+ ;; be portable.
+ `("PATH" suffix
+ ,(map dirname
+ (list (search-input-file inputs "/bin/gzip")
+ ;; for coreutils
+ (search-input-file inputs "/bin/yes"))))
+ ;; We use "=" because loading non-builtin packages is
+ ;; currently not supported and prevents guile-emacs
+ ;; from running.
+ `("EMACSLOADPATH" = ,lisp-dirs)))
+ (find-files
+ (string-append #$output "/bin")
+ ;; Matches versioned and unversioned emacs binaries.
+ ;; We don't patch emacsclient, because it takes its
+ ;; environment variables from emacs.
+ ;; Likewise, we don't need to patch helper binaries
+ ;; like etags, ctags or ebrowse.
+ "^emacs(-[0-9]+(\\.[0-9]+)*)?$")))))
(add-after 'unpack 'help-patch-progam-file-names
(lambda _
(call-with-output-file "lisp/obsolete/terminal.el"
@@ -685,16 +718,7 @@ editor (with wide ints)" )
(add-after 'configure 'touch-lisp/finder-inf.el
(lambda _
(call-with-output-file "lisp/finder-inf.el"
- (lambda (port) (display port)))))))))
- (native-search-paths
- (list (search-path-specification
- ;;guile-emacs needs this non-standard load-path for now
- (variable "EMACSLOADPATH")
- (files
- (list (string-append "share/emacs/" upstream-version "/lisp"))))
- (search-path-specification
- (variable "INFOPATH")
- (files '("share/info"))))))))
+ (lambda (port) (display port))))))))))))
(define-public m17n-db
(package