From 6c3aca3bc019f95c35642e75313919652dc65f28 Mon Sep 17 00:00:00 2001 From: Zedhugh Chen Date: Sun, 16 Aug 2026 05:08:26 +0800 Subject: [PATCH] add configuration for native-comp --- .gitignore | 1 + early-init.el | 11 +++++++++++ lisp/init-func.el | 25 +++++++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/.gitignore b/.gitignore index fe14ada..a84904d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ /network-security.eld /nov-places /url/ +/eln-cache/ diff --git a/early-init.el b/early-init.el index 27e212e..44c03c6 100644 --- a/early-init.el +++ b/early-init.el @@ -1,5 +1,13 @@ ;; -*- coding: utf-8; lexical-binding: t; -*- +(defconst creature/native-comp-enable t + "Enable `native-comp' feature when supported.") + +(let ((enable-native-comp creature/native-comp-enable)) + (setq native-comp-jit-compilation enable-native-comp + native-comp-deferred-compilation enable-native-comp)) + + (setq package-enable-at-startup nil) (setq frame-inhibit-implied-resize t) @@ -40,3 +48,6 @@ (setq warning-minimum-level :error) (setq warning-minimum-log-level :error) + +(load-theme 'modus-vivendi t) +;; (load-theme 'wheatgrass t) diff --git a/lisp/init-func.el b/lisp/init-func.el index f8fc621..391ce7b 100644 --- a/lisp/init-func.el +++ b/lisp/init-func.el @@ -260,4 +260,29 @@ Directory entries are excluded from the returned list." (kill-buffer (current-buffer))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; native-comp ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun creature/native-compile-packages-async (lisp-file-dir) + "Compile .el file which in LISP-FILE-DIR to .eln recursively" + (interactive "D") + (if (bound-and-true-p creature/native-comp-enable) + (if (and (fboundp 'native-comp-available-p) (native-comp-available-p)) + (native-compile-async + lisp-file-dir t nil + (lambda (file) + (let ((filename (file-name-nondirectory file)) + (dir (file-name-directory file))) + (not (or (string= filename "wgrep-subtest.el") + (string= filename ".dir-locals.el") + (string= filename "test.el") + (string-suffix-p "-test.el" filename) + (string-suffix-p "-tests.el" filename) + (string-match-p "/test/" dir) + (string-match-p "/tests/" dir))))) + ) + (error "native-comp unavailable")) + (error "native-comp disabled by `creature/native-comp-enable'"))) + + (provide 'init-func)