unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Precise behavior of function-key-map and friends
@ 2002-06-06  1:44 Stefan Monnier
  2002-06-06  9:44 ` Andreas Schwab
  2002-06-07  0:45 ` Richard Stallman
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Monnier @ 2002-06-06  1:44 UTC (permalink / raw)



1 - The documentation says that function-key-map bindings only apply
  if there is no corresponding binding in the global map.

  What about the case where I have a function-key-map binding that
  turns C-x into C-c.  Clearly C-x C-c will stays as it is, but
  what about C-x w (which has no binding) ?

  Currently C-x w is left as is.  Should function-key-map remap it
  to C-c w ?

2 - key-translation-map says that the translation is always done, whether
  or not it has a binding in the normal maps.
  Among other things, this means that when you hit C-x 8 it will
  keep reading input because there's a chance that it will end up
  in a sequence of keys that can be translated by key-translation-map.
  So you can hit C-c C-x 8 ' e to enter the (unbound) C-c é key sequence.
  But note that C-x C-x 8 ' e does not work, because C-x C-x is bound
  and read-key-sequence will not keep reading input in this case.

3 - function-key-map applies only if the current key-sequence has
  no binding in the normal maps.  But since key-translation-map
  is applied unconditionally afterwards, the "has a binding" condition
  is not easy to decide (and is done incorrectly).  E.g. say I have
  a function-key-mapping from X to Z and a key-translation-mapping from
  X to Z and from Z to X.
  If there's a global key binding for Z but not for X, a keyboard
  entry of X will be function-key-mapped to Z and then
  key-translation-mapped to X and the result will be "ding".
  OTOH if there's a binding for X but not for Z, the X entry
  will not be function-key-mapped, so it will be key-translation-mapped to Z
  and there again, the result will be "ding".


	Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Precise behavior of function-key-map and friends
  2002-06-06  1:44 Precise behavior of function-key-map and friends Stefan Monnier
@ 2002-06-06  9:44 ` Andreas Schwab
  2002-06-07  0:45 ` Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2002-06-06  9:44 UTC (permalink / raw)
  Cc: emacs-devel

"Stefan Monnier" <monnier+gnu/emacs@RUM.cs.yale.edu> writes:

|> 1 - The documentation says that function-key-map bindings only apply
|>   if there is no corresponding binding in the global map.
|> 
|>   What about the case where I have a function-key-map binding that
|>   turns C-x into C-c.  Clearly C-x C-c will stays as it is, but
|>   what about C-x w (which has no binding) ?
|> 
|>   Currently C-x w is left as is.  Should function-key-map remap it
|>   to C-c w ?

I don't think so, since C-x does have a binding (it is bound to a keymap).

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Precise behavior of function-key-map and friends
  2002-06-06  1:44 Precise behavior of function-key-map and friends Stefan Monnier
  2002-06-06  9:44 ` Andreas Schwab
@ 2002-06-07  0:45 ` Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2002-06-07  0:45 UTC (permalink / raw)
  Cc: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1995 bytes --]

    1 - The documentation says that function-key-map bindings only apply
      if there is no corresponding binding in the global map.

(Not just in the global map; in any active map.  Where does
the documentation say only the global map?)

      What about the case where I have a function-key-map binding that
      turns C-x into C-c.  Clearly C-x C-c will stays as it is, but
      what about C-x w (which has no binding) ?

      Currently C-x w is left as is.  Should function-key-map remap it
      to C-c w ?

No it should not.  C-x does have a binding, as a prefix key,
so function-key-map should not affect it.

    2 - key-translation-map says that the translation is always done, whether
      or not it has a binding in the normal maps.
      Among other things, this means that when you hit C-x 8 it will
      keep reading input because there's a chance that it will end up
      in a sequence of keys that can be translated by key-translation-map.
      So you can hit C-c C-x 8 ' e to enter the (unbound) C-c é key sequence.
      But note that C-x C-x 8 ' e does not work, because C-x C-x is bound
      and read-key-sequence will not keep reading input in this case.

We clearly do not want to change the behavior of C-x C-x.  It might be
ok to change the behavior of C-c C-x in regard to key-translation-map.
However, that behavior in the case of function-key-map is vital
for C-x F1 to work.

So I think you should not change any of this.

    3 - function-key-map applies only if the current key-sequence has
      no binding in the normal maps.  But since key-translation-map
      is applied unconditionally afterwards, the "has a binding" condition
      is not easy to decide (and is done incorrectly).

There is no need to define "correctly" to take account of
key-translation-map in this way.  In theory, it is a higher level of
"correct", but I doubt it ever matters to anyone in practice.  I
wouldn't spend five minutes trying to make this more abstractly
correct.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-06-07  0:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-06  1:44 Precise behavior of function-key-map and friends Stefan Monnier
2002-06-06  9:44 ` Andreas Schwab
2002-06-07  0:45 ` Richard Stallman

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).