emacs-devel
[Top][All Lists]
Advanced

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

Copying autoloads (was: Adding 'compat' from ELPA as an optional depende


From: Stefan Monnier
Subject: Copying autoloads (was: Adding 'compat' from ELPA as an optional dependency to ERC)
Date: Tue, 26 Jul 2022 17:00:40 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Philip Kaludercic [2022-07-25 18:56:39] wrote:
>         (defun get-compatibility-func (name)
>           "Return the function NAME of a compatibility alias."
>           (let* ((compat (intern-soft (format "compat-%s" name))))
>             (or (symbol-function (if (fboundp name) name compat))
>                 (error "No definition for %S could be found" name))))

Side note: if `name` is autoloaded this will not return a "valid" value,
in the sense that the (autoload ...) value stored in `symbol-function`
is only usable when placed inside `name` and not elsewhere (e.g. you
can't `funcall` it, and if you store it in another symbol, calling the
function under that other symbol will probably fail).

Autoloads are somewhat hackish in this sense.


        Stefan




reply via email to

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