branch: externals/compat commit eaada8921b50f4723574f935c095892bc5bea23d Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@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)))))))))