[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat c91756bad6 04/10: Have a prefixed minimal compat
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat c91756bad6 04/10: Have a prefixed minimal compatibility expand to nil |
Date: |
Mon, 28 Feb 2022 03:57:33 -0500 (EST) |
branch: externals/compat
commit c91756bad648c8c651171f2b59794d9775a16753
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Have a prefixed minimal compatibility expand to nil
The plan here is that by default, no prefixed compatibility functions
are loaded, as compat.el byte-compiles minimal definitions, but if a
package or library requires a prefixed function, it can require a
specific component of compat, loading all functions.
---
compat-macs.el | 93 +++++++++++++++++++++++++++++-----------------------------
1 file changed, 47 insertions(+), 46 deletions(-)
diff --git a/compat-macs.el b/compat-macs.el
index 5f81e90c11..75d277421b 100644
--- a/compat-macs.el
+++ b/compat-macs.el
@@ -78,52 +78,53 @@ TYPE is used to set the symbol property `compat-type' for
NAME.")
"Generate a leaner compatibility definition.
See `compat-generate-function' for details on the arguments NAME,
DEF-FN, INSTALL-FN, CHECK-FN, ATTR and TYPE."
- (let* ((min-version (plist-get attr :min-version))
- (max-version (plist-get attr :max-version))
- (feature (plist-get attr :feature))
- (cond (plist-get attr :cond))
- (version (or (plist-get attr :version)
- (let ((file (or (and (boundp 'byte-compile-current-file)
- byte-compile-current-file)
- load-file-name
- (buffer-file-name))))
- ;; Guess the version from the file the macro is
- ;; being defined in.
- (and (string-match
-
"compat-\\([[:digit:]]+\\.[[:digit:]]+\\)\\.\\(?:elc?\\)\\'"
- file)
- (match-string 1 file)))))
- (realname (or (plist-get attr :realname)
- (intern (format "compat--%S" name))))
- (check (cond
- ((and (or (not version)
- (version< emacs-version version))
- (or (not min-version)
- (version<= min-version emacs-version))
- (or (not max-version)
- (version<= emacs-version max-version)))
- `(when (and ,(if cond cond t)
- ,(funcall check-fn))))
- ('(compat--ignore))) ))
- (let* ((body (if (eq type 'advice)
- `(,@check
- ,(funcall def-fn realname version)
- ,(funcall install-fn realname version))
- `(,@check ,(funcall def-fn name version))))
- (body1 (if feature
- ;; See https://nullprogram.com/blog/2018/02/22/:
- `(eval-after-load ',feature `(funcall ',(lambda ()
,body)))
- body)))
- (if (plist-get attr :alias)
- `(progn
- ,body1
- ,(cond
- ((memq type '(func advice macro))
- `(defalias ',realname #',name))
- ((memq type '(variable))
- `(defvaralias ',realname ',name))
- ((error "Unknown type %s" type))))
- body1))))
+ (unless (plist-get attr :prefix)
+ (let* ((min-version (plist-get attr :min-version))
+ (max-version (plist-get attr :max-version))
+ (feature (plist-get attr :feature))
+ (cond (plist-get attr :cond))
+ (version (or (plist-get attr :version)
+ (let ((file (or (and (boundp
'byte-compile-current-file)
+ byte-compile-current-file)
+ load-file-name
+ (buffer-file-name))))
+ ;; Guess the version from the file the macro is
+ ;; being defined in.
+ (and (string-match
+
"compat-\\([[:digit:]]+\\.[[:digit:]]+\\)\\.\\(?:elc?\\)\\'"
+ file)
+ (match-string 1 file)))))
+ (realname (or (plist-get attr :realname)
+ (intern (format "compat--%S" name))))
+ (check (cond
+ ((and (or (not version)
+ (version< emacs-version version))
+ (or (not min-version)
+ (version<= min-version emacs-version))
+ (or (not max-version)
+ (version<= emacs-version max-version)))
+ `(when (and ,(if cond cond t)
+ ,(funcall check-fn))))
+ ('(compat--ignore))) ))
+ (let* ((body (if (eq type 'advice)
+ `(,@check
+ ,(funcall def-fn realname version)
+ ,(funcall install-fn realname version))
+ `(,@check ,(funcall def-fn name version))))
+ (body1 (if feature
+ ;; See https://nullprogram.com/blog/2018/02/22/:
+ `(eval-after-load ',feature `(funcall ',(lambda ()
,body)))
+ body)))
+ (if (plist-get attr :alias)
+ `(progn
+ ,body1
+ ,(cond
+ ((memq type '(func advice macro))
+ `(defalias ',realname #',name))
+ ((memq type '(variable))
+ `(defvaralias ',realname ',name))
+ ((error "Unknown type %s" type))))
+ body1)))))
(defun compat--generate-verbose (name def-fn install-fn check-fn attr type)
"Generate a more verbose compatibility definition, fit for testing.
- [elpa] externals/compat updated (ab08067970 -> 8792ab17be), ELPA Syncer, 2022/02/28
- [elpa] externals/compat 0faf5f469c 03/10: Merge branch 'master' into testing, ELPA Syncer, 2022/02/28
- [elpa] externals/compat 5d4fdf41db 01/10: Merge byte compilation output into a single file, ELPA Syncer, 2022/02/28
- [elpa] externals/compat ccc8b1fd36 02/10: Compress and merge the compiled result of compat.elc, ELPA Syncer, 2022/02/28
- [elpa] externals/compat 50b26ffdf2 07/10: Install nadvice in compat-tests before loading compat, ELPA Syncer, 2022/02/28
- [elpa] externals/compat 28f57d52a0 06/10: Fix copyright for compat-font-lock.el, ELPA Syncer, 2022/02/28
- [elpa] externals/compat a793b0b6e9 05/10: Extract font-locking into compat-font-lock.el, ELPA Syncer, 2022/02/28
- [elpa] externals/compat 4d3d0bf680 08/10: Fix duplicate definition testing checking, ELPA Syncer, 2022/02/28
- [elpa] externals/compat 8792ab17be 10/10: Merge branch 'testing', ELPA Syncer, 2022/02/28
- [elpa] externals/compat c91756bad6 04/10: Have a prefixed minimal compatibility expand to nil,
ELPA Syncer <=
- [elpa] externals/compat 164672060f 09/10: Only generate verbose expansions when testing, ELPA Syncer, 2022/02/28