unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* define key with "\s-" super modifier in string?
@ 2005-12-07 19:27 Jan Nieuwenhuizen
  2005-12-07 22:57 ` Stefan Monnier
  2005-12-08  4:54 ` Richard M. Stallman
  0 siblings, 2 replies; 10+ messages in thread
From: Jan Nieuwenhuizen @ 2005-12-07 19:27 UTC (permalink / raw)
  Cc: epronk


With CVS emacs, I get

    (global-set-key "\s-n" 'compile)

    Debugger entered--Lisp error: (error "Key sequence SPC - n uses invalid prefix characters")
    ...

Is this a bug?

I can understand what sort of thing happens, and

    (global-set-key [?\s-n] 'compile)

works, but it isn't very friendly eps. as the documentation has
examples using strings, eg

     (global-set-key "\C-z" 'shell)

The documentation mentions exceptions, but does not include \s

       When the key sequence includes function keys or mouse button
   events, or non-ASCII characters such as `C-=' or `H-a', you must
   use the more general method of rebinding, which uses a vector to
   specify the key sequence.

Jan.

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org

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

* Re: define key with "\s-" super modifier in string?
  2005-12-07 19:27 define key with "\s-" super modifier in string? Jan Nieuwenhuizen
@ 2005-12-07 22:57 ` Stefan Monnier
  2005-12-08  4:54 ` Richard M. Stallman
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2005-12-07 22:57 UTC (permalink / raw)
  Cc: epronk, emacs-devel

> With CVS emacs, I get
>     (global-set-key "\s-n" 'compile)

This has never worked.
Strings can only hold chars, not chars-with-modifiers (except for ASCII
chars with a meta modifier, and for ASCII control chars (i.e. chars 64-95
with a control modifier) for historical reasons).


        Stefan

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

* Re: define key with "\s-" super modifier in string?
  2005-12-07 19:27 define key with "\s-" super modifier in string? Jan Nieuwenhuizen
  2005-12-07 22:57 ` Stefan Monnier
@ 2005-12-08  4:54 ` Richard M. Stallman
  2005-12-08 14:59   ` Kim F. Storm
                     ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Richard M. Stallman @ 2005-12-08  4:54 UTC (permalink / raw)
  Cc: epronk, emacs-devel

	(global-set-key "\s-n" 'compile)

	Debugger entered--Lisp error: (error "Key sequence SPC - n uses invalid prefix characters")
	...

    Is this a bug?

It is correct to signal an error, because you can't put a super-char
in a string.

Maybe the error message should say that more specifically.

    works, but it isn't very friendly eps. as the documentation has
    examples using strings, eg

	 (global-set-key "\C-z" 'shell)

The manual explains using vectors for this.
Would you please be more precise than "the documentation"?
Where precisely are you talking about?

    The documentation mentions exceptions, but does not include \s

	   When the key sequence includes function keys or mouse button
       events, or non-ASCII characters such as `C-=' or `H-a', you must
       use the more general method of rebinding, which uses a vector to
       specify the key sequence.

It does not say this is a complete list of non-ASCII characters, so
why are you surprised that there are others?

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

* Re: define key with "\s-" super modifier in string?
  2005-12-08  4:54 ` Richard M. Stallman
@ 2005-12-08 14:59   ` Kim F. Storm
  2005-12-08 19:12   ` Jan Nieuwenhuizen
  2005-12-08 19:29   ` Richard M. Stallman
  2 siblings, 0 replies; 10+ messages in thread
From: Kim F. Storm @ 2005-12-08 14:59 UTC (permalink / raw)
  Cc: emacs-devel, epronk, Jan Nieuwenhuizen

"Richard M. Stallman" <rms@gnu.org> writes:

> 	(global-set-key "\s-n" 'compile)
>
> 	Debugger entered--Lisp error: (error "Key sequence SPC - n uses invalid prefix characters")
> 	...
>
>     Is this a bug?
>
> It is correct to signal an error, because you can't put a super-char
> in a string.

It isn't complaining about super modifier here.

In a string, \s means SPC, so the error (correctly) states that
SPC cannot be used as a prefix key in global-map.

> Maybe the error message should say that more specifically.

It would have to look for [SPC minus] in the string to guess that the user
probably tried to bind the super modifier...  That's just too obscure IMO. 

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: define key with "\s-" super modifier in string?
  2005-12-08  4:54 ` Richard M. Stallman
  2005-12-08 14:59   ` Kim F. Storm
@ 2005-12-08 19:12   ` Jan Nieuwenhuizen
  2005-12-09  1:42     ` Richard M. Stallman
  2005-12-08 19:29   ` Richard M. Stallman
  2 siblings, 1 reply; 10+ messages in thread
From: Jan Nieuwenhuizen @ 2005-12-08 19:12 UTC (permalink / raw)


Richard M. Stallman writes:

> Would you please be more precise than "the documentation"?

My mistake.  I was not really reading carefully but only browsing
Node: Init rebinding.

The first example shows

     (global-set-key "\C-z" 'shell)

which is correct, but I wonder why [the first few] examples would
show to use a string, something that only works for some cases.

Reading the documentation in full, it states quite clearly that only
ascii and meta work.  The first few examples that show vectors,
however, do not show or mention the super modifier.

Jan.

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org

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

* Re: define key with "\s-" super modifier in string?
  2005-12-08  4:54 ` Richard M. Stallman
  2005-12-08 14:59   ` Kim F. Storm
  2005-12-08 19:12   ` Jan Nieuwenhuizen
@ 2005-12-08 19:29   ` Richard M. Stallman
  2005-12-08 22:16     ` Stefan Monnier
  2 siblings, 1 reply; 10+ messages in thread
From: Richard M. Stallman @ 2005-12-08 19:29 UTC (permalink / raw)
  Cc: emacs-devel, epronk, janneke

	    (global-set-key "\s-n" 'compile)

	    Debugger entered--Lisp error: (error "Key sequence SPC - n uses invalid prefix characters")
	    ...

The presence of SPC in the error message is certainly a bug.

The main purpose of \s for space is for character constants.
So it seems to be a mistake to treat \s as space in string constants
even when followed by dash.  It should get an error at read time.
I made a change to do that.

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

* Re: define key with "\s-" super modifier in string?
  2005-12-08 19:29   ` Richard M. Stallman
@ 2005-12-08 22:16     ` Stefan Monnier
  2005-12-09  9:06       ` Kim F. Storm
  2005-12-09 15:02       ` Richard M. Stallman
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2005-12-08 22:16 UTC (permalink / raw)
  Cc: janneke, epronk, emacs-devel

> The presence of SPC in the error message is certainly a bug.

> The main purpose of \s for space is for character constants.
> So it seems to be a mistake to treat \s as space in string constants
> even when followed by dash.  It should get an error at read time.

This was discussed here a while back and the decision was made to also
consider \s in strings as a space.

> I made a change to do that.

You mean you've undone this change?  Please check the thread again, to see
why we ended up deciding that \s should be allowed in strings.


        Stefan

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

* Re: define key with "\s-" super modifier in string?
  2005-12-08 19:12   ` Jan Nieuwenhuizen
@ 2005-12-09  1:42     ` Richard M. Stallman
  0 siblings, 0 replies; 10+ messages in thread
From: Richard M. Stallman @ 2005-12-09  1:42 UTC (permalink / raw)
  Cc: epronk, emacs-devel

    Reading the documentation in full, it states quite clearly that only
    ascii and meta work.  The first few examples that show vectors,
    however, do not show or mention the super modifier.

There are so many modifiers.  It would be wasteful and redundant
to give an example for each of them.  I think people should be
able to understand the existing text, once they read it.

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

* Re: define key with "\s-" super modifier in string?
  2005-12-08 22:16     ` Stefan Monnier
@ 2005-12-09  9:06       ` Kim F. Storm
  2005-12-09 15:02       ` Richard M. Stallman
  1 sibling, 0 replies; 10+ messages in thread
From: Kim F. Storm @ 2005-12-09  9:06 UTC (permalink / raw)
  Cc: emacs-devel, rms, epronk, janneke

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> The presence of SPC in the error message is certainly a bug.
>
>> The main purpose of \s for space is for character constants.
>> So it seems to be a mistake to treat \s as space in string constants
>> even when followed by dash.  It should get an error at read time.
>
> This was discussed here a while back and the decision was made to also
> consider \s in strings as a space.
>
>> I made a change to do that.
>
> You mean you've undone this change?  Please check the thread again, to see
> why we ended up deciding that \s should be allowed in strings.

Note that \s still gives as a space in strings EXCEPT with followed by a hyphen.

I.e. "\sX" => " X", while "\s-X" signals an error.

Given the recent example of trying to bind super-X with a string arg
to define-key I agree with Richard's change.


-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: define key with "\s-" super modifier in string?
  2005-12-08 22:16     ` Stefan Monnier
  2005-12-09  9:06       ` Kim F. Storm
@ 2005-12-09 15:02       ` Richard M. Stallman
  1 sibling, 0 replies; 10+ messages in thread
From: Richard M. Stallman @ 2005-12-09 15:02 UTC (permalink / raw)
  Cc: janneke, epronk, emacs-devel

    You mean you've undone this change?

I am not sure precisely which change you mean.  But you can see the
change I just installed.

      Please check the thread again, to see
    why we ended up deciding that \s should be allowed in strings.

I can't even FIND that past discussion, because searching for it
would take a lot of time.  More than I can spare.

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

end of thread, other threads:[~2005-12-09 15:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-07 19:27 define key with "\s-" super modifier in string? Jan Nieuwenhuizen
2005-12-07 22:57 ` Stefan Monnier
2005-12-08  4:54 ` Richard M. Stallman
2005-12-08 14:59   ` Kim F. Storm
2005-12-08 19:12   ` Jan Nieuwenhuizen
2005-12-09  1:42     ` Richard M. Stallman
2005-12-08 19:29   ` Richard M. Stallman
2005-12-08 22:16     ` Stefan Monnier
2005-12-09  9:06       ` Kim F. Storm
2005-12-09 15:02       ` Richard M. 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).