[OS X Emacs] Re: Binding the command key in current Emacs.app

Peter Dyballa Peter_Dyballa at Web.DE
Sat Nov 1 06:57:03 EDT 2008

Am 01.11.2008 um 01:10 schrieb Alex Payne:

> Does the "{" key need to be specified in some other way, or perhaps  
> escaped?

I don't know exactly! Already years ago I observed that quite a few  
such straight-forward settings did not work and it only worked to set:

	(global-set-key [C-s-268632070] 'forward-sexp)

which I also had in Solaris with GNU Emacs 21.x? To achieve this  
setting you'd need to bind the key first manually and then invoke  
repeat-last-command to kill the line from mini-buffer and insert it  
into .emacs, like:

	C-x Esc-Esc  C-a  C-k C-g  C-x C-f .emacs RET C-y C-x C-s

There is now a way or syntax to make key bindings clear and work:

	(global-set-key (kbd "C-©")	 'global-set-key)

and it does not always work in Emacs.app! © is no my German  
keyboard ⌥-G, which works in all Emacsen, the X clients with major- 
numbers 21…23, Carbon Emacs, and also Emacs.app. But binding the key  
C-© does *not* work in the latter, at least not from the user's init  
file. One problem I observed is that the number as in my first  
example is varying! (With the number of extra key bindings I add?  
Some numbers of key combinations are stable, OTOH ...)

On my German keyboard I cannot simply press s-} (it would be  
⌘⌥⇧-9). I tested your key binding by putting

	(global-set-key [(meta ?})]		'transpose-sexps)

in my .emacs file. s-} is already bound – try C-h b! When I then  
type C-h k Esc } I get the answer (shortened)

	transpose-sexps, bound to M-}, C-M-t.

In X11 and in Carbon Emacs M-} does not work, i.e., this key  
combination does not seem to produce an input event in GNU Emacsen.  
If you'd like to experiment with M-} or s-}, here are some  
combinations I tried for C-©:

	(global-set-key (kbd "C-©")	'global-set-key)
	(global-set-key [(control ?©)]	'global-set-key)
	(global-set-key [?\C-©]		'global-set-key)
	(global-set-key [C-©]		'global-set-key)
	(global-set-key [A-C-g]		'global-set-key)
	(global-set-key [(alt control ?g)]	'global-set-key)

which show the many ways to achieve a key binding. In X11 or Carbon  
Emacs C-h k C-© tells me about global-set-key:

	It is bound to C-©, <C-©>, <A-C-g>, A-C-g.

So some expressions are obviously equivalent, and all work, of  
course ... Actually, among the "Key translations" listed upon C-h b I  
have in Emacsp.app:

	A-C-g		global-set-key
	C-©		global-set-key
	<A-C-g>		global-set-key
	<C-©>		global-set-key

but I can't access or type or make function any!

Maybe we should submit some bug reports about key binding related  



There are three types of people in this world: those who can count,  
and those who cannot.

More information about the MacOSX-Emacs mailing list