diff --git a/CHANGELOG.md b/CHANGELOG.md index bc916eca..d9bd271b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how * fix(test): ERT test fails on Emacs 30+ (cc1f4e15b7b40b986ad1a93f6e40d121340598de) * fix(test): eask options should not be passed to buttercup (#281) * feat(core): Lazy install on required packages (#284) +* feat(compile): Improve compile messages on error (#285) ## 0.10.x > Released Jun 13, 2024 diff --git a/lisp/_prepare.el b/lisp/_prepare.el index 73275280..e1bfc7da 100644 --- a/lisp/_prepare.el +++ b/lisp/_prepare.el @@ -600,7 +600,7 @@ scope of the dependencies (it's either `production' or `development')." If the argument FORCE is non-nil, force initialize packages in this session." (when (or (not package--initialized) (not package-archive-contents) force - ;; XXX we need to initialize once in global scope since most Emacs + ;; XXX: we need to initialize once in global scope since most Emacs ;; configuration would likely to set `package-archives' variable ;; themselves. (and (eask-config-p) (not eask--package-initialized))) @@ -697,7 +697,7 @@ Argument BODY are forms for execution." (eask-with-progress (format " - %sInstalling %s (%s)... " eask--action-prefix name version) (eask-with-verbosity 'debug - ;; XXX Without ignore-errors guard, it will trigger error + ;; XXX: Without ignore-errors guard, it will trigger error ;; ;; Can't find library xxxxxxx.el ;; diff --git a/lisp/core/compile.el b/lisp/core/compile.el index 754e6743..54092100 100644 --- a/lisp/core/compile.el +++ b/lisp/core/compile.el @@ -37,13 +37,21 @@ ;; ;;; Core -(defconst eask-compile--log-buffer-name "*Compile-Log*" - "Byte-compile log buffer name.") +(require 'bytecomp) + +;; XXX: The function `byte-compile-warn' last modified is 2015; +;; I'll say it's safe to override this function. +(advice-add 'byte-compile-warn :override + (lambda (format &rest args) + (setq format (apply #'format-message format args)) + (byte-compile-log-warning format t (if byte-compile-error-on-warn + :error + :warning)))) (defun eask-compile--print-log () "Print `*Compile-Log*' buffer." - (when (get-buffer eask-compile--log-buffer-name) - (with-current-buffer eask-compile--log-buffer-name + (when (get-buffer byte-compile-log-buffer) + (with-current-buffer byte-compile-log-buffer (if (and (eask-clean-p) (eask-strict-p)) (eask-error (buffer-string)) ; Exit with error code! (eask-print-log-buffer)) @@ -85,14 +93,14 @@ The CMD is the command to start a new Emacs session." (content (eask-compile--byte-compile-file-external-content filename cmd))) (if (string-empty-p content) t ; no error, good! - (with-current-buffer (get-buffer-create eask-compile--log-buffer-name) + (with-current-buffer (get-buffer-create byte-compile-log-buffer) (insert content))))) (defun eask-compile--byte-compile-file (filename) "Byte compile FILENAME." ;; *Compile-Log* does not kill itself. Make sure it's clean before we do ;; next byte-compile task. - (ignore-errors (kill-buffer eask-compile--log-buffer-name)) + (ignore-errors (kill-buffer byte-compile-log-buffer)) (let* ((filename (expand-file-name filename)) (result)) (eask-with-progress @@ -102,7 +110,7 @@ The CMD is the command to start a new Emacs session." (eask-compile--byte-compile-file-external filename) (byte-compile-file filename)) result (eq result t))) - (if result "done ✓" "skipped ✗")) + (unless byte-compile-verbose (if result "done ✓" "skipped ✗"))) (eask-compile--print-log) result)) @@ -112,7 +120,7 @@ The CMD is the command to start a new Emacs session." (compiled (length compiled)) (skipped (- (length files) compiled))) ;; XXX: Avoid last newline from the log buffer! - (unless (get-buffer eask-compile--log-buffer-name) + (unless (get-buffer byte-compile-log-buffer) (eask-msg "")) (eask-info "(Total of %s file%s compiled, %s skipped)" compiled (eask--sinr compiled "" "s") diff --git a/lisp/core/exec.el b/lisp/core/exec.el index c39b5c30..8d40e32f 100644 --- a/lisp/core/exec.el +++ b/lisp/core/exec.el @@ -35,7 +35,7 @@ (eask-start (eask-defvc< 27 (eask-pkg-init)) ; XXX: remove this after we drop 26.x - ;; XXX This is the hack by adding all `bin' folders from local elpa. + ;; XXX: This is the hack by adding all `bin' folders from local elpa. (eask-setup-paths) (if (eask-argv 1) (eask-with-progress diff --git a/test/commands/test/buttercup/test-ok/buttercup-test.el b/test/commands/test/buttercup/test-ok/buttercup-test.el index c86b9b2e..104f30be 100644 --- a/test/commands/test/buttercup/test-ok/buttercup-test.el +++ b/test/commands/test/buttercup/test-ok/buttercup-test.el @@ -28,5 +28,4 @@ (it "contains a spec with an expectation" (expect t :to-be t))) -(provide 'buttercup-test) ;;; buttercup-test.el ends here