diff options
| author | Philip Kaludercic <philipk@posteo.net> | 2022-07-17 22:12:25 +0200 |
|---|---|---|
| committer | Philip Kaludercic <philipk@posteo.net> | 2022-07-17 22:12:25 +0200 |
| commit | c50b6e0b9a76d24d1aa9326c9929c148201e3a9d (patch) | |
| tree | 808fd536c439f19be6dd78d281910b7ddff7061e /compat.el | |
| parent | 03a4cdd52872e18076ba6ad1553be3cfbb087f42 (diff) | |
Wrap provide calls in `compat--inhibit-prefixed'
This is even simpler and less risky than copying `features' as it
alleviates the risk of confusing the loading procedure.
Diffstat (limited to 'compat.el')
| -rw-r--r-- | compat.el | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -48,18 +48,21 @@ ;; and do nothing when loading each sub-feature manually. (defvar compat--inhibit-prefixed) -(let* ((compat--inhibit-prefixed (not (bound-and-true-p compat-testing))) - (load-suffixes - (if (bound-and-true-p compat-testing) - (cons ".el" (remove ".el" load-suffixes)) - load-suffixes)) - (features (copy-sequence features))) - (ignore features) ;for the byte compiler - (require 'compat-24) - (require 'compat-25) - (require 'compat-26) - (require 'compat-27) - (require 'compat-28)) +(let ((compat--inhibit-prefixed (not (bound-and-true-p compat-testing))) + (load-suffixes + (if (bound-and-true-p compat-testing) + (cons ".el" (remove ".el" load-suffixes)) + load-suffixes))) + ;; Instead of using `require', we manually check `features' and call + ;; `load' to avoid the issue of not using `provide' at the end of + ;; the file (which is disabled by `compat--inhibit-prefixed', so + ;; that the file can be loaded again at some later point when the + ;; prefixed definitions are needed). + (unless (memq 'compat-24 features) (load "compat-24")) + (unless (memq 'compat-25 features) (load "compat-25")) + (unless (memq 'compat-26 features) (load "compat-26")) + (unless (memq 'compat-27 features) (load "compat-27")) + (unless (memq 'compat-28 features) (load "compat-28"))) (provide 'compat) ;;; compat.el ends here |
