Make native-comp-* aliases more robust

(defvaralias A B) throws an error if A is already defined. This breaks
Doom in the event that Doom's config is loaded late (e.g. with 'doom
run'), or these variables are set elsewhere (e.g. the sandbox). I didn't
want to have to do all these checks at startup, but it seems
unavoidable.

Since Doom will only support near-enough the latest commit of Emacs 28
HEAD, I will remove these fixes at the end of May, give or take a week.
This commit is contained in:
Henrik Lissner 2021-05-12 00:16:25 -04:00
parent 2dbeb0d161
commit 485f097297

View File

@ -155,24 +155,26 @@ users).")
;; REVIEW Remove after a month
(when (boundp 'comp-deferred-compilation)
(defvaralias 'native-comp-deferred-compilation 'comp-deferred-compilation)
(defvaralias 'native-comp-deferred-compilation-deny-list 'comp-deferred-compilation-deny-list)
(defvaralias 'native-comp-eln-load-path 'comp-eln-load-path)
(defvaralias 'native-comp-warning-on-missing-source 'comp-warning-on-missing-source)
(defvaralias 'native-comp-driver-options 'comp-native-driver-options)
(defvaralias 'native-comp-async-query-on-exit 'comp-async-query-on-exit)
(defvaralias 'native-comp-async-report-warnings-errors 'comp-async-report-warnings-errors)
(defvaralias 'native-comp-async-env-modifier-form 'comp-async-env-modifier-form)
(defvaralias 'native-comp-async-all-done-hook 'comp-async-all-done-hook)
(defvaralias 'native-comp-async-cu-done-functions 'comp-async-cu-done-functions)
(defvaralias 'native-comp-async-jobs-number 'comp-async-jobs-number)
(defvaralias 'native-comp-never-optimize-functions 'comp-never-optimize-functions)
(defvaralias 'native-comp-bootstrap-deny-list 'comp-bootstrap-deny-list)
(defvaralias 'native-comp-always-compile 'comp-always-compile)
(defvaralias 'native-comp-verbose 'comp-verbose)
(defvaralias 'native-comp-debug 'comp-debug)
(defvaralias 'native-comp-speed 'comp-speed)
(defalias 'native-comp-limple-mode #'comp-limple-mode))
(mapc (lambda (varset)
(unless (boundp (car varset))
(defvaralias (car varset) (cdr varset))))
'((native-comp-deferred-compilation . comp-deferred-compilation)
(native-comp-deferred-compilation-deny-list . comp-deferred-compilation-deny-list)
(native-comp-eln-load-path . comp-eln-load-path)
(native-comp-warning-on-missing-source . comp-warning-on-missing-source)
(native-comp-driver-options . comp-native-driver-options)
(native-comp-async-query-on-exit . comp-async-query-on-exit)
(native-comp-async-report-warnings-errors . comp-async-report-warnings-errors)
(native-comp-async-env-modifier-form . comp-async-env-modifier-form)
(native-comp-async-all-done-hook . comp-async-all-done-hook)
(native-comp-async-cu-done-functions . comp-async-cu-done-functions)
(native-comp-async-jobs-number . comp-async-jobs-number)
(native-comp-never-optimize-functions . comp-never-optimize-functions)
(native-comp-bootstrap-deny-list . comp-bootstrap-deny-list)
(native-comp-always-compile . comp-always-compile)
(native-comp-verbose . comp-verbose)
(native-comp-debug . comp-debug)
(native-comp-speed . comp-speed))))
;; Don't store eln files in ~/.emacs.d/eln-cache (they are likely to be purged
;; when upgrading Doom).