[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat cbd908e642 1/4: compat--function-definition: Do
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat cbd908e642 1/4: compat--function-definition: Do not use hashed symbol |
Date: |
Fri, 6 Jan 2023 09:57:27 -0500 (EST) |
branch: externals/compat
commit cbd908e642af56924d44497270875ff76ee673dd
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
compat--function-definition: Do not use hashed symbol
The hashed symbol leads to a bytecompiler warning (false positive).
---
compat-macs.el | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/compat-macs.el b/compat-macs.el
index b1a7cb9890..880f71cd7a 100644
--- a/compat-macs.el
+++ b/compat-macs.el
@@ -124,25 +124,23 @@ REST are attributes and the function BODY."
(and explicit
(version< emacs-version compat--current-version)
(intern (format "compat--%s" name)))))
- (def (and defname
- `(,(if (eq type 'macro) 'defmacro 'defun)
- ,defname ,arglist
- ,(compat--format-docstring type name docstring)
- ,@body))))
+ (def `(,(if (eq type 'macro) 'defmacro 'defun)
+ ,defname ,arglist
+ ,(compat--format-docstring type name docstring)
+ ,@body)))
;; An additional fboundp check is performed at runtime to make
;; sure that we never redefine an existing definition if Compat
;; is loaded on a newer Emacs version.
- `(,@(when def
- (if (eq defname name)
- ;; Declare the function in a non-existing compat-declare
- ;; feature, such that the byte compiler does not complain
- ;; about possibly missing functions at runtime. The warnings
- ;; are generated due to the unless fboundp check.
- `((declare-function ,name "ext:compat-declare")
- (unless (fboundp ',name) ,def))
- (list def)))
+ `(,@(if (eq defname name)
+ ;; Declare the function in a non-existing compat-declare
+ ;; feature, such that the byte compiler does not complain
+ ;; about possibly missing functions at runtime. The warnings
+ ;; are generated due to the unless fboundp check.
+ `((declare-function ,name "ext:compat-declare")
+ (unless (fboundp ',name) ,def))
+ (and defname (list def)))
,@(when realname
- `((defalias ',realname #',(or defname name)))))))))
+ `((defalias ',realname ',(or defname name)))))))))
(defmacro compat-defalias (name def &rest attrs)
"Define compatibility alias NAME as DEF.