From 307a2d2e2a833c2e1f7a79f46e4c6945c618cd8c Mon Sep 17 00:00:00 2001 From: Leo Prikler Date: Sat, 17 Apr 2021 19:06:17 +0200 Subject: gnu: emacs: Wrap EMACSLOADPATH. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With this, the search path specification of EMACSLOADPATH does no longer depend on the version of Emacs, which should make upgrading major versions less painful. See also: - - * gnu/packages/emacs.scm (emacs)[#:phases]: Add ‘wrap-load-path’. [native-search-path]: Do not search for builtin libraries. (emacs-next)[native-search-path]: Inherit from emacs. --- gnu/packages/emacs.scm | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'gnu/packages/emacs.scm') diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 7447cfe33a..e1b01ac22b 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -201,6 +201,24 @@ (car (find-files "bin" "^emacs-([0-9]+\\.)+[0-9]+$")) "bin/emacs") #t))) + (add-after 'strip-double-wrap 'wrap-load-path + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (lisp-dirs (find-files (string-append out "/share/emacs") + "^lisp$" + #:directories? #t))) + (for-each + (lambda (prog) + (wrap-program prog + `("EMACSLOADPATH" suffix ,lisp-dirs))) + (find-files (string-append out "/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]+)*)?$")) + #t))) (add-before 'reset-gzip-timestamps 'make-compressed-files-writable ;; The 'reset-gzip-timestamps phase will throw a permission error ;; if gzip files aren't writable then. This phase is needed when @@ -255,9 +273,7 @@ (native-search-paths (list (search-path-specification (variable "EMACSLOADPATH") - ;; The versioned entry is for the Emacs' builtin libraries. - (files (list "share/emacs/site-lisp" - (string-append "share/emacs/" version "/lisp")))) + (files '("share/emacs/site-lisp"))) (search-path-specification (variable "INFOPATH") (files '("share/info"))))) @@ -294,18 +310,7 @@ languages.") "0igjm9kwiswn2dpiy2k9xikbdfc7njs07ry48fqz70anljj8y7y3")))) (native-inputs `(("autoconf" ,autoconf) - ,@(package-native-inputs emacs))) - (native-search-paths - (list (search-path-specification - (variable "EMACSLOADPATH") - ;; The versioned entry is for the Emacs' builtin libraries. - (files (list "share/emacs/site-lisp" - (string-append "share/emacs/" - (version-major+minor+point version) - "/lisp")))) - (search-path-specification - (variable "INFOPATH") - (files '("share/info")))))))) + ,@(package-native-inputs emacs)))))) (define-public emacs-next-pgtk (let ((commit "ae18c8ec4f0ef37c8c9cda473770ff47e41291e2") -- cgit 1.4.1 From d13b46fae46fe0e0d529e67ffc7f4074440d1b6e Mon Sep 17 00:00:00 2001 From: Leo Prikler Date: Sat, 17 Apr 2021 19:06:18 +0200 Subject: gnu: emacs: Add coreutils and gzip to PATH. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- gnu/packages/emacs.scm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'gnu/packages/emacs.scm') diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index e1b01ac22b..5316d25151 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -201,8 +201,8 @@ (car (find-files "bin" "^emacs-([0-9]+\\.)+[0-9]+$")) "bin/emacs") #t))) - (add-after 'strip-double-wrap 'wrap-load-path - (lambda* (#:key outputs #:allow-other-keys) + (add-after 'strip-double-wrap 'wrap-emacs-paths + (lambda* (#:key inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (lisp-dirs (find-files (string-append out "/share/emacs") "^lisp$" @@ -210,6 +210,13 @@ (for-each (lambda (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))) (find-files (string-append out "/bin") ;; Matches versioned and unversioned emacs binaries. @@ -231,6 +238,10 @@ `(("gnutls" ,gnutls) ("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 ;; only via insecure channels. This is not needed for (modern) IMAP. ("mailutils" ,mailutils) @@ -361,7 +372,9 @@ also enabled and works without glitches even on X server.")))) (delete 'strip-double-wrap))))) (inputs `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el")) - ("ncurses" ,ncurses))) + ("ncurses" ,ncurses) + ("coreutils" ,coreutils) + ("gzip" ,gzip))) (native-inputs `(("pkg-config" ,pkg-config))))) -- cgit 1.4.1