From 2f7cc5a7812bd4b4758312051a72b0a618072cd4 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Mon, 23 Sep 2024 16:14:55 +0800 Subject: [PATCH] emacsPackages: respect turnCompilationWarningToError and ignoreCompilationError at bytecompile time Previously, these two attributes were only respected at nativecompile time. --- .../applications/editors/emacs/build-support/elpa2nix.el | 9 +++++++++ .../applications/editors/emacs/build-support/generic.nix | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/editors/emacs/build-support/elpa2nix.el b/pkgs/applications/editors/emacs/build-support/elpa2nix.el index 64587c0fad1a..b0b4ecedc360 100644 --- a/pkgs/applications/editors/emacs/build-support/elpa2nix.el +++ b/pkgs/applications/editors/emacs/build-support/elpa2nix.el @@ -31,3 +31,12 @@ The file can either be a tar file or an Emacs Lisp file." ;; Allow installing package tarfiles larger than 10MB (setq large-file-warning-threshold nil) + +(let ((flag (getenv "turnCompilationWarningToError"))) + (when (and flag + (not (string-empty-p flag))) + (setq byte-compile-error-on-warn t))) + +(let ((flag (getenv "ignoreCompilationError"))) + (when (string-empty-p flag) + (setq byte-compile-debug t))) diff --git a/pkgs/applications/editors/emacs/build-support/generic.nix b/pkgs/applications/editors/emacs/build-support/generic.nix index e91709e9343e..f5b60305fc6b 100644 --- a/pkgs/applications/editors/emacs/build-support/generic.nix +++ b/pkgs/applications/editors/emacs/build-support/generic.nix @@ -64,6 +64,8 @@ libBuildHelper.extendMkDerivation' stdenv.mkDerivation (finalAttrs: setupHook = args.setupHook or setupHook; + inherit turnCompilationWarningToError ignoreCompilationError; + meta = { broken = false; platforms = emacs.meta.platforms; @@ -76,8 +78,6 @@ libBuildHelper.extendMkDerivation' stdenv.mkDerivation (finalAttrs: addEmacsNativeLoadPath = args.addEmacsNativeLoadPath or true; - inherit turnCompilationWarningToError ignoreCompilationError; - postInstall = '' # Besides adding the output directory to the native load path, make sure # the current package's elisp files are in the load path, otherwise