about summary refs log tree commit diff
path: root/overlays
diff options
context:
space:
mode:
authorBrian Leung <leungbk@posteo.net>2023-05-25 04:57:53 -0700
committerBrian Leung <leungbk@posteo.net>2023-05-25 05:13:42 -0700
commit9a691c7088459182b7dd37b7acdb21f805c81a7e (patch)
tree3b15804c3defb5a7840c1046863e744a685e354c /overlays
parent24e553ce39c07dcfdb56375190e1ec92f1df0317 (diff)
downloadnixlib-9a691c7088459182b7dd37b7acdb21f805c81a7e.tar
nixlib-9a691c7088459182b7dd37b7acdb21f805c81a7e.tar.gz
nixlib-9a691c7088459182b7dd37b7acdb21f805c81a7e.tar.bz2
nixlib-9a691c7088459182b7dd37b7acdb21f805c81a7e.tar.lz
nixlib-9a691c7088459182b7dd37b7acdb21f805c81a7e.tar.xz
nixlib-9a691c7088459182b7dd37b7acdb21f805c81a7e.tar.zst
nixlib-9a691c7088459182b7dd37b7acdb21f805c81a7e.zip
Work around #318
Diffstat (limited to 'overlays')
-rw-r--r--overlays/bytecomp-revert.patch30
-rw-r--r--overlays/emacs.nix16
2 files changed, 44 insertions, 2 deletions
diff --git a/overlays/bytecomp-revert.patch b/overlays/bytecomp-revert.patch
new file mode 100644
index 000000000000..eee74107a80d
--- /dev/null
+++ b/overlays/bytecomp-revert.patch
@@ -0,0 +1,30 @@
+diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
+index ac040799a22..42b733b0830 100644
+--- a/lisp/emacs-lisp/bytecomp.el
++++ b/lisp/emacs-lisp/bytecomp.el
+@@ -3521,8 +3521,6 @@ byte-compile-form
+               (setq form (cons 'progn (cdr form)))
+               (setq handler #'byte-compile-progn))
+              ((and (or sef (function-get (car form) 'important-return-value))
+-                   ;; Don't warn for arguments to `ignore'.
+-                   (not (eq byte-compile--for-effect 'for-effect-no-warn))
+                    (byte-compile-warning-enabled-p
+                     'ignored-return-value (car form)))
+               (byte-compile-warn-x
+@@ -4464,8 +4462,11 @@ byte-compile-goto-if
+ 
+ (defun byte-compile-ignore (form)
+   (dolist (arg (cdr form))
+-    ;; Compile each argument for-effect but suppress unused-value warnings.
+-    (byte-compile-form arg 'for-effect-no-warn))
++    ;; Compile args for value (to avoid warnings about unused values),
++    ;; emit a discard after each, and trust the LAP peephole optimiser
++    ;; to annihilate useless ops.
++    (byte-compile-form arg)
++    (byte-compile-discard))
+   (byte-compile-form nil))
+ 
+ ;; Return the list of items in CONDITION-PARAM that match PRED-LIST.
+-- 
+2.40.1
+
diff --git a/overlays/emacs.nix b/overlays/emacs.nix
index e7addc80c354..79353f1776ad 100644
--- a/overlays/emacs.nix
+++ b/overlays/emacs.nix
@@ -141,9 +141,21 @@ let
     tree-sitter-yaml
   ];
 
-  emacsGit = super.lib.makeOverridable (mkGitEmacs "emacs-git" ../repos/emacs/emacs-master.json) { withSQLite3 = true; withWebP = true; treeSitterPlugins = defaultTreeSitterPlugins; };
+  emacsGit = (super.lib.makeOverridable (mkGitEmacs "emacs-git" ../repos/emacs/emacs-master.json) { withSQLite3 = true; withWebP = true; treeSitterPlugins = defaultTreeSitterPlugins; }).overrideAttrs (
+    oa: {
+      patches = oa.patches ++ [
+        # XXX: #318
+        ./bytecomp-revert.patch
+      ]; }
+  );
 
-  emacsPgtk = super.lib.makeOverridable (mkGitEmacs "emacs-pgtk" ../repos/emacs/emacs-master.json) { withSQLite3 = true; withWebP = true; withPgtk = true; treeSitterPlugins = defaultTreeSitterPlugins; };
+  emacsPgtk = (super.lib.makeOverridable (mkGitEmacs "emacs-pgtk" ../repos/emacs/emacs-master.json) { withSQLite3 = true; withWebP = true; withPgtk = true; treeSitterPlugins = defaultTreeSitterPlugins; }).overrideAttrs (
+    oa: {
+      patches = oa.patches ++ [
+        # XXX: #318
+        ./bytecomp-revert.patch
+      ]; }
+  );
 
   emacsUnstable = super.lib.makeOverridable (mkGitEmacs "emacs-unstable" ../repos/emacs/emacs-unstable.json) { withSQLite3 = true; withWebP = true; treeSitterPlugins = defaultTreeSitterPlugins; };