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