gnu: emacs: Add coreutils and gzip to PATH.

Some parts of Emacs (dired, compression handling, Tramp) shell out to commands
and patching them all is a daunting task.  Also, w.r.t. Tramp, we need those
commands to be portable across multiple machines, which need not only be Guix
machines (and even if they are, store items can be different).  This patch
ensures a ‘sane’ setup FSVO ‘sane’.

* gnu/packages/emacs.scm (emacs)[wrap-load-path]: Rename to...
[wrap-emacs-paths] ... this.  Also patch PATH.
This commit is contained in:
Leo Prikler 2021-04-17 19:06:18 +02:00
parent 307a2d2e2a
commit d13b46fae4
No known key found for this signature in database
GPG Key ID: 442A84B8C70E2F87

View File

@ -201,8 +201,8 @@
(car (find-files "bin" "^emacs-([0-9]+\\.)+[0-9]+$")) (car (find-files "bin" "^emacs-([0-9]+\\.)+[0-9]+$"))
"bin/emacs") "bin/emacs")
#t))) #t)))
(add-after 'strip-double-wrap 'wrap-load-path (add-after 'strip-double-wrap 'wrap-emacs-paths
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(lisp-dirs (find-files (string-append out "/share/emacs") (lisp-dirs (find-files (string-append out "/share/emacs")
"^lisp$" "^lisp$"
@ -210,6 +210,13 @@
(for-each (for-each
(lambda (prog) (lambda (prog)
(wrap-program prog (wrap-program prog
;; emacs-next and variants rely on uname being in PATH for
;; Tramp. Tramp paths can't be hardcoded, because they
;; need to be portable.
`("PATH" suffix
,(map (lambda (in) (string-append in "/bin"))
(list (assoc-ref inputs "gzip")
(assoc-ref inputs "coreutils"))))
`("EMACSLOADPATH" suffix ,lisp-dirs))) `("EMACSLOADPATH" suffix ,lisp-dirs)))
(find-files (string-append out "/bin") (find-files (string-append out "/bin")
;; Matches versioned and unversioned emacs binaries. ;; Matches versioned and unversioned emacs binaries.
@ -231,6 +238,10 @@
`(("gnutls" ,gnutls) `(("gnutls" ,gnutls)
("ncurses" ,ncurses) ("ncurses" ,ncurses)
;; Required for "core" functionality, such as dired and compression.
("coreutils" ,coreutils)
("gzip" ,gzip)
;; Avoid Emacs's limited movemail substitute that retrieves POP3 email ;; Avoid Emacs's limited movemail substitute that retrieves POP3 email
;; only via insecure channels. This is not needed for (modern) IMAP. ;; only via insecure channels. This is not needed for (modern) IMAP.
("mailutils" ,mailutils) ("mailutils" ,mailutils)
@ -361,7 +372,9 @@ also enabled and works without glitches even on X server."))))
(delete 'strip-double-wrap))))) (delete 'strip-double-wrap)))))
(inputs (inputs
`(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el")) `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el"))
("ncurses" ,ncurses))) ("ncurses" ,ncurses)
("coreutils" ,coreutils)
("gzip" ,gzip)))
(native-inputs (native-inputs
`(("pkg-config" ,pkg-config))))) `(("pkg-config" ,pkg-config)))))