emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master dbbf38d43f: Document and test 'no-byte-compile' behavior.


From: Philipp Stephani
Subject: master dbbf38d43f: Document and test 'no-byte-compile' behavior.
Date: Tue, 21 Jun 2022 13:16:36 -0400 (EDT)

branch: master
commit dbbf38d43f1f49a38efd260bda655e0b3cd2b6d5
Author: Philipp Stephani <phst@google.com>
Commit: Philipp Stephani <phst@google.com>

    Document and test 'no-byte-compile' behavior.
    
    * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Document behavior
    if 'no-byte-compile' is set.
    * test/lisp/emacs-lisp/bytecomp-tests.el
    (byte-compile-file/no-byte-compile): New unit test.
    * test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el: New test
    file.
---
 lisp/emacs-lisp/bytecomp.el                                | 3 +++
 test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el | 1 +
 test/lisp/emacs-lisp/bytecomp-tests.el                     | 7 +++++++
 3 files changed, 11 insertions(+)

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 04c107a7cf..4fd65bb5d5 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2089,6 +2089,9 @@ If compilation is needed, this functions returns the 
result of
 The output file's name is generated by passing FILENAME to the
 function `byte-compile-dest-file' (which see).
 The value is non-nil if there were no errors, nil if errors.
+If the file sets the file variable `no-byte-compile', it is not
+compiled, any existing output file is removed, and the return
+value is `no-byte-compile'.
 
 See also `emacs-lisp-byte-compile-and-load'."
   (declare (advertised-calling-convention (filename) "28.1"))
diff --git a/test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el 
b/test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el
new file mode 100644
index 0000000000..00ad194750
--- /dev/null
+++ b/test/lisp/emacs-lisp/bytecomp-resources/no-byte-compile.el
@@ -0,0 +1 @@
+;; -*- no-byte-compile: t; -*-
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el 
b/test/lisp/emacs-lisp/bytecomp-tests.el
index fbc00b30c5..9c5bef09a3 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -1642,6 +1642,13 @@ EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode 
js-mode python-mode)) \
           (setq actual (nreverse actual))
           (should (equal actual expected)))))))
 
+(ert-deftest byte-compile-file/no-byte-compile ()
+  (let* ((src-file (ert-resource-file "no-byte-compile.el"))
+         (dest-file (make-temp-file "bytecomp-tests-" nil ".elc"))
+         (byte-compile-dest-file-function (lambda (_) dest-file)))
+    (should (eq (byte-compile-file src-file) 'no-byte-compile))
+    (should-not (file-exists-p dest-file))))
+
 
 ;; Local Variables:
 ;; no-byte-compile: t



reply via email to

[Prev in Thread] Current Thread [Next in Thread]