unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Modifier keys in Carbon Emacs
@ 2004-09-16 21:19 Doug Alcorn
  2004-09-16 23:07 ` Steven Tamm
  2004-09-17  0:20 ` Denis Bueno
  0 siblings, 2 replies; 9+ messages in thread
From: Doug Alcorn @ 2004-09-16 21:19 UTC (permalink / raw)


I had complained briefly in another thread about certain non-mac-ness
of the carbon port of emacs.  I think I can boil all of it down to how
modifier keys are handled.  I know about mac-command-key-is-meta and
mac-pass-*-to-system.  What I can't decide is how to best use them.

On the one hand (as a new mac user) I'm trying to get used to all the
Cmd-X keyboard shortcuts.  On the other hand (as a recent Linux user)
I'm used to Alt being Meta and being immediately next to the space
bar.  Leaving mac-command-key-is-meta set as t means that I won't be
able to use Cmd-tab to switch apps.  If I set
mac-pass-command-to-system it means emacs will have a much reduced
keymapping.

I guess ideally I'd like to set mac-command-key-is-meta to nil so that
Alt/Option is Meta; however, I'd also like to have some new variable
mac-command-key-is-hyper that I can set t and then
mac-pass-command-key-to-system t.  That way I can have all my
"standard" emacs keys mapped to meta and also use Cmd to map other
commands. For instance I could map H-` to other-frame and H-m to
iconify-frame among other things.

Anyway, I'd appreciate advice on the best way to handle modifier keys
so that I can keep both standard emacs bindings and standard mac
bindings.
-- 
 (__) Doug Alcorn - Unix/Linux/Web Developing
 oo /  mailto:lathinet@gmail.com http://www.lathi.net
 |_/

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

* Re: Modifier keys in Carbon Emacs
  2004-09-16 21:19 Modifier keys in Carbon Emacs Doug Alcorn
@ 2004-09-16 23:07 ` Steven Tamm
  2004-09-17 13:52   ` Doug Alcorn
                     ` (2 more replies)
  2004-09-17  0:20 ` Denis Bueno
  1 sibling, 3 replies; 9+ messages in thread
From: Steven Tamm @ 2004-09-16 23:07 UTC (permalink / raw)
  Cc: emacs-devel

All of the various key-mappings variables are hacks: Since I did most of them, I take the blame.

In the short term, if you want to get something working for you, I would suggest modifying mac_to_emacs_modifiers in src/macterm.c to do what you need.  Something like

  if (NILP (Vmac_command_key_is_hyper) && (mods & cmdKey))
    result |= hyper_modifier;

In the long term, some work should be done to do xmodmap type modifier translation: i.e. provide the ability to map all the mac modifier keys (Cmd,Alt,Ctrl,Fn) to the emacs modifiers (C,M,A,H) or to system modifiers.  What would be the best way to represent this?

-Steven

On Thursday, September 16, 2004, at 02:22PM, Doug Alcorn <lathinet@gmail.com> wrote:

>I had complained briefly in another thread about certain non-mac-ness
>of the carbon port of emacs.  I think I can boil all of it down to how
>modifier keys are handled.  I know about mac-command-key-is-meta and
>mac-pass-*-to-system.  What I can't decide is how to best use them.
>
>On the one hand (as a new mac user) I'm trying to get used to all the
>Cmd-X keyboard shortcuts.  On the other hand (as a recent Linux user)
>I'm used to Alt being Meta and being immediately next to the space
>bar.  Leaving mac-command-key-is-meta set as t means that I won't be
>able to use Cmd-tab to switch apps.  If I set
>mac-pass-command-to-system it means emacs will have a much reduced
>keymapping.
>
>I guess ideally I'd like to set mac-command-key-is-meta to nil so that
>Alt/Option is Meta; however, I'd also like to have some new variable
>mac-command-key-is-hyper that I can set t and then
>mac-pass-command-key-to-system t.  That way I can have all my
>"standard" emacs keys mapped to meta and also use Cmd to map other
>commands. For instance I could map H-` to other-frame and H-m to
>iconify-frame among other things.
>
>Anyway, I'd appreciate advice on the best way to handle modifier keys
>so that I can keep both standard emacs bindings and standard mac
>bindings.
>-- 
> (__) Doug Alcorn - Unix/Linux/Web Developing
> oo /  mailto:lathinet@gmail.com http://www.lathi.net
> |_/
>
>
>_______________________________________________
>Emacs-devel mailing list
>Emacs-devel@gnu.org
>http://lists.gnu.org/mailman/listinfo/emacs-devel
>
>

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

* Re: Modifier keys in Carbon Emacs
  2004-09-16 21:19 Modifier keys in Carbon Emacs Doug Alcorn
  2004-09-16 23:07 ` Steven Tamm
@ 2004-09-17  0:20 ` Denis Bueno
  1 sibling, 0 replies; 9+ messages in thread
From: Denis Bueno @ 2004-09-17  0:20 UTC (permalink / raw)
  Cc: emacs-devel


On 16 Sep 2004, at 17.19, Doug Alcorn wrote:

> I had complained briefly in another thread about certain non-mac-ness
> of the carbon port of emacs.  I think I can boil all of it down to how
> modifier keys are handled.  I know about mac-command-key-is-meta and
> mac-pass-*-to-system.  What I can't decide is how to best use them.
>
> On the one hand (as a new mac user) I'm trying to get used to all the
> Cmd-X keyboard shortcuts.  On the other hand (as a recent Linux user)
> I'm used to Alt being Meta and being immediately next to the space
> bar.  Leaving mac-command-key-is-meta set as t means that I won't be
> able to use Cmd-tab to switch apps.

I am using Carbon Emacs (GNU Emacs 21.3.50.1 
(powerpc-apple-darwin7.3.0) of 2004-04-17 on Taggart.local) on Panther 
10.3.5 and I have mac-command-key-is-meta set to t: but I can still 
Command-Tab between applications, when Emacs has the focus. Is this not 
the intended behavior? (mac-pass-control-to-system and 
mac-pass-command-to-system are both t.)

I'm also using a Happy Hacking Lite keyboard 
(http://shop.store.yahoo.com/pfuca-store/haphackeylit1.html), with the 
DIP switches set such that the diamond-shaped key (located where Cmd 
would be on a Mac keyboard) acts like Alt, and Alt (where Option would 
be on a Mac keyboard) acts like Option. So hitting Diamond-Q right now 
would quit Mail. Does this make any difference?

> <snip>

--
Denis Bueno
PGP: http://pgp.mit.edu:11371/pks/lookup?search=0xA1B51B4B&op=index
"Acquaintance, n.: A person whom we know well enough to borrow from, 
but not well enough to lend to." - Ambrose Bierce

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

* Re: Modifier keys in Carbon Emacs
  2004-09-16 23:07 ` Steven Tamm
@ 2004-09-17 13:52   ` Doug Alcorn
  2004-09-17 14:16   ` Doug Alcorn
  2004-09-17 16:21   ` Doug Alcorn
  2 siblings, 0 replies; 9+ messages in thread
From: Doug Alcorn @ 2004-09-17 13:52 UTC (permalink / raw)


On Thu, 16 Sep 2004 16:07:20 -0700, Steven Tamm <steventamm@mac.com> wrote:
> In the short term, if you want to get something working for you, I would suggest modifying mac_to_emacs_modifiers in src/macterm.c to do what you need.  Something like
> 
>   if (NILP (Vmac_command_key_is_hyper) && (mods & cmdKey))
>     result |= hyper_modifier;

This is cool.  Thanks for this "patch".

> 
> In the long term, some work should be done to do xmodmap type modifier translation: i.e. provide the ability to map all the mac modifier keys (Cmd,Alt,Ctrl,Fn) to the emacs modifiers (C,M,A,H) or to system modifiers.  What would be the best way to represent this?

Would the mac equivalent of xmodmap be uControl?  http://gnufoo.org/ucontrol
-- 
 (__) Doug Alcorn - Unix/Linux/Web Developing
 oo /  mailto:lathinet@gmail.com http://www.lathi.net
 |_/

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

* Re: Modifier keys in Carbon Emacs
  2004-09-16 23:07 ` Steven Tamm
  2004-09-17 13:52   ` Doug Alcorn
@ 2004-09-17 14:16   ` Doug Alcorn
  2004-09-17 16:21   ` Doug Alcorn
  2 siblings, 0 replies; 9+ messages in thread
From: Doug Alcorn @ 2004-09-17 14:16 UTC (permalink / raw)


On Thu, 16 Sep 2004 16:07:20 -0700, Steven Tamm <steventamm@mac.com> wrote:
> In the short term, if you want to get something working for you, I would suggest modifying mac_to_emacs_modifiers in src/macterm.c to do what you need.  Something like
> 
>   if (NILP (Vmac_command_key_is_hyper) && (mods & cmdKey))
>     result |= hyper_modifier;
> 

I'm actually looking through the src/macterm.c code now.  Could you
give me a simple walk-through of how key events are handled?  Where's
the entry point and what's the flow through the code?  Is that too
much to ask?  I'm a fair C programmer, but completely new to the emacs
internals.

-- 
 (__) Doug Alcorn - Unix/Linux/Web Developing
 oo /  mailto:lathinet@gmail.com http://www.lathi.net
 |_/

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

* Re: Modifier keys in Carbon Emacs
  2004-09-16 23:07 ` Steven Tamm
  2004-09-17 13:52   ` Doug Alcorn
  2004-09-17 14:16   ` Doug Alcorn
@ 2004-09-17 16:21   ` Doug Alcorn
  2004-09-18  8:05     ` YAMAMOTO Mitsuharu
  2 siblings, 1 reply; 9+ messages in thread
From: Doug Alcorn @ 2004-09-17 16:21 UTC (permalink / raw)


On Thu, 16 Sep 2004 16:07:20 -0700, Steven Tamm <steventamm@mac.com> wrote:

> In the long term, some work should be done to do xmodmap type modifier translation: i.e. provide the ability to map all the mac modifier keys (Cmd,Alt,Ctrl,Fn) to the emacs modifiers (C,M,A,H) or to system modifiers.  What would be the best way to represent this?


>From a user perspective what about implementing something that allowed:

(setq mac-command-key-is 'hyper
          mac-option-key-is 'meta
          mac-control-key-is 'control
          mac-function-key-is 'alt)

Couldn't that implementation be done in src/macterm.c:mac_to_emacs_modifiers?

I agree (after thinking a bit more) that uControl isn't the right
place to handle this.  The only app we want to change the modifiers
for is emacs.  So, it seems like the translation needs to be done in
emacs.

-- 
 (__) Doug Alcorn - Unix/Linux/Web Developing
 oo /  mailto:lathinet@gmail.com http://www.lathi.net
 |_/

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

* Re: Modifier keys in Carbon Emacs
  2004-09-17 16:21   ` Doug Alcorn
@ 2004-09-18  8:05     ` YAMAMOTO Mitsuharu
  2004-09-18  9:55       ` Kai Grossjohann
  2004-09-18 11:45       ` Gian Uberto Lauri
  0 siblings, 2 replies; 9+ messages in thread
From: YAMAMOTO Mitsuharu @ 2004-09-18  8:05 UTC (permalink / raw)


>>>>> On Fri, 17 Sep 2004 12:21:39 -0400, Doug Alcorn <lathinet@gmail.com> said:

> (setq mac-command-key-is 'hyper
>       mac-option-key-is 'meta
>       mac-control-key-is 'control
>       mac-function-key-is 'alt)

Emacs on X11 has variables for modifier translation: x-alt-keysym,
x-meta-keysym, x-hyper-keysym, and x-super-keysym.  How about
following this convention?

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

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

* Re: Modifier keys in Carbon Emacs
  2004-09-18  8:05     ` YAMAMOTO Mitsuharu
@ 2004-09-18  9:55       ` Kai Grossjohann
  2004-09-18 11:45       ` Gian Uberto Lauri
  1 sibling, 0 replies; 9+ messages in thread
From: Kai Grossjohann @ 2004-09-18  9:55 UTC (permalink / raw)


YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

>>>>>> On Fri, 17 Sep 2004 12:21:39 -0400, Doug Alcorn <lathinet@gmail.com> said:
>
>> (setq mac-command-key-is 'hyper
>>       mac-option-key-is 'meta
>>       mac-control-key-is 'control
>>       mac-function-key-is 'alt)
>
> Emacs on X11 has variables for modifier translation: x-alt-keysym,
> x-meta-keysym, x-hyper-keysym, and x-super-keysym.  How about
> following this convention?

These variables are less than perfect.  I already forgot what the
problem is, but I do remember that someone sent a message about it and
I was convinced that he was right.

Hm.

Ah!  Perhaps you want two keys to be meta.  You can't do this with the
variable x-meta-keysym.  But you could set both mac-command-key-is and
mac-function-key-is to `meta'.  So the way Doug suggests is better.

I think that was the argument.

I think it would be good if the variables x-*-keysym were also
replaced with a similar mechanism.  I can't promise that I find the
time, though.

Kai

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

* Re: Modifier keys in Carbon Emacs
  2004-09-18  8:05     ` YAMAMOTO Mitsuharu
  2004-09-18  9:55       ` Kai Grossjohann
@ 2004-09-18 11:45       ` Gian Uberto Lauri
  1 sibling, 0 replies; 9+ messages in thread
From: Gian Uberto Lauri @ 2004-09-18 11:45 UTC (permalink / raw)
  Cc: emacs-devel

>>>>> "YM" == YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

>>>>> On Fri, 17 Sep 2004 12:21:39 -0400, Doug Alcorn <lathinet@gmail.com> said:
>> (setq mac-command-key-is 'hyper
>> mac-option-key-is 'meta
>> mac-control-key-is 'control
>> mac-function-key-is 'alt)

YM> Emacs on X11 has variables for modifier translation: x-alt-keysym,
YM> x-meta-keysym, x-hyper-keysym, and x-super-keysym.  How about
YM> following this convention?

I think it could be good, especially for those who use Emacs with
many OS.

-- 
 /\            ___
/___/\__|_|\_|__|___Gian Uberto Lauri_____________________
  //--\ | | \|  |   Integralista GNUslamico e fancazzista 
\/

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

end of thread, other threads:[~2004-09-18 11:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-16 21:19 Modifier keys in Carbon Emacs Doug Alcorn
2004-09-16 23:07 ` Steven Tamm
2004-09-17 13:52   ` Doug Alcorn
2004-09-17 14:16   ` Doug Alcorn
2004-09-17 16:21   ` Doug Alcorn
2004-09-18  8:05     ` YAMAMOTO Mitsuharu
2004-09-18  9:55       ` Kai Grossjohann
2004-09-18 11:45       ` Gian Uberto Lauri
2004-09-17  0:20 ` Denis Bueno

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