unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Joseph Turner <joseph@ushin.org>,
	67325@debbugs.gnu.org, jonas@bernoul.li, public@protesilaos.com
Subject: bug#67325: shorthands: Incorrect autoloaded register-definition-prefixes
Date: Fri, 24 Nov 2023 09:24:01 +0000	[thread overview]
Message-ID: <CALDnm520fOwkHMJBsEq4cGh4v4pvV7zGC9VMrbzDqKhHYqwLZQ@mail.gmail.com> (raw)
In-Reply-To: <83a5r3fucu.fsf@gnu.org>

On Fri, Nov 24, 2023 at 8:06 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > Cc: Protesilaos Stavrou <public@protesilaos.com>,
> >  Jonas Bernoulli <jonas@bernoul.li>,
> >  João Távora <joaotavora@gmail.com>
> > Date: Mon, 20 Nov 2023 11:50:50 -0800
> > From:  Joseph Turner via "Bug reports for GNU Emacs,
> >  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> >
> > When using shorthands.el, autoload generation inserts a call to
> > register-definition-prefixes with the shorthand prefix, instead of the
> > translated print name prefix.  For example, breadcrumb-autoloads.el
> > contains the line:
> >
> > (register-definition-prefixes "breadcrumb" '("bc-"))
> >
> > instead of
> >
> > (register-definition-prefixes "breadcrumb" '("breadcrumb-"))
> >
> > This PR attempts to resolve this issue in breadcrumb.el by adding the
> > correct autoload line at the bottom of the file:
> >
> > https://github.com/joaotavora/breadcrumb/pull/24
> >
> > What needs to be done in core Emacs to fix autoload generation with
> > shorthands.el?
> >
> > Also see bug#63480.
>
> João, any comments?

Yes.  Well first, we are talking about an imperfect heuristic here
which lives in lisp/emacs-lisp/loaddefs-gen.el.  That's where
the definition prefixes for a given file are collected and the
common prefix is guessed, leading to the generation of the
register-definition-prefixes form.

The logic seems to have a number of exceptions and corner cases
baked into it already, and there seems to be even a specific
kill-switch for this particular register-definition-prefixes form:

;; Local Variables:
;; autoload-compute-prefixes: nil
;; End:

This form should probably be added to breadcrumb.el so that
the autoload mechanism would stop trying to guess the prefix
using its current flawed methods.  I've already asked the
submitters of the pull request to do so at the Breadcrumb
upstream.

BTW.  Grepping for autoload-compute-prefixes seems to indicate
it is totally undocumented. It's not even a defvar,
just an autoload-specific cookies.  This is fine, but I guess
it should still be documented somewhere.

OK so that solves the problem for breadcrumb.el and other
such shorthand-using packages such as beardbolt.el and others
I see popping up.

But maybe this issue can still be kept open.  It shouldn't be
terribly hard to add a fix to loaddefs-generate--compute-prefixes
or loaddefs-generate--make-prefixes that takes shorthands in
consideration.  In fact, the presence of a shorthand might
be a more reliable indicator of the package's intended "external"
prefix than any of the current heuristics.

> > Also see bug#63480.

What about it?  What's the relation to this bug?

João





  reply	other threads:[~2023-11-24  9:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20 19:50 bug#67325: shorthands: Incorrect autoloaded register-definition-prefixes Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-24  8:06 ` Eli Zaretskii
2023-11-24  9:24   ` João Távora [this message]
2023-11-25  4:18     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-25 12:44       ` João Távora
2023-11-26 14:14         ` João Távora
2023-11-26 18:07           ` Eli Zaretskii
2023-11-26 18:44             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-26 21:39               ` João Távora

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=CALDnm520fOwkHMJBsEq4cGh4v4pvV7zGC9VMrbzDqKhHYqwLZQ@mail.gmail.com \
    --to=joaotavora@gmail.com \
    --cc=67325@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jonas@bernoul.li \
    --cc=joseph@ushin.org \
    --cc=public@protesilaos.com \
    /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).