unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
@ 2007-01-04  1:21 Lennart Borgman (gmail)
  2007-01-04 17:58 ` Richard Stallman
  0 siblings, 1 reply; 17+ messages in thread
From: Lennart Borgman (gmail) @ 2007-01-04  1:21 UTC (permalink / raw)


If you do

  (global-set-key [M-DEL] nil)

you get the error in the subject line. It looks like Emacs know what I 
want, but just does not do it. I simply do not understand and I guess 
most users will not either. Perhaps the message can be made a bit more 
clear?

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-04  1:21 What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL" Lennart Borgman (gmail)
@ 2007-01-04 17:58 ` Richard Stallman
  2007-01-04 18:19   ` Drew Adams
                     ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Richard Stallman @ 2007-01-04 17:58 UTC (permalink / raw)
  Cc: emacs-devel

    If you do

      (global-set-key [M-DEL] nil)

    you get the error in the subject line.

DEL is not a meaningful function key since function key symbols are
lower case.  So this has to be an error.

At the Lisp level it is better to teach Lisp programmers the correct
rules than to try to DWIM.

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

* RE: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-04 17:58 ` Richard Stallman
@ 2007-01-04 18:19   ` Drew Adams
  2007-01-04 18:46   ` Lennart Borgman (gmail)
  2007-01-05  7:18   ` Stephen Leake
  2 siblings, 0 replies; 17+ messages in thread
From: Drew Adams @ 2007-01-04 18:19 UTC (permalink / raw)


>     If you do
>
>       (global-set-key [M-DEL] nil)
>
>     you get the error in the subject line.
>
> DEL is not a meaningful function key since function key symbols are
> lower case.  So this has to be an error.

Please say that in the error message. Without it, the message doesn't teach
much.

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-04 17:58 ` Richard Stallman
  2007-01-04 18:19   ` Drew Adams
@ 2007-01-04 18:46   ` Lennart Borgman (gmail)
  2007-01-04 18:53     ` Andreas Schwab
                       ` (2 more replies)
  2007-01-05  7:18   ` Stephen Leake
  2 siblings, 3 replies; 17+ messages in thread
From: Lennart Borgman (gmail) @ 2007-01-04 18:46 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman wrote:
>     If you do
>
>       (global-set-key [M-DEL] nil)
>
>     you get the error in the subject line.
>
> DEL is not a meaningful function key since function key symbols are
> lower case.  So this has to be an error.
>   

The error message could have said this of course, but it is not the 
whole story.

> At the Lisp level it is better to teach Lisp programmers the correct
> rules than to try to DWIM.
>   

When I do

   C-h k Meta backspace

on w32 the help buffer tells me

    M-DEL (translated from <M-backspace>) runs the command 
backward-kill-word
      which is an interactive compiled Lisp function in `simple.el'.
    It is bound to <C-backspace>, M-DEL.


Would it not be better if the error message we are talking about told me 
to bind [M-backspace] instead?

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-04 18:46   ` Lennart Borgman (gmail)
@ 2007-01-04 18:53     ` Andreas Schwab
  2007-01-04 19:04       ` Lennart Borgman (gmail)
  2007-01-04 19:28     ` Edward O'Connor
  2007-01-05  0:31     ` Richard Stallman
  2 siblings, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2007-01-04 18:53 UTC (permalink / raw)
  Cc: rms, emacs-devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

> Would it not be better if the error message we are talking about told me
> to bind [M-backspace] instead?

That key does not exist on a tty frame.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-04 18:53     ` Andreas Schwab
@ 2007-01-04 19:04       ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 17+ messages in thread
From: Lennart Borgman (gmail) @ 2007-01-04 19:04 UTC (permalink / raw)
  Cc: rms, emacs-devel

Andreas Schwab wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>
>   
>> Would it not be better if the error message we are talking about told me
>> to bind [M-backspace] instead?
>>     
>
> That key does not exist on a tty frame.
>
> Andreas.
>   

Thanks, I did not know. However that can not be the reason to tell me to 
bind "\M\d" here because I can without trouble gind [M-backspace].

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-04 19:28     ` Edward O'Connor
@ 2007-01-04 19:28       ` Lennart Borgman (gmail)
  2007-01-04 20:02         ` Andreas Schwab
  0 siblings, 1 reply; 17+ messages in thread
From: Lennart Borgman (gmail) @ 2007-01-04 19:28 UTC (permalink / raw)
  Cc: emacs-devel

Edward O'Connor wrote:
>> When I do
>>
>> C-h k Meta backspace
>>
>> on w32 the help buffer tells me
>>
>> M-DEL (translated from <M-backspace>) runs the command
>> backward-kill-word
>> which is an interactive compiled Lisp function in `simple.el'.
>> It is bound to <C-backspace>, M-DEL.
>>
>> Would it not be better if the error message we are talking about told
>> me to bind [M-backspace] instead?
>>     
>
> Personally, I think this is a great argument for (kbd "M-DEL").
>
>
> Ted
>   

Which actually works, yes. But isn't there a point in telling about 
M-backspace instead since M-DEL is made in the platform specific 
translation in function-key-map?

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-04 18:46   ` Lennart Borgman (gmail)
  2007-01-04 18:53     ` Andreas Schwab
@ 2007-01-04 19:28     ` Edward O'Connor
  2007-01-04 19:28       ` Lennart Borgman (gmail)
  2007-01-05  0:31     ` Richard Stallman
  2 siblings, 1 reply; 17+ messages in thread
From: Edward O'Connor @ 2007-01-04 19:28 UTC (permalink / raw)


> When I do
>
> C-h k Meta backspace
>
> on w32 the help buffer tells me
>
> M-DEL (translated from <M-backspace>) runs the command
> backward-kill-word
> which is an interactive compiled Lisp function in `simple.el'.
> It is bound to <C-backspace>, M-DEL.
>
> Would it not be better if the error message we are talking about told
> me to bind [M-backspace] instead?

Personally, I think this is a great argument for (kbd "M-DEL").


Ted

-- 
Edward O'Connor
hober0@gmail.com

Ense petit placidam sub libertate quietem.

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-04 19:28       ` Lennart Borgman (gmail)
@ 2007-01-04 20:02         ` Andreas Schwab
  2007-01-05  0:26           ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2007-01-04 20:02 UTC (permalink / raw)
  Cc: Edward O'Connor, emacs-devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

> Which actually works, yes. But isn't there a point in telling about
> M-backspace instead since M-DEL is made in the platform specific
> translation in function-key-map?

No, M-DEL is the canonical key.  Anthing defined via function-key-map is
non-canonical.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-04 20:02         ` Andreas Schwab
@ 2007-01-05  0:26           ` Lennart Borgman (gmail)
  2007-01-05  9:49             ` Andreas Schwab
  2007-01-05 19:09             ` Richard Stallman
  0 siblings, 2 replies; 17+ messages in thread
From: Lennart Borgman (gmail) @ 2007-01-05  0:26 UTC (permalink / raw)
  Cc: Edward O'Connor, emacs-devel

Andreas Schwab wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>
>   
>> Which actually works, yes. But isn't there a point in telling about
>> M-backspace instead since M-DEL is made in the platform specific
>> translation in function-key-map?
>>     
>
> No, M-DEL is the canonical key.  Anthing defined via function-key-map is
> non-canonical.
>   

Ah, thanks. That means my latest patch for the tutorial is wrong AFAICS 
now - so please do not install that - yet.

I had to consult Webster to see what canonical really means ....

Now let me see if I understand this... - here is then another question 
around this:

As I understand it now the preferable way to define a key is (of course) 
always to use a canonical representation. Maybe it even can not be done 
in any other way?

But then I do not understand the use of M-backspace. In pc-mode.el 
M-backspace is used for keybinding. Works ok on w32 and I guess on other 
platforms too? But backward-kill-word is not bound to M-backspace 
directly on w32, but instead through function-key-map. Why is it so? 
Where is backward-kill-word on other systems? What does C-h w give? What 
does M-backspace do on other systems?

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-04 18:46   ` Lennart Borgman (gmail)
  2007-01-04 18:53     ` Andreas Schwab
  2007-01-04 19:28     ` Edward O'Connor
@ 2007-01-05  0:31     ` Richard Stallman
  2 siblings, 0 replies; 17+ messages in thread
From: Richard Stallman @ 2007-01-05  0:31 UTC (permalink / raw)
  Cc: emacs-devel

	M-DEL (translated from <M-backspace>) runs the command 
    backward-kill-word
	  which is an interactive compiled Lisp function in `simple.el'.
	It is bound to <C-backspace>, M-DEL.


    Would it not be better if the error message we are talking about told me 
    to bind [M-backspace] instead?

Binding M-backspace is NOT the right way to handle this.  You should
bind the character M-DEL.  However that's a character, not a function
key, so you don't write it as [M-DEL] in Lisp.

This is not a simple subject, and I don't think an error message can
explain it all.  What maybe it could do is refer to a node in the Lisp
manual.

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-04 17:58 ` Richard Stallman
  2007-01-04 18:19   ` Drew Adams
  2007-01-04 18:46   ` Lennart Borgman (gmail)
@ 2007-01-05  7:18   ` Stephen Leake
  2007-01-05  9:11     ` Lennart Borgman (gmail)
  2007-01-06  2:54     ` Richard Stallman
  2 siblings, 2 replies; 17+ messages in thread
From: Stephen Leake @ 2007-01-05  7:18 UTC (permalink / raw)
  Cc: Lennart Borgman (gmail), emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     If you do
>
>       (global-set-key [M-DEL] nil)
>
>     you get the error in the subject line.
>
> DEL is not a meaningful function key since function key symbols are
> lower case.  So this has to be an error.
>
> At the Lisp level it is better to teach Lisp programmers the correct
> rules than to try to DWIM.

(global-set-key [M-del] nil)

works, and you seem to imply that is the correct syntax, or at least
acceptable syntax.

perhaps the error message should suggest "M-del" instead of "\M\d"?

Also, all references to M-del in the various help messages quoted in
this thread are "M-DEL"; should they be "M-del" instead? Or "\M\d"?

-- 
-- Stephe

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-05  7:18   ` Stephen Leake
@ 2007-01-05  9:11     ` Lennart Borgman (gmail)
  2007-01-06  2:54     ` Richard Stallman
  1 sibling, 0 replies; 17+ messages in thread
From: Lennart Borgman (gmail) @ 2007-01-05  9:11 UTC (permalink / raw)
  Cc: rms, emacs-devel

Stephen Leake wrote:
> Richard Stallman <rms@gnu.org> writes:
>
>   
>>     If you do
>>
>>       (global-set-key [M-DEL] nil)
>>
>>     you get the error in the subject line.
>>
>> DEL is not a meaningful function key since function key symbols are
>> lower case.  So this has to be an error.
>>
>> At the Lisp level it is better to teach Lisp programmers the correct
>> rules than to try to DWIM.
>>     
>
> (global-set-key [M-del] nil)
>
> works, and you seem to imply that is the correct syntax, or at least
> acceptable syntax.
>   

This is very confusing. Did you actually try if the binding work? I get 
no error message with this variant, but the binding is not on the key we 
are talking about AFAICS.

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-05  0:26           ` Lennart Borgman (gmail)
@ 2007-01-05  9:49             ` Andreas Schwab
  2007-01-05  9:57               ` Lennart Borgman (gmail)
  2007-01-05 19:09             ` Richard Stallman
  1 sibling, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2007-01-05  9:49 UTC (permalink / raw)
  Cc: Edward O'Connor, emacs-devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

> I had to consult Webster to see what canonical really means ....

See <http://catb.org/~esr/jargon/html/C/canonical.html>.

> Now let me see if I understand this... - here is then another question
> around this:
>
> As I understand it now the preferable way to define a key is (of course)
> always to use a canonical representation. Maybe it even can not be done in
> any other way?

The canonical representation is the one that works on most if not all
systems (with tty input normally being the most restrictive).  All other
representations of the key are supposed to be translated through
function-key-map.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-05  9:49             ` Andreas Schwab
@ 2007-01-05  9:57               ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 17+ messages in thread
From: Lennart Borgman (gmail) @ 2007-01-05  9:57 UTC (permalink / raw)
  Cc: Edward O'Connor, emacs-devel

Andreas Schwab wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>
>   
>> I had to consult Webster to see what canonical really means ....
>>     
>
> See <http://catb.org/~esr/jargon/html/C/canonical.html>.
>   

Thanks ;-)

>   
>> Now let me see if I understand this... - here is then another question
>> around this:
>>
>> As I understand it now the preferable way to define a key is (of course)
>> always to use a canonical representation. Maybe it even can not be done in
>> any other way?
>>     
>
> The canonical representation is the one that works on most if not all
> systems (with tty input normally being the most restrictive).  All other
> representations of the key are supposed to be translated through
> function-key-map.
>   

But then there are string representations too.

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-05  0:26           ` Lennart Borgman (gmail)
  2007-01-05  9:49             ` Andreas Schwab
@ 2007-01-05 19:09             ` Richard Stallman
  1 sibling, 0 replies; 17+ messages in thread
From: Richard Stallman @ 2007-01-05 19:09 UTC (permalink / raw)
  Cc: schwab, hober0, emacs-devel

M-backspace is the raw key that Emacs gets from a window system.
It stands for the `backspace' key with Meta held down.

M-DEL is the canonical key for DEL with Meta held down.

Therefore, M-backspace translates into M-DEL.  But there are other
ways for M-DEL to be generated.  Any Lisp program that wants to be
general should not do anything with M-backspace.

Maybe pc-mode.el does not want to be general.  But let's not worry
about it.  For present purposes, M-backspace is part of a low-level
mechanism that you should not look inside.  Just forget it exists.

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

* Re: What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL"
  2007-01-05  7:18   ` Stephen Leake
  2007-01-05  9:11     ` Lennart Borgman (gmail)
@ 2007-01-06  2:54     ` Richard Stallman
  1 sibling, 0 replies; 17+ messages in thread
From: Richard Stallman @ 2007-01-06  2:54 UTC (permalink / raw)
  Cc: lennart.borgman, emacs-devel

    (global-set-key [M-del] nil)

    works, and you seem to imply that is the correct syntax, or at least
    acceptable syntax.

That would be correct syntax for rebinding a function key named `del'.
But I don't think keyboards normally generate such a key.

\M-\d is what you should use.

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

end of thread, other threads:[~2007-01-06  2:54 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-04  1:21 What is the purpose of "To bind the key M-DEL, use "\M\d", not M-DEL" Lennart Borgman (gmail)
2007-01-04 17:58 ` Richard Stallman
2007-01-04 18:19   ` Drew Adams
2007-01-04 18:46   ` Lennart Borgman (gmail)
2007-01-04 18:53     ` Andreas Schwab
2007-01-04 19:04       ` Lennart Borgman (gmail)
2007-01-04 19:28     ` Edward O'Connor
2007-01-04 19:28       ` Lennart Borgman (gmail)
2007-01-04 20:02         ` Andreas Schwab
2007-01-05  0:26           ` Lennart Borgman (gmail)
2007-01-05  9:49             ` Andreas Schwab
2007-01-05  9:57               ` Lennart Borgman (gmail)
2007-01-05 19:09             ` Richard Stallman
2007-01-05  0:31     ` Richard Stallman
2007-01-05  7:18   ` Stephen Leake
2007-01-05  9:11     ` Lennart Borgman (gmail)
2007-01-06  2:54     ` 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).