emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Switch Meta and Alt modifiers


From: Kai Großjohann
Subject: Re: Switch Meta and Alt modifiers
Date: Sun, 27 Jan 2002 12:53:28 +0100
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2.50 (i686-pc-linux-gnu)

Richard Stallman <address@hidden> writes:

>     WIBNI the user could tell Emacs to swap the meanings of the Alt and
>     Meta modifier?
>
> If you can implement it in a simple clean way, I'd be glad to have
> it installed.

Here is a very simple-minded implementation.  Before installation
into Emacs, some changes are necessary: allow a command-line switch
in addition to an environment variable, and document the changes.

I would like to know: is this the right way to approach the issue?
On the pro side, it is very simple, and simple means good.  On the
con side, it is very specific to only the Meta and Alt modifiers, and
general solutions are better.

Thanks in advance for your help.

/----[ cvs diff src/xterm.c ]
| Index: src/xterm.c
| ===================================================================
| RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
| retrieving revision 1.702
| diff -u -r1.702 xterm.c
| --- src/xterm.c       16 Jan 2002 22:55:00 -0000      1.702
| +++ src/xterm.c       27 Jan 2002 11:52:39 -0000
| @@ -6321,12 +6321,17 @@
|    KeySym *syms;
|    int syms_per_code;
|    XModifierKeymap *mods;
| +  int swap_meta_alt = 0;
|  
|    dpyinfo->meta_mod_mask = 0;
|    dpyinfo->shift_lock_mask = 0;
|    dpyinfo->alt_mod_mask = 0;
|    dpyinfo->super_mod_mask = 0;
|    dpyinfo->hyper_mod_mask = 0;
| +  
| +  if (getenv("EMACS_SWAP_ALT_META")) {
| +      swap_meta_alt = 1;
| +  }      
|  
|  #ifdef HAVE_X11R4
|    XDisplayKeycodes (dpyinfo->display, &min_code, &max_code);
| @@ -6367,12 +6372,20 @@
|                 {
|                 case XK_Meta_L:
|                 case XK_Meta_R:
| -                 dpyinfo->meta_mod_mask |= (1 << row);
| +                    if (swap_meta_alt) {
| +                      dpyinfo->alt_mod_mask |= (1 << row);
| +                    } else {
| +                      dpyinfo->meta_mod_mask |= (1 << row);
| +                    }
|                   break;
|  
|                 case XK_Alt_L:
|                 case XK_Alt_R:
| -                 dpyinfo->alt_mod_mask |= (1 << row);
| +                    if (swap_meta_alt) {
| +                      dpyinfo->meta_mod_mask |= (1 << row);
| +                    } else {
| +                      dpyinfo->alt_mod_mask |= (1 << row);
| +                    }
|                   break;
|  
|                 case XK_Hyper_L:
\----

kai
-- 
~/.signature is: umop 3p!sdn    (Frank Nobis)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]