emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat eaada8921b 2/2: compat--function-definition: Add


From: ELPA Syncer
Subject: [elpa] externals/compat eaada8921b 2/2: compat--function-definition: Add declare-function
Date: Fri, 6 Jan 2023 06:57:25 -0500 (EST)

branch: externals/compat
commit eaada8921b50f4723574f935c095892bc5bea23d
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    compat--function-definition: Add declare-function
    
    The functions are declared in order to avoid bytecompiler warnings
    about missing definitions at runtime. These warnings may be generated
    due to the dynamic unless fboundp check, which ensures that existing
    functions are not overridden.
---
 compat-macs.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/compat-macs.el b/compat-macs.el
index e9e3712cce..be3fefd9a4 100644
--- a/compat-macs.el
+++ b/compat-macs.el
@@ -134,7 +134,12 @@ REST are attributes and the function BODY."
         ;; is loaded on a newer Emacs version.
         `(,@(when def
               (if (eq defname name)
-                  `((unless (fboundp ',name) ,def))
+                  ;; 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)))
           ,@(when realname
               `((defalias ',realname #',(or defname name)))))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]