Skip to content

Commit cfc3105

Browse files
committed
code: print all compile log
1 parent 68b72a3 commit cfc3105

3 files changed

Lines changed: 31 additions & 14 deletions

File tree

lisp/_prepare.el

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ the `eask-start' execution.")
148148
(eask-with-progress
149149
(ansi-green "Loading package information... ")
150150
(eask-with-verbosity 'debug
151-
(message "")
152151
(package-initialize) (package-refresh-contents))
153152
(ansi-green "done")))
154153

@@ -163,7 +162,6 @@ the `eask-start' execution.")
163162
(eask-with-progress
164163
(format " - Installing %s (%s)... " pkg-string pkg-version)
165164
(eask-with-verbosity 'debug
166-
(message "")
167165
(package-refresh-contents)
168166
;; XXX Without ignore-errors guard, it will trigger error
169167
;;
@@ -573,7 +571,8 @@ Standard is, 0 (error), 1 (warning), 2 (info), 3 (log), 4 or above (debug)."
573571
(defmacro eask-with-verbosity (symbol &rest body)
574572
"If LEVEL is above `eask-verbosity'; hide all messages in BODY."
575573
(declare (indent 1) (debug t))
576-
`(if (eask--reach-verbosity-p ,symbol) (progn ,@body) (eask--silent ,@body)))
574+
`(if (eask--reach-verbosity-p ,symbol) (progn ,@body)
575+
(eask--silent ,@body)))
577576

578577
(defun eask-debug (msg &rest args) (apply #'eask--msg 'debug "[DEBUG]" msg args))
579578
(defun eask-log (msg &rest args) (apply #'eask--msg 'log "[LOG]" msg args))
@@ -669,7 +668,8 @@ Standard is, 0 (error), 1 (warning), 2 (info), 3 (log), 4 or above (debug)."
669668
(defmacro eask-with-progress (msg-start body msg-end)
670669
"Progress BODY wrapper with prefix and suffix messages."
671670
(declare (indent 0) (debug t))
672-
`(progn (eask-write ,msg-start) ,body (eask-msg ,msg-end)))
671+
`(progn (ignore-errors (eask-write ,msg-start)) ,body
672+
(ignore-errors (eask-msg ,msg-end))))
673673

674674
(defun eask-progress-seq (prefix sequence suffix func)
675675
"Progress SEQUENCE with messages."
@@ -686,6 +686,16 @@ Standard is, 0 (error), 1 (warning), 2 (info), 3 (log), 4 or above (debug)."
686686
suffix))
687687
sequence)))
688688

689+
(defun eask-print-log ()
690+
"Loop through each line and print each line with corresponds log level."
691+
(goto-char (point-min))
692+
(while (not (eobp))
693+
(let ((line (buffer-substring-no-properties (line-beginning-position) (line-end-position))))
694+
(cond ((string-match-p " [eE]rror: " line) (eask-error line))
695+
((string-match-p " [Ww]arning: " line) (eask-warn line))
696+
(t (eask-log line))))
697+
(forward-line 1)))
698+
689699
;;
690700
;;; User customization
691701

lisp/compile.el

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,32 @@
3131
(message " [+] (files \"FILE-1\" \"FILE-2\")"))
3232

3333
;; Handle options
34-
(when (eask-strict-p) (setq byte-compile-error-on-warn t))
35-
(when (= eask-verbosity 4) (setq byte-compile-verbose t))
34+
(add-hook 'eask-before-command-hook
35+
(lambda ()
36+
(when (eask-strict-p) (setq byte-compile-error-on-warn t))
37+
(when (= eask-verbosity 4) (setq byte-compile-verbose t))))
38+
39+
(defconst eask-compile-log-buffer-name "*Compile-Log*")
40+
41+
(defun eask--print-compile-log ()
42+
"Print `*Compile-Log*' buffer."
43+
(when (get-buffer eask-compile-log-buffer-name)
44+
(with-current-buffer eask-compile-log-buffer-name
45+
(eask-print-log)
46+
(message ""))))
3647

3748
(defun eask--byte-compile-file (filename)
3849
"Byte compile FILENAME."
50+
(ignore-errors (kill-buffer eask-compile-log-buffer-name))
3951
(let* ((filename (expand-file-name filename))
4052
(result))
4153
(eask-with-progress
42-
(format "Compiling %s..." filename)
54+
(unless byte-compile-verbose (format "Compiling %s..." filename))
4355
(eask-with-verbosity 'debug
4456
(setq result (byte-compile-file filename)
4557
result (eq result t)))
4658
(if result "done ✓" "skipped ✗"))
59+
(eask--print-compile-log)
4760
result))
4861

4962
(defun eask--compile-files (files)

lisp/lint.el

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,7 @@
2222
(defun eask--print-package-lint-buffer ()
2323
"Print `*Package-Lint*' buffer."
2424
(with-current-buffer "*Package-Lint*"
25-
(goto-char (point-min))
26-
(while (not (eobp))
27-
(let ((line (buffer-substring-no-properties (line-beginning-position) (line-end-position))))
28-
(cond ((string-match-p " error: " line) (eask-error line))
29-
((string-match-p " warning: " line) (eask-warn line))
30-
(t (eask-log line))))
31-
(forward-line 1))))
25+
(eask-print-log)))
3226

3327
(defun eask--package-lint-file (filename)
3428
"Package lint FILENAME."

0 commit comments

Comments
 (0)