From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Anders Lindgren Newsgroups: gmane.emacs.bugs Subject: bug#21551: Fix Mac OS X key bindings bug Date: Sat, 2 Jan 2016 09:08:16 +0100 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11438ee8dcd2860528556398 X-Trace: ger.gmane.org 1451722165 20535 80.91.229.3 (2 Jan 2016 08:09:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Jan 2016 08:09:25 +0000 (UTC) To: Kai Yu Zhang , 21551@debbugs.gnu.org, Philipp Stephani , Mikhail Gusarov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 02 09:09:16 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aFHFT-0001b3-An for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Jan 2016 09:09:15 +0100 Original-Received: from localhost ([::1]:37711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFHFP-00025j-BS for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Jan 2016 03:09:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFHFK-00025c-Uk for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2016 03:09:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aFHFG-0005uP-SK for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2016 03:09:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aFHFG-0005uI-OJ for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2016 03:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aFHFG-0005Nf-G6 for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2016 03:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Anders Lindgren Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Jan 2016 08:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21551 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 21551-submit@debbugs.gnu.org id=B21551.145172210420637 (code B ref 21551); Sat, 02 Jan 2016 08:09:02 +0000 Original-Received: (at 21551) by debbugs.gnu.org; 2 Jan 2016 08:08:24 +0000 Original-Received: from localhost ([127.0.0.1]:34267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aFHEd-0005Mn-Lw for submit@debbugs.gnu.org; Sat, 02 Jan 2016 03:08:23 -0500 Original-Received: from mail-vk0-f44.google.com ([209.85.213.44]:35734) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aFHEb-0005Ma-Vb for 21551@debbugs.gnu.org; Sat, 02 Jan 2016 03:08:22 -0500 Original-Received: by mail-vk0-f44.google.com with SMTP id k1so103293009vkb.2 for <21551@debbugs.gnu.org>; Sat, 02 Jan 2016 00:08:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=tpRNEeac+YLUU9ubmdkqXyRbVZc6nnQwXgfISw3IEgE=; b=ytzVzbpte+0ILRz3852bZhczBJjLXNBWhD9R7TZ5Upd17C8TJvg/uZSjN3iUUU1faT MeSfPWJqnBD/28bah0gJblQchlHX40sPHs3tdgwtkZBX5KDtisB3oadILkrBEgiBjT65 QuMznaIlejwKcHIZlfFuew9PWSR08Cm8Z8+mtsA1ISNvB/cDOaNRkFanMFCMU3ecS27L PVEiVE70CEel1JX5cxiPbRgWtJEHVdFFYtutkIEk0uw3akqJfzLpHUiUOxSSx7IHrcg4 0tfzlkRSg0NoGB6WfyX2ct4wSGF+KeWCYAWKXUMpIgDpwk5xXgDN2sCkzyK1nzzUiueT NrAQ== X-Received: by 10.31.54.134 with SMTP id d128mr49017681vka.26.1451722096298; Sat, 02 Jan 2016 00:08:16 -0800 (PST) Original-Received: by 10.31.214.131 with HTTP; Sat, 2 Jan 2016 00:08:16 -0800 (PST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:111096 Archived-At: --001a11438ee8dcd2860528556398 Content-Type: text/plain; charset=UTF-8 I found a case where the code in question is needed, which none of the suggested patches handle correctly. Steps to repeat: (setq ns-alternate-modifier nil) Press left CMD-ALT-9 An unmodified Emacs replies "s-]" is not bound. (This assumes a Swedish keyboard layout, other layouts would yield a different character, but the principle is the same). With either of the two patches, Emacs respond with "s-9" is not bound, which isn't correct. Unfortunately, I don't know how to distinguish between the cases where we need to strip away modifiers (C-s-a) and when we shouldn't, so I'm leaving this open for now. -- Anders Lindgren On Wed, Dec 30, 2015 at 9:50 AM, Anders Lindgren wrote: > Hi, > > I'm looking into a key binding bug on OS X reported multiple times (19977, > 21330, 21551). Two different patches have been submitted. > > The original code looks like: > > if (is_left_key) > { > emacs_event->modifiers |= parse_solitary_modifier > (ns_command_modifier); > > /* if super (default), take input manager's word so things like > dvorak / qwerty layout work */ > if (EQ (ns_command_modifier, Qsuper) > && !fnKeysym > && [[theEvent characters] length] != 0) > { > /* XXX: the code we get will be unshifted, so if we have > a shift modifier, must convert ourselves */ > if (!(flags & NSShiftKeyMask)) > code = [[theEvent characters] characterAtIndex: 0]; > > One of the patches simply removes the `if (EQ(...))' statement. The other > modifies the code to strip away modifiers. > > First question: What is the code in the `if (EQ(...))' supposed to do? In > other words, what will stop working if it is removed? > > Second question: if it is needed for the LEFT command key, should the > corresponding code be added for the RIGHT? > > I've tested removing the `if' and Emacs still seems to be working as > intended, both with a normal key layout and when Dvorak is used. If no one > comes up with a reason to keep the code, I will remove it. > > Third question: Does anybody know of a good way to automatically test > things like this? What I'm looking for is a way to send keystrokes like > Cmd-Alt-a to Emacs, that way it could be possible to write tests ensuring > that things like this don't break in the future. > > -- Anders Lindgren > > --001a11438ee8dcd2860528556398 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I found a case where the code in question is needed, which= none of the suggested patches handle correctly.

Steps t= o repeat:

=C2=A0 =C2=A0=C2=A0(setq ns-alternate-mo= difier nil)

=C2=A0 =C2=A0 Press left CMD-ALT-9

=C2=A0 =C2=A0 An unmodified Emacs replies "s-]&q= uot; is not bound. (This assumes a Swedish keyboard layout, other layouts w= ould yield a different character, but the principle is the same).

=C2=A0 =C2=A0 With either of the two patches, Emacs respond= with "s-9" is not bound, which isn't correct.

=
Unfortunately, I don't know how to distinguish between the c= ases where we need to strip away modifiers (C-s-a) and when we shouldn'= t, so I'm leaving this open for now.

=C2=A0 = =C2=A0 -- Anders Lindgren


On Wed, Dec 30, 2015 at 9:50 AM, Anders = Lindgren <andlind@gmail.com> wrote:
Hi,

I'm looking into a k= ey binding bug on OS X reported multiple times (19977, 21330, 21551). Two d= ifferent patches have been submitted.

The original= code looks like:

=C2=A0 =C2=A0 =C2=A0 if (is= _left_key)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 emacs_event->modifiers |=3D parse_solitary_modifier=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (ns_command_modifier);=

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* if super (d= efault), take input manager's word so things like
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dvorak / qwerty layout work */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (EQ (ns_command_modifier, Qsup= er)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 && != fnKeysym
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &&a= mp; [[theEvent characters] length] !=3D 0)
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 /* XXX: the code we get will be unshifted, so if we have
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0a shift modif= ier, must convert ourselves */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 if (!(flags & NSShiftKeyMask))
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 code =3D [[theEvent characters] c= haracterAtIndex: 0];

One of the patches simp= ly removes the `if (EQ(...))' statement. The other modifies the code to= strip away modifiers.

First question: What is the= code in the `if (EQ(...))' supposed to do? In other words, what will s= top working if it is removed?

Second question:= if it is needed for the LEFT command key, should the corresponding code be= added for the RIGHT?

I've tested removing the= `if' and Emacs still seems to be working as intended, both with a norm= al key layout and when Dvorak is used. If no one comes up with a reason to = keep the code, I will remove it.

Third question: D= oes anybody know of a good way to automatically test things like this? What= I'm looking for is a way to send keystrokes like Cmd-Alt-a to Emacs, t= hat way it could be possible to write tests ensuring that things like this = don't break in the future.

=C2=A0 =C2=A0 -- Anders Lindgren

=

--001a11438ee8dcd2860528556398--