Skip to content

Commit 341ac1f

Browse files
committed
Fix handling of files with no-byte-compile set to t; was accidentally broken way back in commit 1b5061f and never noticed (issue #103).
1 parent 49322c7 commit 341ac1f

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

eldev-build.el

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,14 @@ possible to build arbitrary targets this way."
606606
(with-temp-buffer
607607
(insert-file-contents source)
608608
;; Older versions don't understand `no-mode'.
609-
(hack-local-variables (when (>= emacs-major-version 26) 'no-mode))))))
609+
(hack-local-variables (when (>= emacs-major-version 26) 'no-mode))
610+
no-byte-compile))))
610611
;; Don't do anything with `no-byte-compile' files (not even load) unless called
611612
;; recursively. Otherwise we might e.g. attempt loading `define-package' and fail.
612-
(unless skip-byte-compilation
613+
(if skip-byte-compilation
614+
;; FIXME: Think of a way of not even trying to build such files. Otherwise the
615+
;; output ("ELC blabla.el") is confusing.
616+
(eldev-verbose "Cancelled byte-compilation of `%s': it has `no-byte-compile' local variable" source)
613617
(eldev-verbose (if recursive "Byte-compiling file `%s' early as `require'd from another file..." "Byte-compiling file `%s'...")
614618
source)
615619
(eldev-advised ('load :before

test/compile.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@
6060
(eldev--test-assert-files project-dir preexisting-files "src/project-l.elc" "src/project-l-misc.elc" "src/project-l-util.elc")
6161
(should (= exit-code 0)))))
6262

63+
(eldev-ert-defargtest eldev-compile-everything-8 (on-demand)
64+
(nil 'normal 'noisy)
65+
;; `project-j' has a file with `no-byte-compile' and autoloads.
66+
(eldev--test-without-files "project-j" ("project-j-autoloads.el" "project-j.elc" "project-j-advanced.elc")
67+
(should (member "project-j-uncompilable.el" preexisting-files))
68+
(eldev--test-run nil ((eldev--test-on-demand-to-loading-mode-option on-demand) "compile")
69+
(eldev--test-assert-files project-dir preexisting-files "project-j-autoloads.el" "project-j.elc" "project-j-advanced.elc")
70+
(should (= exit-code 0)))))
71+
6372

6473
(ert-deftest eldev-compile-test-files-1 ()
6574
(eldev--test-without-files "project-a" ("test/project-a.elc")
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
;; -*- lexical-binding: t; no-byte-compile: t -*-
2+
3+
;; Usage of `no-byte-compile' is not an accident: testing that such files are handled
4+
;; correctly too.
5+
6+
;;;###autoload
7+
(defun project-j-never-compiled-hello ()
8+
;; Not requiring anything for this function: it must be autoloaded.
9+
(project-i-hello))
10+
11+
(provide 'project-j-uncompilable)

0 commit comments

Comments
 (0)