From 09fcd178c65aae3d094ef61bca4af4e0e8439adc Mon Sep 17 00:00:00 2001 From: Morgan Smith Date: Mon, 8 Jun 2026 21:23:40 -0400 Subject: gnu: Emacs: Use a simpler method to reduce closure size. Before and after this change, the closure size of emacs-minimal is 284.0 MiB. Removing the patches without adjusting RUN_TEMACS raises the closure size to 830.1 MiB. * gnu/packages/patches/emacs-exec-path.patch: Delete file * gnu/packages/patches/emacs-next-exec-path.patch: Delete file * gnu/local.mk (dist_patch_DATA): Unregister patches. * gnu/packages/emacs.scm (emacs-minimal): [source]: Don't use the patch. [arguments]<#:make-flags>: Use "env -i" to clean the environment. (emacs-next-minimal): Adjust accordingly. Signed-off-by: Liliana Marie Prikler --- gnu/local.mk | 2 -- gnu/packages/emacs.scm | 6 +++--- gnu/packages/patches/emacs-exec-path.patch | 18 ------------------ gnu/packages/patches/emacs-next-exec-path.patch | 18 ------------------ 4 files changed, 3 insertions(+), 41 deletions(-) delete mode 100644 gnu/packages/patches/emacs-exec-path.patch delete mode 100644 gnu/packages/patches/emacs-next-exec-path.patch diff --git a/gnu/local.mk b/gnu/local.mk index 903bcdcf0b8..14a7854ed53 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1256,7 +1256,6 @@ dist_patch_DATA = \ %D%/packages/patches/emacs-disable-jit-compilation.patch \ %D%/packages/patches/emacs-doc-toc-shell-commands.patch \ %D%/packages/patches/emacs-elisp-autofmt-fix-region-send.patch \ - %D%/packages/patches/emacs-exec-path.patch \ %D%/packages/patches/emacs-fix-scheme-indent-function.patch \ %D%/packages/patches/emacs-gnus-alias-reference-signature.patch \ %D%/packages/patches/emacs-helpful-fix-signature.patch \ @@ -1269,7 +1268,6 @@ dist_patch_DATA = \ %D%/packages/patches/emacs-native-comp-fix-filenames.patch \ %D%/packages/patches/emacs-native-comp-pin-packages.patch \ %D%/packages/patches/emacs-next-disable-jit-compilation.patch \ - %D%/packages/patches/emacs-next-exec-path.patch \ %D%/packages/patches/emacs-next-native-comp-fix-filenames.patch \ %D%/packages/patches/emacs-pasp-mode-quote-file-names.patch \ %D%/packages/patches/emacs-polymode-fix-lexical-variable-error.patch \ diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 0a8a76aaaa7..7f36745ff51 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -221,7 +221,6 @@ (base32 "1nggbgnns7lvxn68gzlcsgwh3bigvrbn45kh6dqia9yxlqc6zwxk")) (patches (search-patches "emacs-disable-jit-compilation.patch" - "emacs-exec-path.patch" "emacs-fix-scheme-indent-function.patch" "emacs-native-comp-driver-options.patch" "emacs-native-comp-fix-filenames.patch" @@ -249,7 +248,9 @@ (string-append "RUN_TEMACS= " #$(this-package-native-input "libfaketime") "/bin/faketime -m -f '" release-date "'" - " ./temacs"))) + ;; Reduce closure size by cleaning the + ;; environment of the emacs dumper + " env -i ./temacs"))) #:parallel-build? #f #:phases #~(modify-phases %standard-phases @@ -732,7 +733,6 @@ editor (with wide ints)" ) (base32 "111cxlhdpxyvyj2mhqcx0s5s2nkdr3q2vhly1csq5d44p24c4yyy")) (patches (search-patches "emacs-next-disable-jit-compilation.patch" - "emacs-next-exec-path.patch" "emacs-fix-scheme-indent-function.patch" "emacs-native-comp-driver-options.patch" "emacs-next-native-comp-fix-filenames.patch" diff --git a/gnu/packages/patches/emacs-exec-path.patch b/gnu/packages/patches/emacs-exec-path.patch deleted file mode 100644 index 6e33e252589..00000000000 --- a/gnu/packages/patches/emacs-exec-path.patch +++ /dev/null @@ -1,18 +0,0 @@ -Do not capture the build-time value of $PATH in the 'emacs' executable -since this can noticeably increase the size of the closure of Emacs -with things like GCC being referenced. - -Index: emacs-next/lisp/loadup.el -=================================================================== ---- emacs-next.orig/lisp/loadup.el -+++ emacs-next/lisp/loadup.el -@@ -599,7 +599,8 @@ lost after dumping"))) - ((equal dump-mode "dump") "emacs") - ((equal dump-mode "bootstrap") "emacs") - ((equal dump-mode "pbootstrap") "bootstrap-emacs.pdmp") -- (t (error "Unrecognized dump mode %s" dump-mode))))) -+ (t (error "Unrecognized dump mode %s" dump-mode)))) -+ (exec-path nil)) - (when (and (featurep 'native-compile) - (equal dump-mode "pdump")) - ;; Don't enable this before bootstrap is completed, as the diff --git a/gnu/packages/patches/emacs-next-exec-path.patch b/gnu/packages/patches/emacs-next-exec-path.patch deleted file mode 100644 index 54091af2627..00000000000 --- a/gnu/packages/patches/emacs-next-exec-path.patch +++ /dev/null @@ -1,18 +0,0 @@ -Do not capture the build-time value of $PATH in the 'emacs' executable -since this can noticeably increase the size of the closure of Emacs -with things like GCC being referenced. - -Index: emacs/lisp/loadup.el -=================================================================== ---- emacs.orig/lisp/loadup.el -+++ emacs/lisp/loadup.el -@@ -603,7 +603,8 @@ directory got moved. This is set to be - (if (eq system-type 'ms-dos) - "b-emacs.pdmp" - "bootstrap-emacs.pdmp")) -- (t (error "Unrecognized dump mode %s" dump-mode))))) -+ (t (error "Unrecognized dump mode %s" dump-mode)))) -+ (exec-path nil)) - (when (and (featurep 'native-compile) - (equal dump-mode "pdump")) - ;; Don't enable this before bootstrap is completed, as the -- cgit v1.2.3