[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat 64fd716444 5/5: Minor simplification - remove ty
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat 64fd716444 5/5: Minor simplification - remove type argument from compat--generate-function |
Date: |
Tue, 3 Jan 2023 11:57:27 -0500 (EST) |
branch: externals/compat
commit 64fd71644411dbe535bb7757f72724c5fe576e31
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Minor simplification - remove type argument from compat--generate-function
---
compat-macs.el | 20 +++++++++-----------
compat-tests.el | 5 ++---
2 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/compat-macs.el b/compat-macs.el
index 463231ea36..71ee19aee0 100644
--- a/compat-macs.el
+++ b/compat-macs.el
@@ -32,9 +32,9 @@
(defvar compat--generate-function #'compat--generate-default
"Function used to generate compatibility code.
The function must take six arguments: NAME, DEF-FN, INSTALL-FN,
-CHECK-FN, ATTR and TYPE. The resulting body is constructed by
-invoking the functions DEF-FN (passed the \"realname\" and the
-version number, returning the compatibility definition), the
+CHECK-FN and ATTR. The resulting body is constructed by invoking
+the functions DEF-FN (passed the \"realname\" and the version
+number, returning the compatibility definition), the
INSTALL-FN (passed the \"realname\" and returning the
installation code), CHECK-FN (passed the \"realname\" and
returning a check to see if the compatibility definition should
@@ -67,14 +67,12 @@ ignored:
the compatibility definition (symbol).
- :prefix :: Add a `compat-' prefix to the name, and define the
- compatibility code unconditionally.
+ compatibility code unconditionally.")
-TYPE is used to set the symbol property `compat-type' for NAME.")
-
-(defun compat--generate-default (name def-fn install-fn check-fn attr type)
+(defun compat--generate-default (name def-fn install-fn check-fn attr)
"Generate a leaner compatibility definition.
See `compat--generate-function' for details on the arguments NAME,
-DEF-FN, INSTALL-FN, CHECK-FN, ATTR and TYPE."
+DEF-FN, INSTALL-FN, CHECK-FN and ATTR."
(let* ((min-version (plist-get attr :min-version))
(max-version (plist-get attr :max-version))
(feature (plist-get attr :feature))
@@ -98,7 +96,7 @@ DEF-FN, INSTALL-FN, CHECK-FN, ATTR and TYPE."
(when (eq name realname)
(error "%S: Name is equal to realname" name))
(cond
- ((and (plist-get attr :prefix) (memq type '(func macro))
+ ((and (plist-get attr :prefix)
(string-match "\\`compat-\\(.+\\)\\'" (symbol-name name))
(let* ((actual-name (intern (match-string 1 (symbol-name name))))
(body (funcall install-fn actual-name version)))
@@ -181,7 +179,7 @@ If this is not documented on your system, you can check \
`(defalias ',name #',realname))
(lambda ()
`(not (fboundp ',name)))
- rest type)))
+ rest)))
(defmacro compat-defun (name arglist docstring &rest rest)
"Define NAME with arguments ARGLIST as a compatibility function.
@@ -253,7 +251,7 @@ non-nil value."
`(defvaralias ',name ',realname))
(lambda ()
`(not (boundp ',name)))
- attr 'variable))
+ attr))
(provide 'compat-macs)
;;; compat-macs.el ends here
diff --git a/compat-tests.el b/compat-tests.el
index 61405d56de..ad2611d9b9 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -34,10 +34,10 @@
(setq ert-quiet t)
-(defun compat--generate-testable (name def-fn install-fn check-fn attr type)
+(defun compat--generate-testable (name def-fn install-fn check-fn attr)
"Generate a more verbose compatibility definition, fit for testing.
See `compat-generate-function' for details on the arguments NAME,
-DEF-FN, INSTALL-FN, CHECK-FN, ATTR and TYPE."
+DEF-FN, INSTALL-FN, CHECK-FN and ATTR."
(let* ((min-version (plist-get attr :min-version))
(max-version (plist-get attr :max-version))
(feature (plist-get attr :feature))
@@ -66,7 +66,6 @@ DEF-FN, INSTALL-FN, CHECK-FN, ATTR and TYPE."
(`(when (and ,(if cond cond t)
,(funcall check-fn)))))))
`(progn
- (put ',realname 'compat-type ',type)
(put ',realname 'compat-version ,version)
(put ',realname 'compat-min-version ,min-version)
(put ',realname 'compat-max-version ,max-version)