emacs-devel
[Top][All Lists]
Advanced

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

Re: 29.0.60; keymap-local-set and keymap-global-set became less strict


From: Richard Stallman
Subject: Re: 29.0.60; keymap-local-set and keymap-global-set became less strict
Date: Fri, 03 Feb 2023 04:56:48 -0500

[[[ 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. ]]]

  > `called-interactive[ly]-p` is in the same category as `advice-add`.
  > It's great that we have it, but you should only use it when there's no
  > other way.

I wrote the recommendation to use an extra argument to distinguish
interactive calls because it is simple, reliable, and understandable.
It uses mechanisms that we use all the time in other ways.
When you look at code which does that, you will understand what it does.

`called-interactively-p' can't help being complex because it needs to
figure out retroactively how the call took place.  The extra argument
method instead arranges to remember how the call took place,

Ideally, we should obsolete `called-interactively-p' and then eliminate it.
Hwever, first we'd have to replace all the uses of it and thus verify
that absolutely all of them can be replaced.  I'm not sure it is worth
the effort to do this just to make things cleaner.

The recommended method replaces (called-interactively-p 'any).
Is there an easy way to use this approach to replace
(called-interactively-p 'interactive)?

If not, we could create one: define an interactive spec which
supplies the proper value for the distinguishing argument.

Is there already a way to do that?

  > The problem with the hidden INTERACTIVE (or ALLOW-VECTOR) argument is
  > that it is still somewhat exposed to non-interactive callers. For
  > example, in the context of the Compat library, should this argument be
  > made available, since non-interactive callers may want to use it? What
  > if callers start to use it if they want to pass vector arguments?

I don't know enough about that code to follow the argument here.
Could someone tell me what the Compat library does?
Is it in Emacs -- if so, what is the file name?

  > To come back to `keymap-local-set' - the good thing is that we can avoid
  > both kludges, advertised calling conventions and `call-interactively-p'.
  > All we have to do is move the key reading entirely to the interactive
  > form, which also seems to be semantically most correct. If I would rate
  > the possible solutions:

  > 1. Just allow vector arguments for all the functions. Simplest solution,
  > least amount of code.

If the change this advocates is what I think it is,
it would inconvenience users by making them change their old code.

If someone thinks that the extra-argument solution has a flaw in this
case, would you please present reasons for that conclusion>

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





reply via email to

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