From f3abb1711811f43d1504d8e48f0d27e015b46d6c Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 16 Mar 2021 09:10:31 +0100 Subject: [PATCH 1/2] Have `no-byte-compile' implies also `no-native-compile'. * lisp/emacs-lisp/comp.el (no-native-compile): Update doctring. * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): when `no-byte-compile' is set to non-nil it overrides this. --- lisp/emacs-lisp/bytecomp.el | 3 ++- lisp/emacs-lisp/comp.el | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index b04286c34aec..6b874b69167b 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2277,7 +2277,8 @@ With argument ARG, insert value in current buffer after the form." (push `(comp-native-driver-options . ,comp-native-driver-options) byte-native-qualities) (defvar no-native-compile) - (push `(no-native-compile . ,no-native-compile) + ;; `no-byte-compile' implies also `no-native-compile'. + (push `(no-native-compile . ,(or no-byte-compile no-native-compile)) byte-native-qualities)) ;; Compile the forms from the input buffer. diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 5a4a2f6ef152..a3a481cd36ad 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -182,6 +182,8 @@ the .eln output directory." (defvar no-native-compile nil "Non-nil to prevent native-compiling of Emacs Lisp code. +Note that when `no-byte-compile' is set to non-nil it overrides the value of +`no-native-compile'. This is normally set in local file variables at the end of the elisp file: \;; Local Variables:\n;; no-native-compile: t\n;; End: ") From 3e133cc050926284109fe61f4789f67676491ffa Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 16 Mar 2021 18:56:34 +0100 Subject: [PATCH 2/2] Fix `no-byte-compile' native compilation interaction (bug#47169) * lisp/emacs-lisp/comp.el (comp-spill-lap-function): Throw no-native-compile when `byte-native-qualities' are null. * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): No need to consider `no-byte-compile'. --- lisp/emacs-lisp/bytecomp.el | 3 +-- lisp/emacs-lisp/comp.el | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 6b874b69167b..b04286c34aec 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2277,8 +2277,7 @@ With argument ARG, insert value in current buffer after the form." (push `(comp-native-driver-options . ,comp-native-driver-options) byte-native-qualities) (defvar no-native-compile) - ;; `no-byte-compile' implies also `no-native-compile'. - (push `(no-native-compile . ,(or no-byte-compile no-native-compile)) + (push `(no-native-compile . ,no-native-compile) byte-native-qualities)) ;; Compile the forms from the input buffer. diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index a3a481cd36ad..6da1a7979c37 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -1315,7 +1315,8 @@ clashes." (cl-defmethod comp-spill-lap-function ((filename string)) "Byte-compile FILENAME, spilling data from the byte compiler." (byte-compile-file filename) - (when (alist-get 'no-native-compile byte-native-qualities) + (when (or (null byte-native-qualities) + (alist-get 'no-native-compile byte-native-qualities)) (throw 'no-native-compile nil)) (unless byte-to-native-top-level-forms (signal 'native-compiler-error-empty-byte filename))