all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jonas Bernoulli via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 73792@debbugs.gnu.org
Subject: bug#73792: 30; Confusion in loaddefs-generate--*-prefixes
Date: Sat, 26 Oct 2024 17:53:38 +0200	[thread overview]
Message-ID: <87ldyaamil.fsf@bernoul.li> (raw)
In-Reply-To: <jwvy12fylmy.fsf-monnier+emacs@gnu.org>

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> loaddefs-generate--compute-prefixes ignores definitions with an
>> autoload cookie:
>>
>> ,----
>> |             (when (save-excursion
>> |                     (goto-char (match-beginning 0))
>> |                     (or (bobp)
>> |                         (progn
>> |                           (forward-line -1)
>> |                           (not (looking-at ";;;###autoload")))))
>> |               (push name prefs))))))
>> `----
>>
>> Why?!
>
> The "symbol prefix" machinery is designed so as to try and give easier
> access to those things that Emacs wouldn't know about with it
> (i.e. symbols that exist "out there" in some installed packaged but
> aren't yet represented in `obarray`).
>
> Autoloaded functions are presumably already represented in `obarray`
> even if the file hasn't yet been loaded.  Admittedly, this is not 100%
> sure, but that's the reason why the code thinks it can ignore them.
>
> As for "why bother", well it turns out that it's not completely uncommon
> for a package's autoloaded functions to fall outside of the prefix
> shared by all other definitions, so skipping them can help improve the
> prefix.  Examples would be `run-foo` commands where all other functions
> use the `foo-` prefix, or even just the common `foo` entry point where
> all other definitions use the `foo-` prefix.

Makes sense.

(I was looking at this code to see if it could be used for this other
use-case: collect all prefixes used by "all known" packages.  Such
a prefix-to-package mapping could be published and checked when new
packages are added to some *ELPA, to decrease the odds of conflicts
on the symbol level.

I had little hope that this code would be suitable for that use-case,
but it could have been, so I had a look.  And then I figured I might
as well report the comment issue and ask about this.

I won't be working on this any time soon, since I have too much on my
plate already.  So if anyone with time on their hands reads this and
thinks it is a good idea, please go ahead.)

     Jonas





  reply	other threads:[~2024-10-26 15:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-13 15:12 bug#73792: 30; Confusion in loaddefs-generate--*-prefixes Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-13 15:49 ` Eli Zaretskii
2024-10-23 14:06 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-26 15:53   ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-10-26 17:41     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

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

  git send-email \
    --in-reply-to=87ldyaamil.fsf@bernoul.li \
    --to=bug-gnu-emacs@gnu.org \
    --cc=73792@debbugs.gnu.org \
    --cc=jonas@bernoul.li \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.