From unknown Mon Aug 18 11:26:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21551: [PATCH] Fix Mac OS X key bindings bug Resent-From: Kai Yu Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Sep 2015 16:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21551 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 21551@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.144311314122455 (code B ref -1); Thu, 24 Sep 2015 16:46:02 +0000 Received: (at submit) by debbugs.gnu.org; 24 Sep 2015 16:45:41 +0000 Received: from localhost ([127.0.0.1]:42004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zf9eP-0005q1-Cu for submit@debbugs.gnu.org; Thu, 24 Sep 2015 12:45:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55531) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zf6RD-0000sj-R0 for submit@debbugs.gnu.org; Thu, 24 Sep 2015 09:19:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf6RD-0005cl-8n for submit@debbugs.gnu.org; Thu, 24 Sep 2015 09:19:51 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf6RD-0005cW-62 for submit@debbugs.gnu.org; Thu, 24 Sep 2015 09:19:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf6RC-0003gd-Id for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2015 09:19:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf6R9-0005XU-1a for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2015 09:19:50 -0400 Received: from mail-la0-x22b.google.com ([2a00:1450:4010:c03::22b]:35014) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf6R8-0005W9-Lv for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2015 09:19:46 -0400 Received: by lacwc7 with SMTP id wc7so5964702lac.2 for ; Thu, 24 Sep 2015 06:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=KYKYYUWl0zDZJsDYJdC/0QLJzbBSYQgzx6tKoVuepWs=; b=SJ9/ew61Vmyb5RxTApBWoNHR7rTVGNI5/I7Xp1/R3LvADaY3Y+2Dg8di6aZr0N3iSG 9lRYO+y2gus15v0NULqUXG5TVoTI16PRjpxxiwcL7awsR3FV1bpiZQm98iK72N2SOLnR FssMmmKGfoxEX87KUGABg3dE8T3oxqQJobmTvYynk2R+NvingheRhTIEun8jlyK0IkNj dbWuO9ugujTq97RAxajfIQi9FYEfq7cdIzrayw+FftjS29puqx+871C9olFoOEhyNjRJ K+D1UU1tL0HD/kSRm4JEpMN77VsN/RyjR2jhCNhbCmbtTeRe5uWwc2g3Sto9KOtzGZKb +6Wg== MIME-Version: 1.0 X-Received: by 10.25.39.76 with SMTP id n73mr5015911lfn.60.1443100785713; Thu, 24 Sep 2015 06:19:45 -0700 (PDT) Received: by 10.114.24.130 with HTTP; Thu, 24 Sep 2015 06:19:45 -0700 (PDT) Date: Thu, 24 Sep 2015 21:19:45 +0800 Message-ID: From: Kai Yu Zhang Content-Type: multipart/mixed; boundary=001a11411448b5a99d05207e1566 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Mailman-Approved-At: Thu, 24 Sep 2015 12:45:40 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --001a11411448b5a99d05207e1566 Content-Type: multipart/alternative; boundary=001a11411448b5a99705207e1564 --001a11411448b5a99705207e1564 Content-Type: text/plain; charset=UTF-8 --001a11411448b5a99705207e1564 Content-Type: text/html; charset=UTF-8

--001a11411448b5a99705207e1564-- --001a11411448b5a99d05207e1566 Content-Type: application/octet-stream; name="0001-Fix-Mac-OS-X-key-bindings-bug.patch" Content-Disposition: attachment; filename="0001-Fix-Mac-OS-X-key-bindings-bug.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_iey8y03s0 RnJvbSBjMDgwZGEzODJlM2Q5ZTYwZjM5NmVlZDQzNjQ1NTg2MTFlMTUwZThkIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBaaGFuZyBLYWkgWXUgPHllYW5ueWxhbUBnbWFpbC5jb20+CkRh dGU6IFRodSwgMjQgU2VwIDIwMTUgMjE6MTA6NDAgKzA4MDAKU3ViamVjdDogW1BBVENIXSBGaXgg TWFjIE9TIFgga2V5IGJpbmRpbmdzIGJ1ZwoKLS0tCiBzcmMvbnN0ZXJtLm0gfCAyMSArKysrKysr KysrKystLS0tLS0tLS0KIDEgZmlsZSBjaGFuZ2VkLCAxMiBpbnNlcnRpb25zKCspLCA5IGRlbGV0 aW9ucygtKQoKZGlmZiAtLWdpdCBhL3NyYy9uc3Rlcm0ubSBiL3NyYy9uc3Rlcm0ubQppbmRleCA3 YzZiOWRjLi5kMWNjYzhhIDEwMDY0NAotLS0gYS9zcmMvbnN0ZXJtLm0KKysrIGIvc3JjL25zdGVy bS5tCkBAIC01MzgzLDE2ICs1MzgzLDE4IEBAIG5vdF9pbl9hcmd2IChOU1N0cmluZyAqYXJnKQog ICAgICAgICAgIGVtYWNzX2V2ZW50LT5tb2RpZmllcnMgfD0gcGFyc2Vfc29saXRhcnlfbW9kaWZp ZXIKICAgICAgICAgICAgIChuc19jb21tYW5kX21vZGlmaWVyKTsKIAotICAgICAgICAgIC8qIGlm IHN1cGVyIChkZWZhdWx0KSwgdGFrZSBpbnB1dCBtYW5hZ2VyJ3Mgd29yZCBzbyB0aGluZ3MgbGlr ZQotICAgICAgICAgICAgIGR2b3JhayAvIHF3ZXJ0eSBsYXlvdXQgd29yayAqLworICAgICAgICAg IC8qIHdlIHNob3VsZCB1c2UgW3RoZUV2ZW50IGNoYXJhY3RlcnNJZ25vcmluZ01vZGlmaWVyc10g cmF0aGVyIHRoYW4KKyAgICAgICAgICAgKiBbdGhlRXZlbnQgY2hhcmFjdGVyc10sIG90aGVyd2lz ZSB0aGUga2V5IGNvZGUgd2lsbCBiZWNvbWUKKyAgICAgICAgICAgKiBleHRyZW1lbHkgYmlnIGFu ZCBjYXVzZSBidWcgd2hlbiBkb2luZyBrZXkgYmluZGluZ3MuCisgICAgICAgICAgICovCiAgICAg ICAgICAgaWYgKEVRIChuc19jb21tYW5kX21vZGlmaWVyLCBRc3VwZXIpCiAgICAgICAgICAgICAg ICYmICFmbktleXN5bQotICAgICAgICAgICAgICAmJiBbW3RoZUV2ZW50IGNoYXJhY3RlcnNdIGxl bmd0aF0gIT0gMCkKKyAgICAgICAgICAgICAgJiYgW1t0aGVFdmVudCBjaGFyYWN0ZXJzSWdub3Jp bmdNb2RpZmllcnNdIGxlbmd0aF0gIT0gMCkKICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAg LyogWFhYOiB0aGUgY29kZSB3ZSBnZXQgd2lsbCBiZSB1bnNoaWZ0ZWQsIHNvIGlmIHdlIGhhdmUK ICAgICAgICAgICAgICAgICAgYSBzaGlmdCBtb2RpZmllciwgbXVzdCBjb252ZXJ0IG91cnNlbHZl cyAqLwogICAgICAgICAgICAgICBpZiAoIShmbGFncyAmIE5TU2hpZnRLZXlNYXNrKSkKLSAgICAg ICAgICAgICAgICBjb2RlID0gW1t0aGVFdmVudCBjaGFyYWN0ZXJzXSBjaGFyYWN0ZXJBdEluZGV4 OiAwXTsKKyAgICAgICAgICAgICAgICBjb2RlID0gW1t0aGVFdmVudCBjaGFyYWN0ZXJzSWdub3Jp bmdNb2RpZmllcnNdIGNoYXJhY3RlckF0SW5kZXg6IDBdOwogI2lmIDAKICAgICAgICAgICAgICAg LyogdGhpcyBpcyB1Z2x5IGFuZCBhbHNvIHJlcXVpcmVzIGxpbmtpbmcgdy9DYXJib24gZnJhbWV3 b3JrCiAgICAgICAgICAgICAgICAgIChmb3IgTE1HZXRLYmRUeXBlKSBzbyBmb3Igbm93IGxlYXZl IHRoaXMgcmFyZSAoPykgY2FzZQpAQCAtNTQ0OSw4ICs1NDUxLDkgQEAgbm90X2luX2FyZ3YgKE5T U3RyaW5nICphcmcpCiAgICAgICAgICAgICAgICB8fCAoRVEgKG5zX3JpZ2h0X2FsdGVybmF0ZV9t b2RpZmllciwgUWxlZnQpICYmIGxlZnRfaXNfbm9uZSkpCiAgICAgICAgICAgICAgICYmICFmbktl eXN5bSkKICAgICAgICAgICAgIHsgICAvKiBhY2NlcHQgcHJlLWludGVycCBhbHQgY29tYiAqLwot ICAgICAgICAgICAgICBpZiAoW1t0aGVFdmVudCBjaGFyYWN0ZXJzXSBsZW5ndGhdID4gMCkKLSAg ICAgICAgICAgICAgICBjb2RlID0gW1t0aGVFdmVudCBjaGFyYWN0ZXJzXSBjaGFyYWN0ZXJBdElu ZGV4OiAwXTsKKyAgICAgICAgICAgICAgaWYgKFtbdGhlRXZlbnQgY2hhcmFjdGVyc0lnbm9yaW5n TW9kaWZpZXJzXSBsZW5ndGhdID4gMCkKKyAgICAgICAgICAgICAgICBjb2RlID0gW1t0aGVFdmVu dCBjaGFyYWN0ZXJzSWdub3JpbmdNb2RpZmllcnNdCisgICAgICAgICAgICAgICAgICBjaGFyYWN0 ZXJBdEluZGV4OiAwXTsKICAgICAgICAgICAgICAgLypIQUNLOiBjbGVhciBsb25lIHNoaWZ0IG1v ZGlmaWVyIHRvIHN0b3AgbmV4dCBpZiBmcm9tIGZpcmluZyAqLwogICAgICAgICAgICAgICBpZiAo ZW1hY3NfZXZlbnQtPm1vZGlmaWVycyA9PSBzaGlmdF9tb2RpZmllcikKICAgICAgICAgICAgICAg ICBlbWFjc19ldmVudC0+bW9kaWZpZXJzID0gMDsKQEAgLTU0NjYsOCArNTQ2OSw5IEBAIG5vdF9p bl9hcmd2IChOU1N0cmluZyAqYXJnKQogICAgICAgICB7CiAgICAgICAgICAgaWYgKGxlZnRfaXNf bm9uZSAmJiAhZm5LZXlzeW0pCiAgICAgICAgICAgICB7ICAgLyogYWNjZXB0IHByZS1pbnRlcnAg YWx0IGNvbWIgKi8KLSAgICAgICAgICAgICAgaWYgKFtbdGhlRXZlbnQgY2hhcmFjdGVyc10gbGVu Z3RoXSA+IDApCi0gICAgICAgICAgICAgICAgY29kZSA9IFtbdGhlRXZlbnQgY2hhcmFjdGVyc10g Y2hhcmFjdGVyQXRJbmRleDogMF07CisgICAgICAgICAgICAgIGlmIChbW3RoZUV2ZW50IGNoYXJh Y3RlcnNJZ25vcmluZ01vZGlmaWVyc10gbGVuZ3RoXSA+IDApCisgICAgICAgICAgICAgICAgY29k ZSA9IFtbdGhlRXZlbnQgY2hhcmFjdGVyc0lnbm9yaW5nTW9kaWZpZXJzXQorICAgICAgICAgICAg ICAgICAgY2hhcmFjdGVyQXRJbmRleDogMF07CiAgICAgICAgICAgICAgIC8qSEFDSzogY2xlYXIg bG9uZSBzaGlmdCBtb2RpZmllciB0byBzdG9wIG5leHQgaWYgZnJvbSBmaXJpbmcgKi8KICAgICAg ICAgICAgICAgaWYgKGVtYWNzX2V2ZW50LT5tb2RpZmllcnMgPT0gc2hpZnRfbW9kaWZpZXIpCiAg ICAgICAgICAgICAgICAgZW1hY3NfZXZlbnQtPm1vZGlmaWVycyA9IDA7CkBAIC01NDg1LDcgKzU0 ODksNiBAQCBub3RfaW5fYXJndiAoTlNTdHJpbmcgKmFyZykKICAgICAgIGlmIChmbktleXN5bSB8 fCAoZW1hY3NfZXZlbnQtPm1vZGlmaWVycwogICAgICAgICAgICAgICAgICAgICAgICAmJiAoZW1h Y3NfZXZlbnQtPm1vZGlmaWVycyAhPSBzaGlmdF9tb2RpZmllcikKICAgICAgICAgICAgICAgICAg ICAgICAgJiYgW1t0aGVFdmVudCBjaGFyYWN0ZXJzSWdub3JpbmdNb2RpZmllcnNdIGxlbmd0aF0g PiAwKSkKLS8qW1t0aGVFdmVudCBjaGFyYWN0ZXJzXSBsZW5ndGhdICovCiAgICAgICAgIHsKICAg ICAgICAgICBlbWFjc19ldmVudC0+a2luZCA9IE5PTl9BU0NJSV9LRVlTVFJPS0VfRVZFTlQ7CiAg ICAgICAgICAgaWYgKGNvZGUgPCAweDIwKQotLSAKMi4zLjggKEFwcGxlIEdpdC01OCkKCg== --001a11411448b5a99d05207e1566-- From unknown Mon Aug 18 11:26:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21551: Fix Mac OS X key bindings bug References: In-Reply-To: Resent-From: Anders Lindgren Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Dec 2015 08:51:01 +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 To: Kai Yu Zhang , 21551@debbugs.gnu.org, Philipp Stephani , Mikhail Gusarov Received: via spool by 21551-submit@debbugs.gnu.org id=B21551.14514654322662 (code B ref 21551); Wed, 30 Dec 2015 08:51:01 +0000 Received: (at 21551) by debbugs.gnu.org; 30 Dec 2015 08:50:32 +0000 Received: from localhost ([127.0.0.1]:49327 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aECSm-0000gs-7l for submit@debbugs.gnu.org; Wed, 30 Dec 2015 03:50:32 -0500 Received: from mail-vk0-f48.google.com ([209.85.213.48]:32833) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aECSj-0000ge-Gf for 21551@debbugs.gnu.org; Wed, 30 Dec 2015 03:50:30 -0500 Received: by mail-vk0-f48.google.com with SMTP id a188so203035509vkc.0 for <21551@debbugs.gnu.org>; Wed, 30 Dec 2015 00:50:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=xaoqgzBGuw2fGdMLvk4m4D4ebzg8PlNGJ3amyWfItYA=; b=A5jloy3eEgYHrG4adc4kfIpTwWuI3D9bmHqnQscyXXJdnDxLALKjJ0J9vjKSe6D57N UBIw3sRT+ZbWu5oLGZ/Sd2kSwSmHIDeyKNqHWCgmZMk3TKAlULKe015hc1gybGi1LSxI Q6foDMSRcBf9mfhYeJndoiBQsKep9qaUceVNXsUOWfpnRGwGyn8AJi+2RSCr1Ob4mZgt tPHsha+E2BgzvrEM4+VY9vQ9v0mT2WlP4kHvZ0mPFnRVFlJ8P9W2rRSltWIvHxJfY6Qj ft/5HPAIxh0lzJTU/hmkoObtGSinavDJqV77JxXIWnxie757lhayVNbNlhepgmUJcaQY VL5Q== MIME-Version: 1.0 X-Received: by 10.31.146.66 with SMTP id u63mr36596017vkd.31.1451465423786; Wed, 30 Dec 2015 00:50:23 -0800 (PST) Received: by 10.31.214.131 with HTTP; Wed, 30 Dec 2015 00:50:23 -0800 (PST) Date: Wed, 30 Dec 2015 09:50:23 +0100 Message-ID: From: Anders Lindgren Content-Type: multipart/alternative; boundary=001a1143a94cfd1a34052819a01b X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --001a1143a94cfd1a34052819a01b Content-Type: text/plain; charset=UTF-8 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 --001a1143a94cfd1a34052819a01b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I'm looking into a key binding = bug on OS X reported multiple times (19977, 21330, 21551). Two different pa= tches have been submitted.

The original code looks= like:

=C2=A0 =C2=A0 =C2=A0 if (is_left_key)<= /div>
=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 (default), t= ake 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, Qsuper)
<= div>=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 && [[theE= vent 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 modifier, 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] characte= rAtIndex: 0];

One of the patches simply remo= ves the `if (EQ(...))' statement. The other modifies the code to strip = away modifiers.

First question: What is the code i= n the `if (EQ(...))' supposed to do? In other words, what will stop wor= king 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= 9; 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 th= e code, I will remove it.

Third question: Does any= body 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.

=C2=A0 =C2=A0 -- Anders Li= ndgren

--001a1143a94cfd1a34052819a01b-- From unknown Mon Aug 18 11:26:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21551: Fix Mac OS X key bindings bug 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 To: Kai Yu Zhang , 21551@debbugs.gnu.org, Philipp Stephani , Mikhail Gusarov Received: via spool by 21551-submit@debbugs.gnu.org id=B21551.145172210420637 (code B ref 21551); Sat, 02 Jan 2016 08:09:02 +0000 Received: (at 21551) by debbugs.gnu.org; 2 Jan 2016 08:08:24 +0000 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 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 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== MIME-Version: 1.0 X-Received: by 10.31.54.134 with SMTP id d128mr49017681vka.26.1451722096298; Sat, 02 Jan 2016 00:08:16 -0800 (PST) Received: by 10.31.214.131 with HTTP; Sat, 2 Jan 2016 00:08:16 -0800 (PST) In-Reply-To: References: Date: Sat, 2 Jan 2016 09:08:16 +0100 Message-ID: From: Anders Lindgren Content-Type: multipart/alternative; boundary=001a11438ee8dcd2860528556398 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --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-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 05 01:33:26 2016 Received: (at control) by debbugs.gnu.org; 5 Jan 2016 06:33:27 +0000 Received: from localhost ([127.0.0.1]:38077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aGLBO-0004ze-P3 for submit@debbugs.gnu.org; Tue, 05 Jan 2016 01:33:26 -0500 Received: from mail-vk0-f47.google.com ([209.85.213.47]:33182) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aGLBN-0004zP-US for control@debbugs.gnu.org; Tue, 05 Jan 2016 01:33:26 -0500 Received: by mail-vk0-f47.google.com with SMTP id a188so262655480vkc.0 for ; Mon, 04 Jan 2016 22:33:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=z5ob8FcwhDUfaKVSxBchGLVzntTFDHj71ZntduuaYWo=; b=KZAcvbb8bOBiM0uRZCgHu9dCS+3jKQFGeSss4nMCUDOetuZb0qqs2WYX42hvJy3kdX eqOH3QqcOxbFt3YSRpsm3WTnj4EoBuvPjyvyR/rlgrOzNU5v1lulO4YhA31Dlu5FbQnX xYn6/zWQZ1OOEg1aw2R4VNvQZkgrnIbyb28MfmjhVlmnvO5OG3L/pllo2DX9/VGlE5Ij 6u/x5WpAfsownuYABWzidxaHVX0JNy5iLE69sIZDzt2BdoosEZWR7rOQVleSpDt6O6kr 99RTT6sqIT2rI9keqgGMpiPErdxQbfwuP77wtC5i4AjqDWWKPyeQkesrpDkmniGn+SQm mwwQ== MIME-Version: 1.0 X-Received: by 10.31.10.199 with SMTP id 190mr65120358vkk.51.1451975600340; Mon, 04 Jan 2016 22:33:20 -0800 (PST) Received: by 10.31.214.131 with HTTP; Mon, 4 Jan 2016 22:33:20 -0800 (PST) Date: Tue, 5 Jan 2016 07:33:20 +0100 Message-ID: Subject: merge 19977 21330 21551 From: Anders Lindgren To: control@debbugs.gnu.org Content-Type: multipart/alternative; boundary=001a11440176e183bf05289069ca X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --001a11440176e183bf05289069ca Content-Type: text/plain; charset=UTF-8 merge 19977 21330 21551 --001a11440176e183bf05289069ca Content-Type: text/html; charset=UTF-8
merge 19977 21330 21551

--001a11440176e183bf05289069ca-- From unknown Mon Aug 18 11:26:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21551: Fix Mac OS X key bindings bug Resent-From: "Mikhail Gusarov" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Dec 2016 20:14:03 +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 To: "Anders Lindgren" , "Kai Yu Zhang" , 21551@debbugs.gnu.org, "Philipp Stephani" , 21330@debbugs.gnu.org, 19977@debbugs.gnu.org Received: via spool by 21551-submit@debbugs.gnu.org id=B21551.148278318426524 (code B ref 21551); Mon, 26 Dec 2016 20:14:03 +0000 Received: (at 21551) by debbugs.gnu.org; 26 Dec 2016 20:13:04 +0000 Received: from localhost ([127.0.0.1]:55990 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLbdo-0006tf-BR for submit@debbugs.gnu.org; Mon, 26 Dec 2016 15:13:04 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:49942) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLbdl-0006t0-If; Mon, 26 Dec 2016 15:13:02 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id CB67D20812; Mon, 26 Dec 2016 15:13:00 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Mon, 26 Dec 2016 15:13:00 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=dottedmag.net; h= content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=HrabtBZO9oL8u4pqYb9w4ClHCzE=; b=kbHyY+ 5+nnT5XLBxQEcQNyeV/ETRRuPTAck599G5jjsVDQms/cquvzRt3D265ilG3fP4/9 TroFuba832FS16aPPi7rsddxsTpGsYtquWvREFG5Dhz3ty1oxRyw0HXzZQguPK3l GoX9JHRIyM6RueLneamo5Da+A8DT1sZmnfxA8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=HrabtBZO9oL8u4 pqYb9w4ClHCzE=; b=PSZzRckA3q8b0Zrzn5xCEs1gkruQPkmZrB3CHfuN7DGjnj uQKLDMWNlYGQPhdI6B5HDSdjiAW9uhxZVHsspXrNqG/AFxdq8OooAPbnx79KjVhm r2U7crRdm3FCrmygVIiDYsFP5EOCGPR+wa+Z6cSAPy+QlOOSmYru4j61xLI3M= X-ME-Sender: X-Sasl-enc: 7KgaZcuQIOD6oajQMGn0CpNek2O01ECMSG+ZqVYpSG82 1482783180 Received: from [10.0.10.164] (unknown [141.8.36.65]) by mail.messagingengine.com (Postfix) with ESMTPA id 32F8F7E2B0; Mon, 26 Dec 2016 15:12:59 -0500 (EST) From: "Mikhail Gusarov" Date: Mon, 26 Dec 2016 21:12:46 +0100 Message-ID: <845DEA9E-D515-4567-B7D2-74FF5A1F0974@dottedmag.net> In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_MailMate_B567546C-9A70-4930-A9A2-3A2FF8FADA4C_=" Embedded-HTML: [{"HTML":[741, 3579], "plain":[299, 2552], "uuid":"536279DD-9861-4B53-B247-AD635AEF2CB6"}] X-Mailer: MailMate (1.9.6r5319) X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=_MailMate_B567546C-9A70-4930-A9A2-3A2FF8FADA4C_= Hi Anders, I have tried reproducing this discrepancy using my patch from #21330 on top of branch emacs-25. Swedish layout, ns-alternate-modifier set to nil, LCmd-LAlt-9 replies "s-]". Maybe you could check again as well? Best regards, Mikhail. On 2 Jan 2016, at 9:08, Anders Lindgren wrote: > 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 >> >> --=_MailMate_B567546C-9A70-4930-A9A2-3A2FF8FADA4C_= Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
<= p dir=3D"auto">Hi Anders,

I have tried reproducing this discrepancy using my patch = from #21330
on top of branch emacs-25.

Swedish layout, ns-alternate-modifier set to nil, LCmd-LA= lt-9 replies
"s-]".

Maybe you could check again as well?

Best regards,
Mikhail.

On 2 Jan 2016, at 9:08, Anders Lindgren wrote:

I found a case where the code in question is needed, which= none of the suggested patches handle correctly.

Steps= to repeat:

=C2=A0 =C2=A0=C2=A0(setq ns-alternat= e-modifier nil)

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

=C2=A0 =C2=A0 An unmodified Emacs replies &qu= ot;s-]" is not bound. (This assumes a Swedish keyboard layout, other= layouts would 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= =2E

Unfortunately, I don't know how to disti= nguish between the cases where we need to strip away modifiers (C-s-a) an= d 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> w= rote:
Hi,

I'm looking into a key binding bug on OS X reported multiple= times (19977, 21330, 21551). Two different patches have been submitted.<= /div>

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 (default), 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, Qsuper)
=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 && [[theEvent characte= rs] 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 c= ode 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 modifier, must convert = ourselves */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 i= f (!(flags & NSShiftKeyMask))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 code =3D [[theEvent characters] characterAtIndex= : 0];

One of the patches simply removes th= e `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 wor= king if it is removed?

Second question: if i= t is needed for the LEFT command key, should the corresponding code be ad= ded for the RIGHT?

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

Third questi= on: Does anybody know of a good way to automatically test things like thi= s? 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.

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


--=_MailMate_B567546C-9A70-4930-A9A2-3A2FF8FADA4C_=-- From unknown Mon Aug 18 11:26:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21551: Fix Mac OS X key bindings bug Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Feb 2018 17:58: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 To: Anders Lindgren Cc: 21551@debbugs.gnu.org, Kai Yu Zhang , Mikhail Gusarov Received: via spool by 21551-submit@debbugs.gnu.org id=B21551.151837187319714 (code B ref 21551); Sun, 11 Feb 2018 17:58:02 +0000 Received: (at 21551) by debbugs.gnu.org; 11 Feb 2018 17:57:53 +0000 Received: from localhost ([127.0.0.1]:38578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekvsu-00057u-Nw for submit@debbugs.gnu.org; Sun, 11 Feb 2018 12:57:53 -0500 Received: from mail-lf0-f44.google.com ([209.85.215.44]:40589) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekvsr-00057f-2K for 21551@debbugs.gnu.org; Sun, 11 Feb 2018 12:57:49 -0500 Received: by mail-lf0-f44.google.com with SMTP id i24so14427499lfc.7 for <21551@debbugs.gnu.org>; Sun, 11 Feb 2018 09:57:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wiVVxMbOQ5TWCQDTABSZ8DNiU0CXkMfV22ZofNfRj2U=; b=YnS71qi6P6RtK3L9dVk72Rjym6PWsg0FWLDICwnr3Wya6IY9VCPtfhEirQK+B4n5rV aZxot10zkTCAzPq8BR7/3K8C2cphdVtDWDqY0d8pMNE3BUE5xgSsbpWXVYQp74iUikNv vY81mbk8WGvbLskUfb4qfdV5myZA/1vNu4plqZmG9HVG/Bhzg4lREaxdqO4AyfYon/UY p8fY7g9sI7KJpfZ1CZBVIvVYXCsSWr310/5Xm84flkGHbGMqQsfzEx8kA5ODFqpMgrHP 0dpF03dQVYM8JJ8A882EHvHW5C2DIh8uQT8q5/QQomZssY+P3MNS4KKGG5UoVArMWopb aoIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wiVVxMbOQ5TWCQDTABSZ8DNiU0CXkMfV22ZofNfRj2U=; b=EmJ+hWi1M1A8z0ztml6KcosOMdonNf113bFl8h8ckynJqOj49yrJyAgT0J8CGO+/Ws avg4KKKw+Spm7he08ZNILmlgLPXja0Dxl56zs6eiBz0e+m8eLrVqgT/ejC5GHnbuBFDa l8tZ0W6burNdpg2RsIff6gKFyDSSQvzxPIANDvjN1/4NDQ3cUfl4Hsv1xCub/Cu/E5ld aljl8ts+wdwMoiv0/ui2vhl8VhOkaVYmt8czWy8B0ufcBDAovhgvWa4JMnPTGIabg8Fl KEPl7arTEm+V2jKSuRbMj2Cp9yWuIgVPmaI5cf5zfNu+tQRzDvKkC3OZLCnVypEZJaCQ viLw== X-Gm-Message-State: APf1xPDWcLPQ/k/+WnG5rop6zRPkjY5JoerUltSbs54j0NniMHzCInbO MTB2sxFc0GqwX2Hj/1StwCxlJIG+5KeMZJV8eKA= X-Google-Smtp-Source: AH8x2271DpZNuGVOWNu8+sml6caddsbewrpVzKLxguJPr+OuuGT4pIM+JkTXZRx4IwuVDsCJGWYyFj5CEpuqwP+4A3k= X-Received: by 10.46.74.17 with SMTP id x17mr5977308lja.84.1518371863287; Sun, 11 Feb 2018 09:57:43 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Philipp Stephani Date: Sun, 11 Feb 2018 17:57:32 +0000 Message-ID: Content-Type: multipart/alternative; boundary="f403045ec6468c5c690564f37f3a" X-Spam-Score: 0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --f403045ec6468c5c690564f37f3a Content-Type: text/plain; charset="UTF-8" Anders Lindgren schrieb am Sa., 2. Jan. 2016 um 09:08 Uhr: > 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. > In the current master this is now interpreted as M-s-9, which is at least somewhat reasonable. > > 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. > It seems like in the macOS input model, we can't: either we strip away all modifiers, or none. > > -- 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 >> >> > --f403045ec6468c5c690564f37f3a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Anders= Lindgren <andlind@gmail.com>= ; schrieb am Sa., 2. Jan. 2016 um 09:08=C2=A0Uhr:
I found a case where the code in question i= s needed, which none of the suggested patches handle correctly.

Steps to repeat:

=C2=A0 =C2=A0=C2=A0(setq = ns-alternate-modifier nil)

=C2=A0 =C2=A0 Press lef= t CMD-ALT-9

=C2=A0 =C2=A0 An unmodified Emacs repl= ies "s-]" is not bound. (This assumes a Swedish keyboard layout, = other layouts would yield a different character, but the principle is the s= ame).

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

In the current master this is = now interpreted as M-s-9, which is at least somewhat reasonable.
= =C2=A0

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

<= div>It seems like in the macOS input model, we can't: either we strip a= way all modifiers, or none.
=C2=A0

=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 key binding bug on OS X rep= orted multiple times (19977, 21330, 21551). Two different 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 ema= cs_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 (default), take input mana= ger'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, Qsuper)
=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 && [[theEvent charact= ers] length] !=3D 0)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {<= /div>
=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 modifier, must convert oursel= ves */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!(fla= gs & NSShiftKeyMask))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 code =3D [[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 rem= oved?

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 stil= l seems to be working as intended, both with a normal key layout and when D= vorak is used. If no one comes up with a reason to keep the code, I will re= move it.

Third question: Does anybody know of a go= od 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 poss= ible to write tests ensuring that things like this don't break in the f= uture.

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


--f403045ec6468c5c690564f37f3a-- From unknown Mon Aug 18 11:26:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21551: Fix Mac OS X key bindings bug Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Feb 2018 18:57:01 +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 To: Philipp Stephani Cc: 21551@debbugs.gnu.org, Kai Yu Zhang , Mikhail Gusarov , Anders Lindgren Received: via spool by 21551-submit@debbugs.gnu.org id=B21551.151854819328424 (code B ref 21551); Tue, 13 Feb 2018 18:57:01 +0000 Received: (at 21551) by debbugs.gnu.org; 13 Feb 2018 18:56:33 +0000 Received: from localhost ([127.0.0.1]:41784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elfkm-0007ON-KI for submit@debbugs.gnu.org; Tue, 13 Feb 2018 13:56:32 -0500 Received: from mail-wr0-f170.google.com ([209.85.128.170]:33745) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elfkk-0007O9-CJ for 21551@debbugs.gnu.org; Tue, 13 Feb 2018 13:56:31 -0500 Received: by mail-wr0-f170.google.com with SMTP id s5so19654758wra.0 for <21551@debbugs.gnu.org>; Tue, 13 Feb 2018 10:56:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=+LnWwDjMaBYjLnGCplLNOeVXtwWtYZYlfUO1teusnH8=; b=Ra4ioR8NqloIMBTDX3jwd2JdQ275UJ7zXBPJvqQzoaiSmMKb7rTW2WZBCT5j29nipr SKNPo8CZHfzDKXJ16Umajq4g5Fk8ZzYM+hil8jehiHGTE8JvP7VH09CsvLHVT3XWSszS 4u6+OwlPqtIIcj0JYnlS6VIl6ZwcZvOcgA/EesXXDNHzfu6F6zSm3LoeBw/CfaNLvrps HPlby7S0xzZ8SsRrR/XsB0cXq6HHBOegEQfMoKKeLQ1sUTCU/kluYnYwyi7XfA73/dWL 8t9ec8bY2ZbgUXHmmBC42P+RkI/MhHfv7SA7lPpfx+QlYh4ZOY66g0ILsNfpcWqHKx6u w20A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=+LnWwDjMaBYjLnGCplLNOeVXtwWtYZYlfUO1teusnH8=; b=dtynIzq+2TJTB3RHqxWpUo9pBQhMD7YNcgAd2z5ASkHs9pSiZ0s7KFt7F7d2MhlmAf g3Eg0dW/KBWYE1kyM/8rKSrz/ojmwbmIoPEOqqtVGvfY/4Kn4zbjU6AKseapnF9TU9Uu o6THZKpd47L3HSE1EkVDQub3Fg7oby2h4KjK5p1fJXm/yy/gkJLVVQOZIHCa1GMkxWuK c4MeOEoKHmTj9Evf9HUPHpRFzaGCtQhs5I9Ccd6hjceW2IaQe/xrLDC624hnrapT5oN1 BDou6dOICsWufEiCNTw8/HT0RRMnVgOBk1se8kxgQ2I0vgctFFtRXQAyz1m7oJxVgOJj lCug== X-Gm-Message-State: APf1xPB4NYW2cZ+LXZrp/IvUmNxVZtJNMFC5Gw5mVM+411J5bnnnS0xx WK+/GZKQ+XXp1C+lDfwRWAk= X-Google-Smtp-Source: AH8x225CIcjxnqOIEPzhz+0Sq0QXUinlB4jsBBobxc2cKnqVEBCu2RVpdE0CW2J7y6b2lCIzRosT5Q== X-Received: by 10.223.150.194 with SMTP id u60mr2108282wrb.47.1518548184142; Tue, 13 Feb 2018 10:56:24 -0800 (PST) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-0d0e-7c04-950c-8f24.holly.idiocy.org. [2001:8b0:3f8:8129:d0e:7c04:950c:8f24]) by smtp.gmail.com with ESMTPSA id 137sm8821320wmm.46.2018.02.13.10.56.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 10:56:22 -0800 (PST) Date: Tue, 13 Feb 2018 18:56:20 +0000 From: Alan Third Message-ID: <20180213185620.GA70726@breton.holly.idiocy.org> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="zYM0uCDKw75PZbzx" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Sun, Feb 11, 2018 at 05:57:32PM +0000, Philipp Stephani wrote: > Anders Lindgren schrieb am Sa., 2. Jan. 2016 um > 09:08 Uhr: > > > 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. > > > > In the current master this is now interpreted as M-s-9, which is at least > somewhat reasonable. For me it’s s-9, not M-s-9. > > 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. > > > > It seems like in the macOS input model, we can't: either we strip away all > modifiers, or none. It appears you can using some Carbon stuff. Half‐assed proof of concept patch attached. (It’s broken the arrow keys, and I don’t know why...) -- Alan Third --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="poc.patch" diff --git a/configure.ac b/configure.ac index f2a8332d71..b5db45801d 100644 --- a/configure.ac +++ b/configure.ac @@ -5260,7 +5260,7 @@ AC_DEFUN if test "$HAVE_NS" = "yes"; then libs_nsgui="-framework AppKit" if test "$NS_IMPL_COCOA" = "yes"; then - libs_nsgui="$libs_nsgui -framework IOKit" + libs_nsgui="$libs_nsgui -framework IOKit -framework Carbon" fi else libs_nsgui= diff --git a/src/nsterm.m b/src/nsterm.m index 29aef0e9b6..2038c02e60 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -69,6 +69,8 @@ Updated by Christian Limpach (chris@nice.ch) #include "macfont.h" #endif +#include + static EmacsMenu *dockMenu; #ifdef NS_IMPL_COCOA static EmacsMenu *mainMenu; @@ -2681,6 +2683,45 @@ so some key presses (TAB) are swallowed by the system. */ } +static UniChar +ns_get_shifted_character (NSEvent *event) +{ + static UInt32 deadKeyState; + + CFDataRef layout_ref = (CFDataRef) TISGetInputSourceProperty + (TISCopyCurrentKeyboardLayoutInputSource (), kTISPropertyUnicodeKeyLayoutData); + UCKeyboardLayout* layout = CFDataGetBytePtr (layout_ref); + + UniChar buf[255]; + UniCharCount maxStringLength; + UniCharCount actualStringLength; + OSStatus result; + + unsigned int flags = [event modifierFlags]; + UInt32 modifiers = (flags & NSEventModifierFlagShift) ? shiftKey : 0; + modifiers |= ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask + && EQ (ns_right_alternate_modifier, Qnone)) ? rightOptionKey : 0; + modifiers |= ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask + && EQ (ns_alternate_modifier, Qnone)) ? optionKey : 0; + + modifiers |= ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask + && EQ (ns_right_command_modifier, Qnone)) ? cmdKey : 0; + modifiers |= ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask + && EQ (ns_command_modifier, Qnone)) ? cmdKey : 0; + + result = UCKeyTranslate (layout, + [event keyCode], kUCKeyActionDown, + (modifiers >> 8) & 0xFF, + LMGetKbdType (), kUCKeyTranslateNoDeadKeysBit, + &deadKeyState, 255, &actualStringLength, + buf); + + if (result != 0) + NSLog(@"Disaster!"); + + return buf[0]; +} + /* ========================================================================== @@ -6147,7 +6188,8 @@ most recently updated (I guess), which is not the correct one. */ /* FIXME: What should happen for key sequences with more than one character? */ code = ([[theEvent charactersIgnoringModifiers] length] == 0) ? - 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; + 0 : //[[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; + ns_get_shifted_character (theEvent); /* (Carbon way: [theEvent keyCode]) */ --zYM0uCDKw75PZbzx-- From unknown Mon Aug 18 11:26:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21551: Fix Mac OS X key bindings bug Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Feb 2018 21:45: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 To: Philipp Stephani Cc: 21551@debbugs.gnu.org, Kai Yu Zhang , Mikhail Gusarov , Anders Lindgren Received: via spool by 21551-submit@debbugs.gnu.org id=B21551.15186446978352 (code B ref 21551); Wed, 14 Feb 2018 21:45:02 +0000 Received: (at 21551) by debbugs.gnu.org; 14 Feb 2018 21:44:57 +0000 Received: from localhost ([127.0.0.1]:43394 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1em4rI-0002Ae-U8 for submit@debbugs.gnu.org; Wed, 14 Feb 2018 16:44:57 -0500 Received: from mail-wr0-f174.google.com ([209.85.128.174]:43144) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1em4rG-0002AR-Ea for 21551@debbugs.gnu.org; Wed, 14 Feb 2018 16:44:56 -0500 Received: by mail-wr0-f174.google.com with SMTP id b52so1394939wrd.10 for <21551@debbugs.gnu.org>; Wed, 14 Feb 2018 13:44:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=pI09UTvCQ59f2sjsCwqUhQ6h48GiuWHqsx0RuGMTwcI=; b=ZOCImcKigc9UN4hb4zIoOTFbxuyRtMAoSOVHI6WiUdzqSjM5enQDLwbIBxULCelSkX +gJ2oqNp4OSnZmiPMuKBhbiLD+1iX4w666E/xsOgrEVKB1uvMb4OJxmwabJYFM6rOamq raZcdCn04oany6tPMhei6Vvx5LPbeIRlpoNPEMyAD2uvNo7qTau3GXtmIyCUSE+LdarG LpWO6cL60W74wITwGy2iMmAoice8ViJSaDurv0mTIZmHQmLcgHNDShIgmojHSO7n+b0o /MyYxt2kdIBtjopQOzxqzm1wbd32cphyleBB6tqFWc2SclxToItamLk/Dwb0EsPBhhtL 3CcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=pI09UTvCQ59f2sjsCwqUhQ6h48GiuWHqsx0RuGMTwcI=; b=r4xvfRvpU8gCc75RH6vQxMOBres6BXs709WhJB2/etcQCcbA+w2WknT/WvFub1P0ZN /CWIoCyEaeHXaEvNQ2MynE+f1hHe/b1Q2pBMbpADp5RKQTRIKXceCS69QZoh7VDVJs4K 9PYJqxHkn0KMqh5+JOe34Crw4HCIt9IE4kgR9busTE36Qtvx3MSQcDK9hk5JBz+fKW47 Ka3RiMS4EsRJd5MvnJOYCH9dOVELWEm6zHXSlJt60ZA9ril2kCAQMowSlr8WqurjtUz/ XlUKgARhu8pWtiEkdW3RRBQFp4C4pF8r6Zglz6/EeGMNLYsxjfoUDe+cGXwZ3D588ecF JeIQ== X-Gm-Message-State: APf1xPAA1HBhOhkT54XBZvevkJCq73ycVFfG08W+4rnlvNaunqjDDxQ8 It/dn2wsxNBMdyvsfavrhiE= X-Google-Smtp-Source: AH8x225qDmrk4R1qYuei2aVSElu1UdIB7WSng18EBZzteqKZGmXF8/RJ6Ts1AkGEeBoqUXShvD8eQA== X-Received: by 10.223.182.65 with SMTP id i1mr520786wre.24.1518644688514; Wed, 14 Feb 2018 13:44:48 -0800 (PST) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-913b-4aa7-5fb8-b2de.holly.idiocy.org. [2001:8b0:3f8:8129:913b:4aa7:5fb8:b2de]) by smtp.gmail.com with ESMTPSA id x19sm13341204wrd.7.2018.02.14.13.44.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Feb 2018 13:44:46 -0800 (PST) Date: Wed, 14 Feb 2018 21:44:44 +0000 From: Alan Third Message-ID: <20180214214444.GA1267@breton.holly.idiocy.org> References: <20180213185620.GA70726@breton.holly.idiocy.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="PNTmBPCT7hxwcZjr" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180213185620.GA70726@breton.holly.idiocy.org> User-Agent: Mutt/1.9.3 (2018-01-21) X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) --PNTmBPCT7hxwcZjr Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Tue, Feb 13, 2018 at 06:56:20PM +0000, Alan Third wrote: > On Sun, Feb 11, 2018 at 05:57:32PM +0000, Philipp Stephani wrote: > > It seems like in the macOS input model, we can't: either we strip away all > > modifiers, or none. > > It appears you can using some Carbon stuff. Half‐assed proof of > concept patch attached. Better version attached. Is there any reason to avoid Carbon code? I’m not aware of any, and if it’s OK then I think this finally solves this problem. (It might be best to get someone with a different keyboard layout than me to test it. The only reason I have for using alt as a shift key is to type ‘#’ or ‘€’.) -- Alan Third --PNTmBPCT7hxwcZjr Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0001-Fix-modifier-key-handling-on-macOS.patch" Content-Transfer-Encoding: 8bit >From 398c954448cf27f9ae13a358aa381e8cdcb16e10 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Wed, 14 Feb 2018 20:28:46 +0000 Subject: [PATCH] Fix modifier key handling on macOS * configure.ac: Use the Carbon framework on macOS. * src/nsterm.m (ns_get_shifted_character): New function. (EmacsView::keyDown): Use ns_get_shifted_character when we have shift style modifiers. --- configure.ac | 2 +- src/nsterm.m | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 91 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index cb452e053b..cf0347a61e 100644 --- a/configure.ac +++ b/configure.ac @@ -5269,7 +5269,7 @@ AC_DEFUN if test "$HAVE_NS" = "yes"; then libs_nsgui="-framework AppKit" if test "$NS_IMPL_COCOA" = "yes"; then - libs_nsgui="$libs_nsgui -framework IOKit" + libs_nsgui="$libs_nsgui -framework IOKit -framework Carbon" fi else libs_nsgui= diff --git a/src/nsterm.m b/src/nsterm.m index 627a61cac6..3f74f4131f 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -69,6 +69,8 @@ Updated by Christian Limpach (chris@nice.ch) #include "macfont.h" #endif +#include + static EmacsMenu *dockMenu; #ifdef NS_IMPL_COCOA static EmacsMenu *mainMenu; @@ -2679,7 +2681,78 @@ so some key presses (TAB) are swallowed by the system. */ return value; } +#ifdef NS_IMPL_COCOA +static UniChar +ns_get_shifted_character (NSEvent *event) +/* Look up the character corresponding to the key pressed on the + current keyboard layout and the currently configured shift-like + modifiers. This ignores the control-like modifiers that cause + [event characters] to give us the wrong result. + + Although UCKeyTranslate doesn't require the Carbon framework, some + of the surrounding paraphernalia does, so this function makes + Carbon a requirement. */ +{ + static UInt32 dead_key_state; + + /* UCKeyTranslate may return up to 255 characters. If the buffer + isn't large enough then it produces an error. What kind of + keyboard inputs 255 characters in a single keypress? */ + UniChar buf[255]; + UniCharCount max_string_length = 255; + UniCharCount actual_string_length = 0; + OSStatus result; + + CFDataRef layout_ref = (CFDataRef) TISGetInputSourceProperty + (TISCopyCurrentKeyboardLayoutInputSource (), kTISPropertyUnicodeKeyLayoutData); + UCKeyboardLayout* layout = (UCKeyboardLayout*) CFDataGetBytePtr (layout_ref); + + UInt32 flags = [event modifierFlags]; + UInt32 modifiers = (flags & NSEventModifierFlagShift) ? shiftKey : 0; + + NSTRACE ("ns_get_shifted_character"); + + if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask + && (EQ (ns_right_alternate_modifier, Qnone) + || (EQ (ns_right_alternate_modifier, Qleft) + && EQ (ns_alternate_modifier, Qnone)))) + modifiers |= rightOptionKey; + + if ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask + && EQ (ns_alternate_modifier, Qnone)) + modifiers |= optionKey; + + if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask + && (EQ (ns_right_command_modifier, Qnone) + || (EQ (ns_right_command_modifier, Qleft) + && EQ (ns_command_modifier, Qnone)))) + /* Carbon doesn't differentiate between left and right command + keys. */ + modifiers |= cmdKey; + + if ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask + && EQ (ns_command_modifier, Qnone)) + modifiers |= cmdKey; + + result = UCKeyTranslate (layout, [event keyCode], kUCKeyActionDown, + (modifiers >> 8) & 0xFF, LMGetKbdType (), + kUCKeyTranslateNoDeadKeysBit, &dead_key_state, + max_string_length, &actual_string_length, buf); + + if (result != 0) + { + NSLog(@"Failed to translate character '%@' with modifiers %x", + [event characters], modifiers); + return 0; + } + /* FIXME: What do we do if more than one code unit is returned? */ + if (actual_string_length > 0) + return buf[0]; + + return 0; +} +#endif /* NS_IMPL_COCOA */ /* ========================================================================== @@ -6148,8 +6221,6 @@ most recently updated (I guess), which is not the correct one. */ code = ([[theEvent charactersIgnoringModifiers] length] == 0) ? 0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0]; - /* (Carbon way: [theEvent keyCode]) */ - /* is it a "function key"? */ /* Note: Sometimes a plain key will have the NSEventModifierFlagNumericPad flag set (this is probably a bug in the OS). @@ -6191,8 +6262,8 @@ untranslated characters (returned by the charactersIgnoringModifiers method). An annoyance happens if we have both shift-like and control-like modifiers because the NSEvent API doesn’t let us ignore only some modifiers. - Therefore we ignore all shift-like modifiers in that - case. */ + In that case we use UCKeyTranslate (ns_get_shifted_character) + to look up the correct character. */ /* EV_MODIFIERS2 uses parse_solitary_modifier on all known modifier keys, which returns 0 for shift-like modifiers. @@ -6218,7 +6289,6 @@ untranslated characters (returned by the if (fnKeysym || (emacs_event->modifiers && (emacs_event->modifiers != shift_modifier) && [[theEvent charactersIgnoringModifiers] length] > 0)) -/*[[theEvent characters] length] */ { emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT; /* FIXME: What are the next four lines supposed to do? */ @@ -6227,12 +6297,21 @@ untranslated characters (returned by the else if (code == 0x7f) code |= (1<<28)|(3<<16); else if (!fnKeysym) - /* FIXME: This seems wrong, characters in the range - [0x80, 0xFF] are not ASCII characters. Can’t we just - use MULTIBYTE_CHAR_KEYSTROKE_EVENT here for all kinds - of characters? */ - emacs_event->kind = code > 0xFF - ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT; + { +#ifdef NS_IMPL_COCOA + /* We potentially have both shift- and control-like + modifiers in use, so find the correct character + ignoring any control-like ones. */ + code = ns_get_shifted_character (theEvent); +#endif + + /* FIXME: This seems wrong, characters in the range + [0x80, 0xFF] are not ASCII characters. Can’t we just + use MULTIBYTE_CHAR_KEYSTROKE_EVENT here for all kinds + of characters? */ + emacs_event->kind = code > 0xFF + ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT; + } emacs_event->code = code; EV_TRAILER (theEvent); -- 2.16.1 --PNTmBPCT7hxwcZjr-- From unknown Mon Aug 18 11:26:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21551: Fix Mac OS X key bindings bug Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Feb 2018 12:37: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 To: Philipp Stephani Cc: 21551@debbugs.gnu.org, Kai Yu Zhang , Mikhail Gusarov , Anders Lindgren Received: via spool by 21551-submit@debbugs.gnu.org id=B21551.151887100111407 (code B ref 21551); Sat, 17 Feb 2018 12:37:02 +0000 Received: (at 21551) by debbugs.gnu.org; 17 Feb 2018 12:36:41 +0000 Received: from localhost ([127.0.0.1]:47571 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1en1jM-0002xv-OK for submit@debbugs.gnu.org; Sat, 17 Feb 2018 07:36:40 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33441) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1en1jK-0002xh-FP for 21551@debbugs.gnu.org; Sat, 17 Feb 2018 07:36:38 -0500 Received: by mail-wr0-f195.google.com with SMTP id s5so5334934wra.0 for <21551@debbugs.gnu.org>; Sat, 17 Feb 2018 04:36:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=/q8JH67hG8XKpMQr0R2WyNtkaM6iQ0qK1SYKmOov+kY=; b=L6F5ZF6V6GFy4/qnykoyNvcVq/goMXamEfkyjGH+zWrmOgEyj9Q3cwL10D0MQSLVT7 gshgJIVAOVsj5QOYBS/JZox+SIPvEeS1YMmNDgHgfBOUCbPWikD3EBzUhizqQgjC6YCg bd9cY5c7qm5dqT+tqnQEvkHVGwHz6mC0CiH2TWjX5VhjjhjM201A6e5BCcWO16ACnGZt PpKS7m3KEFEkAkH1PEOAtfSBXArJIkAi8tBPrNMhrljc5T7qXAn34uPRO5teRWT15FbA OtYXp1lqrWL8azUwSkEWjSsDJWR6scPTAWb/uFo/uL4WteDw/tppWlqITHDF6NFn13+I BpJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=/q8JH67hG8XKpMQr0R2WyNtkaM6iQ0qK1SYKmOov+kY=; b=NHpODs95oNYJd3Ky2U/pI2mFRa6okeYDwOXn5oKvbXGhPCOfcSEiH6ACk7jRN+u7L2 bJsV1kUdFs0TYvFf8GnHKsXGROHhbUNom5SL89xCm4ld35fH7zEj6aADR+OtfXhaL6C8 8GicbEGo/AxbzZwkytXJr2O2xfVmRiOL/54JvWfP1OnLlKEpsmGyel5t0S6eLdcIX/Y+ zWg22aml5qzoaODeDxW+viXavcYMtGoMjNl9UZLQKZ7WjitfUOCByduPFLa5hgujek4w hTNvWsqml0wW5GdpOI6dzD6ikqHQZKgfYhre1UyH2vXvILwgOhKWwj4kcRJ02C0UL7EM x1Ow== X-Gm-Message-State: APf1xPBVfsj529U1Q5XKFRO67rxknTlic1BOUAJQMPhNtHps43MVVyBy OMcEw3drB9Zas4+RSTQAWqg= X-Google-Smtp-Source: AH8x226SQXg1mb6fCGTFc8lg9v2TzGy6w52ShXKyqPSvshoIrEA1pG8KfrKDXlKTealsK4yVIWRJSw== X-Received: by 10.223.182.174 with SMTP id j46mr8796378wre.43.1518870992660; Sat, 17 Feb 2018 04:36:32 -0800 (PST) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-39a3-5d19-344b-9f69.holly.idiocy.org. [2001:8b0:3f8:8129:39a3:5d19:344b:9f69]) by smtp.gmail.com with ESMTPSA id u63sm1933823wrc.26.2018.02.17.04.36.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Feb 2018 04:36:31 -0800 (PST) Date: Sat, 17 Feb 2018 12:36:29 +0000 From: Alan Third Message-ID: <20180217123629.GB40209@breton.holly.idiocy.org> References: <20180213185620.GA70726@breton.holly.idiocy.org> <20180214214444.GA1267@breton.holly.idiocy.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180214214444.GA1267@breton.holly.idiocy.org> User-Agent: Mutt/1.9.3 (2018-01-21) X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) On Wed, Feb 14, 2018 at 09:44:44PM +0000, Alan Third wrote: > On Tue, Feb 13, 2018 at 06:56:20PM +0000, Alan Third wrote: > > On Sun, Feb 11, 2018 at 05:57:32PM +0000, Philipp Stephani wrote: > > > It seems like in the macOS input model, we can't: either we strip away all > > > modifiers, or none. > > > > It appears you can using some Carbon stuff. Half‐assed proof of > > concept patch attached. > > Better version attached. Pushed to master. -- Alan Third From unknown Mon Aug 18 11:26:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21551: Fix Mac OS X key bindings bug Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Feb 2018 22:00: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 To: Alan Third Cc: 21551@debbugs.gnu.org, Kai Yu Zhang , Mikhail Gusarov , Anders Lindgren Received: via spool by 21551-submit@debbugs.gnu.org id=B21551.151899118722697 (code B ref 21551); Sun, 18 Feb 2018 22:00:02 +0000 Received: (at 21551) by debbugs.gnu.org; 18 Feb 2018 21:59:47 +0000 Received: from localhost ([127.0.0.1]:50247 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1enWzr-0005u0-3b for submit@debbugs.gnu.org; Sun, 18 Feb 2018 16:59:47 -0500 Received: from mail-lf0-f51.google.com ([209.85.215.51]:42123) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1enWzq-0005tn-1i for 21551@debbugs.gnu.org; Sun, 18 Feb 2018 16:59:46 -0500 Received: by mail-lf0-f51.google.com with SMTP id t204so7961269lff.9 for <21551@debbugs.gnu.org>; Sun, 18 Feb 2018 13:59:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=giB/Or20pjvdjGbrBbsGGq+Hp9VJUBfdsg2XPIGcy20=; b=u2TtFX9jngu5KakAyMg83L8gI0BWA7q14fliWVQxvY+q0h/eiaZ6aKd0jKJEaBuVDw rTNoOqqr/gcHjymQzZFlO/UVKmMVqWynHsEZIAv7urUGGhXwSmsRdoIJnGCyOA9NwFdJ 2cagp30t32edgSaWKMdGsHg4ZplSBLDoaBAVQKaYVDekwVYn7K+7T3T4NrR9ooOfBlt7 Ne0II6L+qszlIBp9W61CyPbKVunfwjRxNNE8hfRbjx+f+8orxwYr2bnfTY/3dXWhen9D UbU6mBKBw+UaCfg907YAj/2zPweaTHMbM6CmedRnxFj7YQfF4/UG4Inevrn0rvz4dIVI 5qxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=giB/Or20pjvdjGbrBbsGGq+Hp9VJUBfdsg2XPIGcy20=; b=nsMzJfbvqUZHtW/Qu0rCZ7xr+DrXNA90qGFXOa4mjfl9iAN0VBDtYQZBPS8agtHv7l /8XQOFCxRN17M91Hex2gZ633KdzIfvJafOI/uOj0gk4rU9XH1Ls6aGVJJL5Sb58GMvfl VwcxEDI+J80bIFt4R/BQX+UJf+PDq/vTSxtKIGVkLvgCoAm/ixaguwkJa3vKuBi46wFW hwu6gMqzgaZy3bvxrwK4LC70q+55xlPUhm9mqHpmWcFFhOpr3TJC5jXierTXYGdOS5Lr QiiPTVFHstWQtXx0TDI904mtYnZD8ZsqQQgl8JOvDA7YxGAU5gL4MZq2ZMjpu74WCoun 7FcA== X-Gm-Message-State: APf1xPCqXYj0zp8p8QGcibbAsQWNSX/mWGl12Mu1s4ZvfzitosMdGSkQ /VM5Gz7JSRwbJo3Lh122Mv21L1r7iIncrlHmsl4= X-Google-Smtp-Source: AH8x226ukm+HkcplqHSAr4ZGqH1ty94oUiui+7DnOoFXIUMjV5kwE2i54MjLKWDXYF0Awaq5JiYpHmFyNNx4tWqmcDU= X-Received: by 10.25.193.78 with SMTP id r75mr8067168lff.124.1518991179928; Sun, 18 Feb 2018 13:59:39 -0800 (PST) MIME-Version: 1.0 References: <20180213185620.GA70726@breton.holly.idiocy.org> <20180214214444.GA1267@breton.holly.idiocy.org> In-Reply-To: <20180214214444.GA1267@breton.holly.idiocy.org> From: Philipp Stephani Date: Sun, 18 Feb 2018 21:59:29 +0000 Message-ID: Content-Type: multipart/alternative; boundary="94eb2c1a1b62b259b7056583b1af" X-Spam-Score: 0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --94eb2c1a1b62b259b7056583b1af Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Alan Third schrieb am Mi., 14. Feb. 2018 um 22:44 Uhr: > On Tue, Feb 13, 2018 at 06:56:20PM +0000, Alan Third wrote: > > On Sun, Feb 11, 2018 at 05:57:32PM +0000, Philipp Stephani wrote: > > > It seems like in the macOS input model, we can't: either we strip awa= y > all > > > modifiers, or none. > > > > It appears you can using some Carbon stuff. Half=E2=80=90assed proof of > > concept patch attached. > > Better version attached. > > Is there any reason to avoid Carbon code? I=E2=80=99m not aware of any, a= nd if > it=E2=80=99s OK then I think this finally solves this problem. > > Carbon is deprecated, isn't it? That means it's quite likely that patches relying on Carbon will have to be removed later, should Carbon be ever removed completely. For now, it's probably fine though to use Carbon if there's no alternative. --94eb2c1a1b62b259b7056583b1af Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Alan T= hird <alan@idiocy.org> schrieb= am Mi., 14. Feb. 2018 um 22:44=C2=A0Uhr:
On Tue, Feb 13, 2018 at 06:56:20PM +0000, Alan Third wrote:
> On Sun, Feb 11, 2018 at 05:57:32PM +0000, Philipp Stephani wrote:
> > It seems like in the macOS input model, we can't: either we s= trip away all
> > modifiers, or none.
>
> It appears you can using some Carbon stuff. Half=E2=80=90assed proof o= f
> concept patch attached.

Better version attached.

Is there any reason to avoid Carbon code? I=E2=80=99m not aware of any, and= if
it=E2=80=99s OK then I think this finally solves this problem.


Carbon is deprecated, isn't it? Th= at means it's quite likely that patches relying on Carbon will have to = be removed later, should Carbon be ever removed completely.
For n= ow, it's probably fine though to use Carbon if there's no alternati= ve.=C2=A0
--94eb2c1a1b62b259b7056583b1af-- From unknown Mon Aug 18 11:26:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#21551: Fix Mac OS X key bindings bug Resent-From: Richard Stallman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Feb 2018 15:06:01 +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 To: Philipp Stephani Cc: 21551@debbugs.gnu.org, alan@idiocy.org, dottedmag@dottedmag.net, yeannylam@gmail.com, andlind@gmail.com Reply-To: rms@gnu.org Received: via spool by 21551-submit@debbugs.gnu.org id=B21551.15190527545933 (code B ref 21551); Mon, 19 Feb 2018 15:06:01 +0000 Received: (at 21551) by debbugs.gnu.org; 19 Feb 2018 15:05:54 +0000 Received: from localhost ([127.0.0.1]:51435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1enn0r-0001Xd-OE for submit@debbugs.gnu.org; Mon, 19 Feb 2018 10:05:53 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52177) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1enn0q-0001XR-Ht for 21551@debbugs.gnu.org; Mon, 19 Feb 2018 10:05:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1enn0f-00068E-Gu for 21551@debbugs.gnu.org; Mon, 19 Feb 2018 10:05:47 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60791) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1enn0I-0005l6-5N; Mon, 19 Feb 2018 10:05:18 -0500 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1enn0H-0001nY-Pv; Mon, 19 Feb 2018 10:05:17 -0500 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman In-reply-to: (message from Philipp Stephani on Sun, 18 Feb 2018 21:59:29 +0000) References: <20180213185620.GA70726@breton.holly.idiocy.org> <20180214214444.GA1267@breton.holly.idiocy.org> Message-Id: Date: Mon, 19 Feb 2018 10:05:17 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > Carbon is deprecated, isn't it? Does that mean we are in favor of carbon omissions? ;-). -- Dr Richard Stallman President, Free Software Foundation (https://gnu.org, https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) Skype: No way! See https://stallman.org/skype.html.