diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-06 12:26:29 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-06 12:31:53 +0100 |
| commit | eaada8921b50f4723574f935c095892bc5bea23d (patch) | |
| tree | 519824d4b543346b5f9908f69af18a2a7c263c67 | |
| parent | 4658ba6ea854af1e1e6154397c996c05c057d1b5 (diff) | |
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.
| -rw-r--r-- | compat-macs.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compat-macs.el b/compat-macs.el index e9e3712..be3fefd 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))))))))) |
