From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#29595: 26.0.90; menu items show incorrect shortcut keys Date: Fri, 22 Dec 2017 12:34:33 +0000 Message-ID: <20171222123433.GA36334@breton.holly.idiocy.org> References: <1512610506.1321010.1196716904.28D41DCB@webmail.messagingengine.com> <1513919792.1032331.1213126968.1E43DDA8@webmail.messagingengine.com> <83o9mrmdet.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Dxnq1zWXvFF0Q93v" Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1513945998 2342 195.159.176.226 (22 Dec 2017 12:33:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 22 Dec 2017 12:33:18 +0000 (UTC) User-Agent: Mutt/1.9.1 (2017-09-22) Cc: 29595@debbugs.gnu.org, Paul Rankin To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 22 13:33:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSMVi-0000A0-UJ for geb-bug-gnu-emacs@m.gmane.org; Fri, 22 Dec 2017 13:33:11 +0100 Original-Received: from localhost ([::1]:48477 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSMXh-00056n-Fk for geb-bug-gnu-emacs@m.gmane.org; Fri, 22 Dec 2017 07:35:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSMXa-00056K-0C for bug-gnu-emacs@gnu.org; Fri, 22 Dec 2017 07:35:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSMXW-0004OK-1c for bug-gnu-emacs@gnu.org; Fri, 22 Dec 2017 07:35:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38293) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eSMXV-0004Nz-Ue for bug-gnu-emacs@gnu.org; Fri, 22 Dec 2017 07:35:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eSMXV-0002B8-JA for bug-gnu-emacs@gnu.org; Fri, 22 Dec 2017 07:35:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 22 Dec 2017 12:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29595 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29595-submit@debbugs.gnu.org id=B29595.15139460858348 (code B ref 29595); Fri, 22 Dec 2017 12:35:01 +0000 Original-Received: (at 29595) by debbugs.gnu.org; 22 Dec 2017 12:34:45 +0000 Original-Received: from localhost ([127.0.0.1]:46974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSMXF-0002Aa-5I for submit@debbugs.gnu.org; Fri, 22 Dec 2017 07:34:45 -0500 Original-Received: from mail-wm0-f51.google.com ([74.125.82.51]:40864) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSMXD-0002AN-Au for 29595@debbugs.gnu.org; Fri, 22 Dec 2017 07:34:43 -0500 Original-Received: by mail-wm0-f51.google.com with SMTP id f206so21313501wmf.5 for <29595@debbugs.gnu.org>; Fri, 22 Dec 2017 04:34:43 -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=2Aq6HAk+HlTZzN0wOrcgPruEoB8AQJH/UBSr26v1+eY=; b=E9fVc2pdNnJKeZDJAAGjWlb+QxXMnbMGgGVLo7mxFak+v1WUfe1QIGK2FaGffemqdc Sxm3Vo5BfM9vF07fRdMhKOyYqHJ9v25Tcrnzf5VjGMgyRi4/zpxgD2iXAzen8IprR+oH ZDuaytCx2Qv0LTM34JKIsxIcd4xYDIvrAN3jiBh711rCOY6O32kPT6vEsU/Ta591ROsL KHwTk4WnXuZ5eLSejYn9mNBag6dN6o5n0LXiLb/k1lTb5Eq+BRaedRNHTUBHpI8FrJdW snVMId8V0Dk074QSnVYfFRvj6qohyQk9nmUbLyfor/C2miGzLHlNWH+bosqsHNIySl72 XhIA== 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=2Aq6HAk+HlTZzN0wOrcgPruEoB8AQJH/UBSr26v1+eY=; b=LTy7WWbAgXPrp7oDTx7eHVWW1jToHso09+BwPqqSDqmxDvBJBeAtL5rvhdAJS9R6PY Q+tvePTrDexcn34otaYotsqVyb//6xGVV3mtMJJ0khYistCat8yMfchJx+/HN4aD1g30 wMtU3TaYpKhRhzskHIv7kk+ggN5pTVFWu+eOequmCFAtyGGW+6kknQ39iypXWkBqo4Uf Qi5MwMNnZvctXScfhEJhe+/33PT3IF4j007f0v+g3pYOKg1qTjfejJjfl+I3Lqojt/RT rRcDNy5rWNZtqltB66qXgEbUcFlahR7Gv6vQmi6/3hi+Nk1md0eRjXir0xKiZZIj9Zcg 6DFg== X-Gm-Message-State: AKGB3mKiNekmGIfp/lHQNVm4v/Nq5LhyTVZU3plWVBPVHNIfPU9fEoyJ x8sksJQQDwMhu9/V6xor9gA= X-Google-Smtp-Source: ACJfBotgMItyjG8sQ4193IAJpIve8g8nc+btTxXfQjOCHQz+EDW93vI5BHh+1vYjB/fhDWFWOaJyow== X-Received: by 10.28.134.133 with SMTP id i127mr12864504wmd.79.1513946077385; Fri, 22 Dec 2017 04:34:37 -0800 (PST) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-2872-d519-1675-2de8.holly.idiocy.org. [2001:8b0:3f8:8129:2872:d519:1675:2de8]) by smtp.gmail.com with ESMTPSA id 192sm6502838wmg.32.2017.12.22.04.34.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Dec 2017 04:34:36 -0800 (PST) Content-Disposition: inline In-Reply-To: <83o9mrmdet.fsf@gnu.org> 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" Xref: news.gmane.org gmane.emacs.bugs:141369 Archived-At: --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Fri, Dec 22, 2017 at 09:26:18AM +0200, Eli Zaretskii wrote: > > From: Paul Rankin > > Date: Fri, 22 Dec 2017 15:16:32 +1000 > > > > I’ve now tested this with Emacs versions 24.4, 25.4, 26.0.90 and HEAD > > with the same results; this hasn’t happened for me with 24.x in the > > past, so it appears that something has changed with macOS High Sierra > > that screws up the display of shortcut keys in the menus. > > You are probably right. It seems that older macOS versions ignored keyboard shortcuts they didn’t understand, but High Sierra appears to use a ‘best effort’ attempt which results in it just printing out the first character (capital C for ctrl, so shift‐C). I’ve attached a patch that I hope fixes it. -- Alan Third --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-menu-keyboard-shortcuts-on-macOS-Bug-29595.patch" >From 3ca7f2e2113eeace6b75f5f4b86bbcc4be609807 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Fri, 22 Dec 2017 12:27:05 +0000 Subject: [PATCH] Fix menu keyboard shortcuts on macOS (Bug#29595) * src/nsmenu.m (addItemWithWidgetValue)[NS_IMPL_COCOA]: It looks like macOS 10.13 no longer ignores long modifier strings, so explicitly use an empty string. --- src/nsmenu.m | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/nsmenu.m b/src/nsmenu.m index 6ef7b60dc2..d2e102a2a9 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -643,14 +643,23 @@ - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr keyEq = [self parseKeyEquiv: wv->key]; #ifdef NS_IMPL_COCOA - /* macOS just ignores modifier strings longer than one character */ + /* macOS mangles modifier strings longer than one character. */ if (keyEquivModMask == 0) - title = [title stringByAppendingFormat: @" (%@)", keyEq]; + { + title = [title stringByAppendingFormat: @" (%@)", keyEq]; + item = [self addItemWithTitle: (NSString *)title + action: @selector (menuDown:) + keyEquivalent: @""]; + } + else + { +#endif + item = [self addItemWithTitle: (NSString *)title + action: @selector (menuDown:) + keyEquivalent: keyEq]; +#ifdef NS_IMPL_COCOA + } #endif - - item = [self addItemWithTitle: (NSString *)title - action: @selector (menuDown:) - keyEquivalent: keyEq]; [item setKeyEquivalentModifierMask: keyEquivModMask]; [item setEnabled: wv->enabled]; -- 2.14.3 --Dxnq1zWXvFF0Q93v--