🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87358

Key binding anomalous behaviour

#87358
From: dajo
Date: Mon, 26 Sep 1994 14:47
49 lines
2777 bytes
The following is data on what seems to me to be a bug.  If anyone has useful
information I should like to receive it.  Please email me directly, since I am
not properly on the network and connot read news, etc.

dajo@gcal.ac.uk

The problem concerns key binding, normally which I do in a .emacs file.  I
think that the problem is independent of the actual function used (good!).  I
have tried variants to no avail, e.g., define-key, call-interactively, weird
strings such as "\A-\M-\40"; the following is a distillation of the problem.

(global-set-key  "\240"       'some-function)        ; works,
(global-set-key  [M-Space]    'some-function)        ; does not work,
(global-set-key  "\M- "       'some-function)        ; works,
(global-set-key  "\363"       'some-function)        ; works,
(global-set-key  "\M-s"       'some-function)        ; works,
(global-set-key  [M-s]        'some-function)        ; does not work.

So it appears that an inserted key binding works, (use C-qM-Space for \240,
C-qM-s for \363).  A string argument works, a vector does not.

However,

(global-set-key  [A-f5]       'some-function)
(global-set-key  [M-f5]       'some-function)
(global-set-key  [A-M-f5]     'some-function)        ; all work.


Examining the settings of what I want to do gives the right result:

(global-set-key  [A-Space]    'function-a-s)
(message  (format  "%s"  (lookup-key  (current-global-map)  [A-Space]))) 
(read-event)
(global-set-key  [M-Space]    'function-m-s)
(message  (format  "%s"  (lookup-key  (current-global-map)  [M-Space])))
(read-event)
(global-set-key  [A-M-Space]  'function-a-m-s)
(message  (format  "%s"  (lookup-key  (current-global-map)  [A-M-Space])))
(read-event)

so it appears that the keymap is being changed in such a way that lookup-key
understands it.

Finally, and interestingly, if run interactively, global-set-key sets the key
bindings, and they work.

So the net result is that I can bind to [M-Space] with code in my .emacs.  And
I can bind [A-Space] and [A-M-Space] interactively, which is what I do; but I
cannot write code to bind the latter two.
Technical Details
Message-ID: <21694.9409261432@gcal.ac.uk>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!glasgow-caledonian.ac.UK!dajo

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,a2b26cbe2b41351b,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-09-26 17:51:43 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!glasgow-caledonian.ac.UK!dajo
From: dajo@glasgow-caledonian.ac.UK (dajo)
Newsgroups: gnu.emacs.bug
Subject: Key binding anomalous behaviour
Date: 26 Sep 1994 10:47:31 -0400
Organization: GNUs Not Usenet
Lines: 49
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <21694.9409261432@gcal.ac.uk>