bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#51089: 28.0.60; Using read-symbol-shorthands (("-" . "foo-")) should


From: Eli Zaretskii
Subject: bug#51089: 28.0.60; Using read-symbol-shorthands (("-" . "foo-")) shouldn't shadow the '-' symbol
Date: Fri, 08 Oct 2021 08:49:30 +0300

> From: João Távora <joaotavora@gmail.com>
> Date: Thu, 07 Oct 2021 21:44:57 +0100
> 
> (1) The very simplest fix (and perhaps the most correct one) is just to
> special-case the case of the '-' prefix and the '-' function.  That's
> because the '-' symbol is the only one that exactly matches the
> name-prefix separator that is used in Emacs.  In other words, I can't
> think of any other "legitimate" use case for the shorthands feature that
> would shadow a similar one-character symbol.  For example using
> 
>    (("/" . "some-longhand/"))
> 
> would shadow the '/' symbol but count as as "the user knows what she's
> doing".

Shouldn't we disallow doing this when the car is any existing symbol?
Why do you think the above use with "/" is legitimate, and when could
it be useful?  And how "/" is different from "-"?  The fact that we
tend to use '-' as name separator is not 100% true: some symbols use
other separators: '/', '+', '>', etc.

Here's another idea: disallow the car from being a string that
includes only punctuation characters.  WDYT?

> (2) Another natural, more generic, way would be to demand that the
> shorthand in the 'car's of the elements of read-symbol-shorthands is
> strictly shorter then the form about to be renamed.  In lread.c, I think
> it would amount to this:

I don't think I like this artificial restriction.  I'm aware that you
are convinced that's how this feature should be used, but hard-coding
your personal opinions, not necessarily shared by others, in such a
low-level code is something we should avoid, I think.  And that's
besides the fact that this changes sensitive parts of Emacs on the
release branch.





reply via email to

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