GNU bug report logs - #5842
Move Control modifier only in Emacs

Previous Next

Package: emacs;

Reported by: andrey <at> fotola.ru

Date: Tue, 6 Apr 2010 11:22:01 UTC

Severity: wishlist

Tags: patch, wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5842 in the body.
You can then email your comments to 5842 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5842; Package emacs. (Tue, 06 Apr 2010 11:22:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to andrey <at> fotola.ru:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 06 Apr 2010 11:22:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: andrey <at> fotola.ru
To: bug-gnu-emacs <at> gnu.org
Subject: Move Control modifier only in Emacs
Date: Tue, 6 Apr 2010 10:39:01 +0400
This patch allows to move Control modifier only in Emacs.
For example, you can do
(setq x-ctrl-keysym 'meta)
(setq x-meta-keysym 'ctrl)
to swap Control and Meta in Emacs, but not in X Window.

diff -ur emacs.orig/src/xterm.c emacs/src/xterm.c
--- emacs.orig/src/xterm.c	2010-04-06 09:05:46.000000000 +0400
+++ emacs/src/xterm.c	2010-04-06 10:27:24.644183557 +0400
@@ -315,9 +315,9 @@
 
 /* The keysyms to use for the various modifiers.  */
 
-Lisp_Object Vx_alt_keysym, Vx_hyper_keysym, Vx_meta_keysym, Vx_super_keysym;
+Lisp_Object Vx_ctrl_keysym, Vx_alt_keysym, Vx_hyper_keysym, Vx_meta_keysym, Vx_super_keysym;
 Lisp_Object Vx_keysym_table;
-static Lisp_Object Qalt, Qhyper, Qmeta, Qsuper, Qmodifier_value;
+static Lisp_Object Qctrl, Qalt, Qhyper, Qmeta, Qsuper, Qmodifier_value;
 
 static Lisp_Object Qvendor_specific_keysyms;
 static Lisp_Object Qlatin_1;
@@ -3649,12 +3649,15 @@
      struct x_display_info *dpyinfo;
      unsigned int state;
 {
+  EMACS_UINT mod_ctrl = ctrl_modifier;
   EMACS_UINT mod_meta = meta_modifier;
   EMACS_UINT mod_alt  = alt_modifier;
   EMACS_UINT mod_hyper = hyper_modifier;
   EMACS_UINT mod_super = super_modifier;
   Lisp_Object tem;
 
+  tem = Fget (Vx_ctrl_keysym, Qmodifier_value);
+  if (! EQ (tem, Qnil)) mod_ctrl = XUINT (tem);
   tem = Fget (Vx_alt_keysym, Qmodifier_value);
   if (! EQ (tem, Qnil)) mod_alt = XUINT (tem);
   tem = Fget (Vx_meta_keysym, Qmodifier_value);
@@ -3666,7 +3669,7 @@
 
 
   return (  ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0)
-            | ((state & ControlMask)			? ctrl_modifier	: 0)
+            | ((state & ControlMask)		? mod_ctrl	: 0)
             | ((state & dpyinfo->meta_mod_mask)		? mod_meta	: 0)
             | ((state & dpyinfo->alt_mod_mask)		? mod_alt	: 0)
             | ((state & dpyinfo->super_mod_mask)	? mod_super	: 0)
@@ -3678,6 +3681,7 @@
      struct x_display_info *dpyinfo;
      unsigned int state;
 {
+  EMACS_UINT mod_ctrl = ctrl_modifier;
   EMACS_UINT mod_meta = meta_modifier;
   EMACS_UINT mod_alt  = alt_modifier;
   EMACS_UINT mod_hyper = hyper_modifier;
@@ -3685,6 +3689,8 @@
 
   Lisp_Object tem;
 
+  tem = Fget (Vx_ctrl_keysym, Qmodifier_value);
+  if (! EQ (tem, Qnil)) mod_ctrl = XUINT (tem);
   tem = Fget (Vx_alt_keysym, Qmodifier_value);
   if (! EQ (tem, Qnil)) mod_alt = XUINT (tem);
   tem = Fget (Vx_meta_keysym, Qmodifier_value);
@@ -3699,7 +3705,7 @@
             | ((state & mod_super)	? dpyinfo->super_mod_mask : 0)
             | ((state & mod_hyper)	? dpyinfo->hyper_mod_mask : 0)
             | ((state & shift_modifier)	? ShiftMask        : 0)
-            | ((state & ctrl_modifier)	? ControlMask      : 0)
+            | ((state & mod_ctrl)	? ControlMask  : 0)
             | ((state & mod_meta)	? dpyinfo->meta_mod_mask  : 0));
 }
 
@@ -11024,6 +11030,8 @@
   last_mouse_motion_frame = Qnil;
 
   Qmodifier_value = intern_c_string ("modifier-value");
+  Qctrl = intern_c_string ("ctrl");
+  Fput (Qctrl, Qmodifier_value, make_number (ctrl_modifier));
   Qalt = intern_c_string ("alt");
   Fput (Qalt, Qmodifier_value, make_number (alt_modifier));
   Qhyper = intern_c_string ("hyper");
@@ -11035,30 +11043,37 @@
 
   DEFVAR_LISP ("x-alt-keysym", &Vx_alt_keysym,
     doc: /* Which keys Emacs uses for the alt modifier.
-This should be one of the symbols `alt', `hyper', `meta', `super'.
-For example, `alt' means use the Alt_L and Alt_R keysyms.  The default
-is nil, which is the same as `alt'.  */);
+This should be one of the symbols `ctrl', `alt', `hyper', `meta', `super'.
+For example, `alt' means use the Alt_L and Alt_R keysyms.
+The default is nil, which is the same as `alt'.  */);
   Vx_alt_keysym = Qnil;
 
+  DEFVAR_LISP ("x-ctrl-keysym", &Vx_ctrl_keysym,
+    doc: /* Which keys Emacs uses for the ctrl modifier.
+This should be one of the symbols `ctrl', `alt', `hyper', `meta', `super'.
+For example, `ctrl' means use the Control_L and Control_R keysyms.
+The default is nil, which is the same as `ctrl'.  */);
+  Vx_ctrl_keysym = Qnil;
+
   DEFVAR_LISP ("x-hyper-keysym", &Vx_hyper_keysym,
     doc: /* Which keys Emacs uses for the hyper modifier.
-This should be one of the symbols `alt', `hyper', `meta', `super'.
-For example, `hyper' means use the Hyper_L and Hyper_R keysyms.  The
-default is nil, which is the same as `hyper'.  */);
+This should be one of the symbols `ctrl', `alt', `hyper', `meta', `super'.
+For example, `hyper' means use the Hyper_L and Hyper_R keysyms.
+The default is nil, which is the same as `hyper'.  */);
   Vx_hyper_keysym = Qnil;
 
   DEFVAR_LISP ("x-meta-keysym", &Vx_meta_keysym,
     doc: /* Which keys Emacs uses for the meta modifier.
-This should be one of the symbols `alt', `hyper', `meta', `super'.
-For example, `meta' means use the Meta_L and Meta_R keysyms.  The
-default is nil, which is the same as `meta'.  */);
+This should be one of the symbols `ctrl', `alt', `hyper', `meta', `super'.
+For example, `meta' means use the Meta_L and Meta_R keysyms.
+The default is nil, which is the same as `meta'.  */);
   Vx_meta_keysym = Qnil;
 
   DEFVAR_LISP ("x-super-keysym", &Vx_super_keysym,
     doc: /* Which keys Emacs uses for the super modifier.
-This should be one of the symbols `alt', `hyper', `meta', `super'.
-For example, `super' means use the Super_L and Super_R keysyms.  The
-default is nil, which is the same as `super'.  */);
+This should be one of the symbols `ctrl', `alt', `hyper', `meta', `super'.
+For example, `super' means use the Super_L and Super_R keysyms.
+The default is nil, which is the same as `super'.  */);
   Vx_super_keysym = Qnil;
 
   DEFVAR_LISP ("x-keysym-table", &Vx_keysym_table,


-- 
Andrey Astafiev





Added tag(s) patch. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 09 Apr 2010 07:36:01 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 09 Apr 2010 07:36:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#5842; Package emacs. (Wed, 11 Apr 2012 14:45:02 GMT) Full text and rfc822 format available.

Message #12 received at 5842 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: andrey <at> fotola.ru
Cc: 5842 <at> debbugs.gnu.org
Subject: Re: bug#5842: Move Control modifier only in Emacs
Date: Wed, 11 Apr 2012 16:42:58 +0200
andrey <at> fotola.ru writes:

> This patch allows to move Control modifier only in Emacs.
> For example, you can do
> (setq x-ctrl-keysym 'meta)
> (setq x-meta-keysym 'ctrl)
> to swap Control and Meta in Emacs, but not in X Window.

This does make sense, I guess?  And there's the precedence with
`x-alt-keysym' and friends...

On the other hand, stuff like this really ought to be fixed on the X
level, I think.

Opinions?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#5842; Package emacs. (Wed, 11 Apr 2012 17:53:01 GMT) Full text and rfc822 format available.

Message #15 received at 5842 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: andrey <at> fotola.ru, 5842 <at> debbugs.gnu.org
Subject: Re: bug#5842: Move Control modifier only in Emacs
Date: Wed, 11 Apr 2012 13:51:25 -0400
>> This patch allows to move Control modifier only in Emacs.
>> For example, you can do
>> (setq x-ctrl-keysym 'meta)
>> (setq x-meta-keysym 'ctrl)
>> to swap Control and Meta in Emacs, but not in X Window.

I would much prefer a patch that's independent of the underlying GUI, so
we can use the same config vars under a tty, X11, Windows, ...


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#5842; Package emacs. (Thu, 12 Apr 2012 12:32:01 GMT) Full text and rfc822 format available.

Message #18 received at 5842 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: andrey <at> fotola.ru, 5842 <at> debbugs.gnu.org
Subject: Re: bug#5842: Move Control modifier only in Emacs
Date: Thu, 12 Apr 2012 14:30:34 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> I would much prefer a patch that's independent of the underlying GUI, so
> we can use the same config vars under a tty, X11, Windows, ...

That would be a lot better.  Is there a particular reason for why all
these other keysum redefinition things (like `x-alt-keysum' and friends)
target X particularly?  Historical reasons?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#5842; Package emacs. (Thu, 12 Apr 2012 14:42:02 GMT) Full text and rfc822 format available.

Message #21 received at 5842 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: andrey <at> fotola.ru, 5842 <at> debbugs.gnu.org
Subject: Re: bug#5842: Move Control modifier only in Emacs
Date: Thu, 12 Apr 2012 10:40:00 -0400
>> I would much prefer a patch that's independent of the underlying GUI, so
>> we can use the same config vars under a tty, X11, Windows, ...
> That would be a lot better.  Is there a particular reason for why all
> these other keysum redefinition things (like `x-alt-keysum' and friends)
> target X particularly?  Historical reasons?

Probably historical reasons, yes.

The fact that we have many such variables for different GUI backends and
that none of them are really general indicates that it's just the result
of a patchwork of small changes to cover the submitter's
particular needs.
IOW, not much design in there.

Then again of course, maybe it's not as easy to do in a generic way.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#5842; Package emacs. (Sun, 28 Feb 2016 06:01:01 GMT) Full text and rfc822 format available.

Message #24 received at 5842 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: andrey <at> fotola.ru
Cc: 5842 <at> debbugs.gnu.org
Subject: Re: bug#5842: Move Control modifier only in Emacs
Date: Sun, 28 Feb 2016 16:59:33 +1100
andrey <at> fotola.ru writes:

> This patch allows to move Control modifier only in Emacs.
> For example, you can do
> (setq x-ctrl-keysym 'meta)
> (setq x-meta-keysym 'ctrl)
> to swap Control and Meta in Emacs, but not in X Window.

[...]

> I would much prefer a patch that's independent of the underlying GUI, so
> we can use the same config vars under a tty, X11, Windows, ...

Is this possible to do on that level?

Anyway, I don't really feel that it makes much sense to have these piece
meal way of modifying some modifier keys in Emacs, when you can do that
directly in X (or whatever GUI you're using), so I'm closing this bug.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 28 Feb 2016 06:01:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 5842 <at> debbugs.gnu.org and andrey <at> fotola.ru Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 28 Feb 2016 06:01:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 27 Mar 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 145 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.