Toggle quote (111 lines)
> * gnu/packages/patches/emacs-next-native-comp-driver-options.patch: Add file.
> * gnu/packages/patches/emacs-next-exec-path.patch: Add file.
> * gnu/local.mk (dist_patch_DATA): Register them here.
> * gnu/packages/emacs.scm (emacs-next-minimal)[origin](patches): Include the
> same patches as emacs-minimal, save for the variants specific to emacs-next
> introduced above.
>
> Co-Authored-By: Nicolas Graves <ngraves@ngraves.fr>
> Fixes: ‘emacs-next’ is almost unusable <https://bugs.gnu.org/66227>
> ---
> Hi Guix,
>
> this bug was independently discovered in two locations, so I wanted to
> inform both. A fix has already been proposed, but is not yet complete.
> Here's to finally cover everything we need to have an Emacs as expected
> by Guix.
>
> Feel free to bikeshed.
>
> Happy hacking
>
> gnu/local.mk | 2 ++
> gnu/packages/emacs.scm | 7 ++++++-
> .../patches/emacs-next-exec-path.patch | 18 ++++++++++++++++++
> ...emacs-next-native-comp-driver-options.patch | 18 ++++++++++++++++++
> 4 files changed, 44 insertions(+), 1 deletion(-)
> create mode 100644 gnu/packages/patches/emacs-next-exec-path.patch
> create mode 100644 gnu/packages/patches/emacs-next-native-comp-driver-options.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 65d50abc71..43a528e937 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -1110,6 +1110,8 @@ dist_patch_DATA = \
> %D%/packages/patches/emacs-highlight-stages-add-gexp.patch \
> %D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \
> %D%/packages/patches/emacs-native-comp-driver-options.patch \
> + %D%/packages/patches/emacs-next-exec-path.patch \
> + %D%/packages/patches/emacs-next-native-comp-driver-options.patch \
> %D%/packages/patches/emacs-pasp-mode-quote-file-names.patch \
> %D%/packages/patches/emacs-polymode-fix-lexical-variable-error.patch \
> %D%/packages/patches/emacs-telega-path-placeholder.patch \
> diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
> index 72b2c7795e..b9d9e2b891 100644
> --- a/gnu/packages/emacs.scm
> +++ b/gnu/packages/emacs.scm
> @@ -498,7 +498,12 @@ (define-public emacs-next-minimal
> (commit commit)))
> (file-name (git-file-name name version))
> (sha256
> - (base32 "00mwpq1msr3jij281w5piqmbwq968xr8dn9hqbf4r947ck754kn9")))))))
> + (base32 "00mwpq1msr3jij281w5piqmbwq968xr8dn9hqbf4r947ck754kn9"))
> + (patches
> + (search-patches "emacs-next-exec-path.patch"
> + "emacs-fix-scheme-indent-function.patch"
> + "emacs-next-native-comp-driver-options.patch"
> + "emacs-pgtk-super-key-fix.patch")))))))
>
> (define* (emacs->emacs-next emacs #:optional name
> #:key (version (package-version emacs-next-minimal))
> diff --git a/gnu/packages/patches/emacs-next-exec-path.patch b/gnu/packages/patches/emacs-next-exec-path.patch
> new file mode 100644
> index 0000000000..6e33e25258
> --- /dev/null
> +++ b/gnu/packages/patches/emacs-next-exec-path.patch
> @@ -0,0 +1,18 @@
> +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-native-comp-driver-options.patch b/gnu/packages/patches/emacs-next-native-comp-driver-options.patch
> new file mode 100644
> index 0000000000..e4ed5a48f1
> --- /dev/null
> +++ b/gnu/packages/patches/emacs-next-native-comp-driver-options.patch
> @@ -0,0 +1,18 @@
> +We substitute this anyway, so let's make it easier to substitute.
> +
> +--- a/lisp/emacs-lisp/comp.el
> ++++ b/lisp/emacs-lisp/comp.el
> +@@ -203,9 +203,7 @@ and above."
> + :type '(repeat string)
> + :version "28.1")
> +
> +-(defcustom native-comp-driver-options
> +- (cond ((eq system-type 'darwin) '("-Wl,-w"))
> +- ((eq system-type 'cygwin) '("-Wl,-dynamicbase")))
> ++(defcustom native-comp-driver-options nil
> + "Options passed verbatim to the native compiler's back-end driver.
> + Note that not all options are meaningful; typically only the options
> + affecting the assembler and linker are likely to be useful.
> +--
> +2.38.0
> +
>
> base-commit: e863274e67e2242b970845783172c9f4e49405ca