emacs-devel
[Top][All Lists]
Advanced

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

Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorth


From: João Távora
Subject: Re: Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master)
Date: Mon, 04 Oct 2021 16:44:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)

Richard Stallman <rms@gnu.org> writes:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > > The name known to Emacs is "string-library-foo" (or whatever).
>   > >
>   > > The user types "C-h o s-foo RET" and Emacs says "no match".
>
> If the user switches to a buffer which contains a Lisp program that
> requires s, then types C-h o s-foo RET, or C-h f s-foo RET, I think it
> would make sense for it to find s-foo.

The system is behaving as designed.

In the sequence C-h o s-foo, the last 5 characters typed are not the
name of a symbol, they are the name of a shorthand (a shorthand is _not_
a symbol) that you are seeing (in the sense of "with your eyes"") in
some buffer.  Note this:

* The display of that shorthand is visually different from the display
  of any other symbol-referring form.

  In particular the prefix and the suffix are font-locked with different
  colors.  Thus, there is little reason to be mistaken that 's-foo' is
  the full name of a symbol.

  There is even less reason to be mistaken than when using using
  'cl-letf' and 'cl-flet', or level 'let' which create local
  definitions.

* If, as you write, you have switched to the buffer where the shorthand
  's-foo' occurs and you type the beginning of the C-h o sequence when
  point is ON that shorthand, the Lisp reader will follow the shorthand
  to the `string-library-foo' symbol and offer to display help on that.

* The C-h o and similar commands operate on symbols and are global.

  They display the same list of symbols irrespective of the locus of
  there invocation.  This makes sense, because Emacs operates with a
  single global collection of symbols.  Shorthands haven't changed that,
  and this was never the intention.

* C-h o and similar commands _could_ theoretically be changed to
  complement that list of symbols with the list of shorthands to symbols
  of the buffer.

  That would be a non-trivial effort and would bring grave confusion.
  That's because, as you have well written elsewhere, the Lisp reader
  follows 's-foo' to 'string-library-foo' on this buffer but may follow
  it to 'system-library-foo' in another buffer.

  That's what makes Shorthands a namespacing system (contrary to what
  some mistaken minds are keen on insiting): there is more than one way
  to refer to the same thing _depending_ on context and the _same name_
  may refer to different tihngs, depending on context.

  The buffer is the context here.

* So, if we follow our first instincts (they were my first instincts,
  too!), it means that the exact same Help input in two different
  situations could bring about different results.

Again, it is theoretically possible to do as you suggest, but the effort
required isn't trivial and, more importantly, the confusion generated is
much, much greater.

João



reply via email to

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