From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: andrey@fotola.ru Newsgroups: gmane.emacs.bugs Subject: bug#5842: Move Control modifier only in Emacs Date: Tue, 6 Apr 2010 10:39:01 +0400 Message-ID: <19386.55045.788449.550686@geany.lan> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1270571099 10180 80.91.229.12 (6 Apr 2010 16:24:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Apr 2010 16:24:59 +0000 (UTC) To: 5842@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 06 18:24:58 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NzBaC-0006kF-Q4 for geb-bug-gnu-emacs@m.gmane.org; Tue, 06 Apr 2010 18:24:57 +0200 Original-Received: from localhost ([127.0.0.1]:48077 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NzBaB-00021n-W2 for geb-bug-gnu-emacs@m.gmane.org; Tue, 06 Apr 2010 12:24:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nz6v0-0000dh-Kc for bug-gnu-emacs@gnu.org; Tue, 06 Apr 2010 07:26:06 -0400 Original-Received: from [140.186.70.92] (port=51611 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nz6ux-0000dK-HD for bug-gnu-emacs@gnu.org; Tue, 06 Apr 2010 07:26:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nz6uw-0006jG-97 for bug-gnu-emacs@gnu.org; Tue, 06 Apr 2010 07:26:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42372) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nz6uw-0006jA-7F for bug-gnu-emacs@gnu.org; Tue, 06 Apr 2010 07:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Nz6r3-000892-Oc; Tue, 06 Apr 2010 07:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: andrey@fotola.ru Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Apr 2010 11:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 5842 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.127055289031294 (code B ref -1); Tue, 06 Apr 2010 11:22:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Apr 2010 11:21:30 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nz6qX-00088g-UE for submit@debbugs.gnu.org; Tue, 06 Apr 2010 07:21:30 -0400 Original-Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nz4hV-0007Ft-Gy for submit@debbugs.gnu.org; Tue, 06 Apr 2010 05:04:02 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:34064) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nz4hS-0007Fu-Ea for submit@debbugs.gnu.org; Tue, 06 Apr 2010 05:03:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nz4hR-00069n-U1 for bug-gnu-emacs@gnu.org; Tue, 06 Apr 2010 05:03:57 -0400 Original-Received: from [140.186.70.92] (port=53009 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nz4hP-00068z-Tz for bug-gnu-emacs@gnu.org; Tue, 06 Apr 2010 05:03:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nz4hO-00055D-JE for bug-gnu-emacs@gnu.org; Tue, 06 Apr 2010 05:03:55 -0400 Original-Received: from piter25.dns-rus.net ([91.215.170.25]:49610) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nz4hO-00054h-6E for bug-gnu-emacs@gnu.org; Tue, 06 Apr 2010 05:03:54 -0400 Original-Received: from [109.94.72.14] (helo=geany.lan) by piter25.dns-rus.net with esmtpa (Exim 4.69) (envelope-from ) id 1Nz2SB-0007UO-MH for bug-gnu-emacs@gnu.org; Tue, 06 Apr 2010 10:40:05 +0400 X-Mailer: VM 8.0.12 under 24.0.50.1 (i686-pc-linux-gnu) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - piter25.dns-rus.net X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - fotola.ru X-detected-operating-system: by eggs.gnu.org: Windows 98 (1) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Mailman-Approved-At: Tue, 06 Apr 2010 07:21:28 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 06 Apr 2010 07:22:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Tue, 06 Apr 2010 12:21:27 -0400 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:35988 Archived-At: 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