diff options
| author | Craig Jennings <c@cjennings.net> | 2025-08-13 16:50:20 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-08-13 16:50:20 -0500 |
| commit | 8d523a2f6d254524b17ca310b7267b2af7024ab2 (patch) | |
| tree | 57b2f2eed279ee8359e9a7258aaeac7b3eb0c6b0 /modules | |
| parent | 6b0aa9a0becafa661a0de6a4e9418352809c17f6 (diff) | |
| download | dotemacs-8d523a2f6d254524b17ca310b7267b2af7024ab2.tar.gz dotemacs-8d523a2f6d254524b17ca310b7267b2af7024ab2.zip | |
feat(system-defaults): native compilation prefs and log warnings
- Set async compile workers, highest optimization, and always-compile
- Redirect native-comp warnings to comp-warnings.log via advice on display-warning
- NOTE: log native comp warnings still needs testing
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/system-defaults.el | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/modules/system-defaults.el b/modules/system-defaults.el index cf0d1041..f7e18d95 100644 --- a/modules/system-defaults.el +++ b/modules/system-defaults.el @@ -5,6 +5,40 @@ ;;; Code: + +;; -------------------------- Native Comp Preferences -------------------------- +;; After async compiler starts, set preferences and warning level + +(with-eval-after-load 'comp-run + (setopt native-comp-async-jobs-number 8) ; parallel compile workers + (setopt native-comp-speed 3) ; highest optimization level + (setopt native-comp-always-compile t)) ; always native-compile + +;; -------------------------- Log Native Comp Warnings ------------------------- +;; Log native comp warnings rather than cluttering the buffer + +(defvar comp-warnings-log + (expand-file-name "comp-warnings.log" user-emacs-directory) + "File where native-comp warnings will be appended.") + +(defun cj/log-comp-warning (type message &rest args) + "Log native-comp warnings of TYPE with MESSAGE & ARGS to 'comp-warnings-log'. +Suppress them from appearing in the *Warnings* buffer. If TYPE contains 'comp', +log the warning with a timestamp to the file specified by 'comp-warnings-log'. +Return non-nil to indicate the warning was handled." + (when (memq 'comp (if (listp type) type (list type))) + (with-temp-buffer + (insert (format-time-string "[%Y-%m-%d %H:%M:%S] ")) + (insert (if (stringp message) + (apply #'format message args) + (format "%S %S" message args))) + (insert "\n") + (append-to-file (point-min) (point-max) comp-warnings-log)) + ;; Return non-nil to tell `display-warning' “we handled it.” + t)) + +(advice-add 'display-warning :before-until #'cj/log-comp-warning) + ;; ---------------------------------- Unicode ---------------------------------- (set-locale-environment "en_US.UTF-8") @@ -197,7 +231,7 @@ (when (daemonp) (exec-path-from-shell-initialize))) -;; ------------------------------- GNU Ls On BSD ------------------------------- +;; ------------------------------- GNU 'ls' On BSD ------------------------------- ;; when on BSD use the ls from FSF sysutils/coreutils: pkg install coreutils (cond ((eq system-type 'berkeley-unix) |
