unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Philip Kaludercic <philipk@posteo.net>
Cc: "J.P." <jp@neverwas.me>,  emacs-devel <emacs-devel@gnu.org>,
	 Amin Bandali <bandali@gnu.org>,
	 emacs-erc@gnu.org
Subject: Copying autoloads (was: Adding 'compat' from ELPA as an optional dependency to ERC)
Date: Tue, 26 Jul 2022 17:00:40 -0400	[thread overview]
Message-ID: <jwvczdsiwr2.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87bktddnrs.fsf@posteo.net> (Philip Kaludercic's message of "Mon,  25 Jul 2022 18:56:39 +0000")

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




  parent reply	other threads:[~2022-07-26 21:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19 14:43 Adding 'compat' from ELPA as an optional dependency to ERC F. Jason Park
2022-07-19 16:17 ` Stefan Monnier
2022-07-19 16:25   ` Philip Kaludercic
2022-07-19 22:34     ` J.P.
2022-07-25 18:56       ` Philip Kaludercic
2022-07-26  3:04         ` J.P.
2022-07-26 15:17           ` Philip Kaludercic
2022-07-27 12:55             ` J.P.
2022-07-26 21:00         ` Stefan Monnier [this message]
2022-07-26 23:00           ` Copying autoloads Philip Kaludercic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvczdsiwr2.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=bandali@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-erc@gnu.org \
    --cc=jp@neverwas.me \
    --cc=philipk@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).