From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Dec 2020 14:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 45502@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.160916541932430 (code B ref -1); Mon, 28 Dec 2020 14:24:02 +0000 Received: (at submit) by debbugs.gnu.org; 28 Dec 2020 14:23:39 +0000 Received: from localhost ([127.0.0.1]:34684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kttQx-0008R0-1W for submit@debbugs.gnu.org; Mon, 28 Dec 2020 09:23:39 -0500 Received: from lists.gnu.org ([209.51.188.17]:59098) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kttQv-0008Qt-RP for submit@debbugs.gnu.org; Mon, 28 Dec 2020 09:23:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kttQv-0001bX-L4 for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2020 09:23:37 -0500 Received: from mail212c50.megamailservers.eu ([91.136.10.222]:59906 helo=mail194c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kttQs-00030m-OY for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2020 09:23:37 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609165408; bh=fU0paIHjuXiqMuDrb3jUBowpt4ocBax5qDEIlmSorxI=; h=From:Subject:Date:To:From; b=QRUDTcGRDOLUYK+5R2T/c0PQMOBfI7rMZpLeoz2Y4M2lUMD5XbrqIY7+TkIniu+V5 NuZzpHki6p02GvzihGNyyLRK7tZbTBQrDNQaaf8xdBjZdC2QikKIqol6+T6rlYo+G4 vP/R7uW/Gku5oCtsBNJfOEQy7lhB0LIxU3/IGhyA= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BSENQJD007881 for ; Mon, 28 Dec 2020 14:23:27 +0000 From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Content-Type: multipart/mixed; boundary="Apple-Mail=_F8693C92-8DE6-46E3-B196-EFD187D21980" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Message-Id: Date: Mon, 28 Dec 2020 15:23:25 +0100 X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F2A.5FE9EA60.0028, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=AfXP4EfG c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=cgnavh2NdbwcH_dWKUcA:9 a=CjuIK1q_8ugA:10 a=qwvwYxifb6zOxjQCdIIA:9 a=De_Ol2h6w80A:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.10.222; envelope-from=mattiase@acm.org; helo=mail194c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) 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: -2.3 (--) --Apple-Mail=_F8693C92-8DE6-46E3-B196-EFD187D21980 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii The NS port shows key bindings in a rather cluttered way, with the key = in brackets directly after the menu entry. The Mac port of Emacs is much = neater with the bindings all aligned at a common tab position. We could = do the same, but having done some experiments I actually prefer a = right-alignment of the keys. Proof-of-concept patch attached. The alignment is made by padding with spaces, and then with hair spaces = for extra precision; the result is not perfect but probably better than = what we have now. If I get some time, I might do an experiment with more = precise formatting. --Apple-Mail=_F8693C92-8DE6-46E3-B196-EFD187D21980 Content-Disposition: attachment; filename=right-justify-keys.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="right-justify-keys.diff" Content-Transfer-Encoding: 7bit diff --git a/src/nsmenu.m b/src/nsmenu.m index 3f0cd0c6ed..6c96f5f123 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -450,32 +450,14 @@ - (BOOL)performKeyEquivalent: (NSEvent *)theEvent } -/* Parse a widget_value's key rep (examples: 's-p', 's-S', '(C-x C-s)', '') - into an accelerator string. We are only able to display a single character - for an accelerator, together with an optional modifier combination. (Under - Carbon more control was possible, but in Cocoa multi-char strings passed to - NSMenuItem get ignored. For now we try to display a super-single letter - combo, and return the others as strings to be appended to the item title. - (This is signaled by setting keyEquivModMask to 0 for now.) */ --(NSString *)parseKeyEquiv: (const char *)key +static const char * +skipspc (const char *s) { - const char *tpos = key; - keyEquivModMask = NSEventModifierFlagCommand; - - if (!key || !*key) - return @""; - - while (*tpos == ' ' || *tpos == '(') - tpos++; - if ((*tpos == 's') && (*(tpos+1) == '-')) - { - return [NSString stringWithFormat: @"%c", tpos[2]]; - } - keyEquivModMask = 0; /* signal */ - return [NSString stringWithUTF8String: tpos]; + while (*s == ' ') + s++; + return s; } - - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr { NSMenuItem *item; @@ -488,31 +470,20 @@ - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr } else { - NSString *title, *keyEq; + NSString *title; title = [NSString stringWithUTF8String: wv->name]; if (title == nil) title = @"< ? >"; /* (get out in the open so we know about it) */ - keyEq = [self parseKeyEquiv: wv->key]; -#ifdef NS_IMPL_COCOA - /* macOS mangles modifier strings longer than one character. */ - if (keyEquivModMask == 0) - { - 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 setKeyEquivalentModifierMask: keyEquivModMask]; + /* Cocoa only permits a single key (with modifiers) as + keyEquivalent, so we stick with the standard Emacs notation + for all key bindings for the sake of uniformity. */ + if (wv->key) + title = [title stringByAppendingString: + [NSString stringWithUTF8String: skipspc (wv->key)]]; + item = [self addItemWithTitle: (NSString *)title + action: @selector (menuDown:) + keyEquivalent: @""]; [item setEnabled: wv->enabled]; @@ -557,14 +528,69 @@ -(void)removeAllItems - (void)fillWithWidgetValue: (void *)wvptr { - widget_value *wv = (widget_value *)wvptr; + widget_value *first_wv = (widget_value *)wvptr; + NSFont *menuFont = [NSFont menuFontOfSize:0]; + NSDictionary *attributes = + [NSDictionary dictionaryWithObject:menuFont forKey:NSFontAttributeName]; + NSSize spaceSize = [@" " sizeWithAttributes:attributes]; + CGFloat spaceWidth = spaceSize.width; + const char hair_str[] = "\u200a"; // HAIR SPACE + int hair_bytes = sizeof hair_str - 1; + NSSize hairSize = [[NSString stringWithUTF8String: hair_str] + sizeWithAttributes:attributes]; + CGFloat hairWidth = spaceSize.width; + CGFloat maxNameWidth = 0; + CGFloat maxKeyWidth = 0; + + /* Determine maximum width of menu items. */ + for (widget_value *wv = first_wv; wv != NULL; wv = wv->next) + if (!menu_separator_name_p (wv->name)) + { + NSString *name = [NSString stringWithUTF8String: wv->name]; + NSSize nameSize = [name sizeWithAttributes: attributes]; + CGFloat nameWidth = nameSize.width; + maxNameWidth = MAX(maxNameWidth, nameWidth); + if (wv->key) + { + NSString *key = [NSString stringWithUTF8String: skipspc (wv->key)]; + NSSize keySize = [key sizeWithAttributes: attributes]; + CGFloat keyWidth = keySize.width; + maxKeyWidth = MAX(maxKeyWidth, keyWidth); + } + } + CGFloat maxWidth = maxNameWidth + maxKeyWidth; /* clear existing contents */ [self removeAllItems]; /* add new contents */ - for (; wv != NULL; wv = wv->next) + for (widget_value *wv = first_wv; wv != NULL; wv = wv->next) { + if (wv->key && !menu_separator_name_p (wv->name)) + { + /* Modify name to include padding to right-justify key binding. */ + NSString *name = [NSString stringWithUTF8String: wv->name]; + NSSize nameSize = [name sizeWithAttributes: attributes]; + CGFloat nameWidth = nameSize.width; + NSString *key = [NSString stringWithUTF8String: skipspc (wv->key)]; + NSSize keySize = [key sizeWithAttributes: attributes]; + CGFloat keyWidth = keySize.width; + CGFloat padWidth = maxWidth - (nameWidth + keyWidth); + /* Use plain spaces as far as possible, and hair spaces for + the rest. */ + int extra_spaces = 4; + int nspaces = padWidth / spaceWidth + extra_spaces; + int nhairs = fmod(padWidth, spaceWidth) / hairWidth + 0.5; + int name_len = strlen (wv->name); + Lisp_Object s = make_uninit_string (name_len + nspaces + + nhairs * hair_bytes); + memcpy (SSDATA (s), wv->name, name_len); + memset (SDATA (s) + name_len, ' ', nspaces); + for (int i = 0; i < nhairs; i++) + memcpy (SDATA (s) + name_len + nspaces + i * hair_bytes, hair_str, + hair_bytes); + wv->name = SSDATA (s); + } NSMenuItem *item = [self addItemWithWidgetValue: wv]; if (wv->contents) diff --git a/src/nsterm.h b/src/nsterm.h index b7b4d3b047..c4873b6082 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -515,7 +515,6 @@ #define NS_DRAW_TO_BUFFER 1 @interface EmacsMenu : NSMenu { - unsigned long keyEquivModMask; BOOL needsUpdate; } --Apple-Mail=_F8693C92-8DE6-46E3-B196-EFD187D21980-- From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Dec 2020 18:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 45502@debbugs.gnu.org Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.16091805823045 (code B ref 45502); Mon, 28 Dec 2020 18:37:01 +0000 Received: (at 45502) by debbugs.gnu.org; 28 Dec 2020 18:36:22 +0000 Received: from localhost ([127.0.0.1]:36875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktxNV-0000n3-TB for submit@debbugs.gnu.org; Mon, 28 Dec 2020 13:36:22 -0500 Received: from outbound.soverin.net ([116.202.65.218]:44903) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ktxNR-0000mn-Mq for 45502@debbugs.gnu.org; Mon, 28 Dec 2020 13:36:19 -0500 Received: from smtp.soverin.net (unknown [10.10.3.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 2A5066020F; Mon, 28 Dec 2020 18:36:11 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.142]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1609180570; bh=vkVoFvKS31R+ad1MbwOh9QBkJNxbn2CIRlBMCZB2dwI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NWHVnRtgU8qW+UyVOLDNMmQplw3MZTm+VLXcDIIskZMptXFCC9ozXlZ5kAs6h09wQ MhS4HEl/nX+c6Oe58rQBJTDybPs79Dbog/kmFMiiHLpPGZLKcf1NgT5XP3GN6kTNfP xBID4XJtP7v1lHOKsTQUc4lCV3axTijCNTxoch/llymXzHFatrEEgE1DPNziLHJcuD 0riloXOyn9uVkKv5u2vPrGzCjAB9sel3TEP4Ksr8s0ZFjpZgO6tRIivl/H6IaQP0ax eXZyczMMLu292Nu9wTf31ddz/3ClXT/1Y6zgfD5GMcKdRpWJZ6rHiUSRp6J5vB5DeQ EfhgUspjgwJfQ== Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 53648202945628; Mon, 28 Dec 2020 18:36:05 +0000 (GMT) Date: Mon, 28 Dec 2020 18:36:05 +0000 From: Alan Third Message-ID: Mail-Followup-To: Alan Third , Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 45502@debbugs.gnu.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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: -1.7 (-) On Mon, Dec 28, 2020 at 03:23:25PM +0100, Mattias Engdegård wrote: > The NS port shows key bindings in a rather cluttered way, with the > key in brackets directly after the menu entry. The Mac port of Emacs > is much neater with the bindings all aligned at a common tab > position. We could do the same, but having done some experiments I > actually prefer a right-alignment of the keys. Proof-of-concept > patch attached. > > The alignment is made by padding with spaces, and then with hair > spaces for extra precision; the result is not perfect but probably > better than what we have now. If I get some time, I might do an > experiment with more precise formatting. > > > I'd wondered about using NSAttributedString and NSParagraphStyle to > > set a tab stop at a specific pixel point, that should allow perfect > > alignment, or, and this is a bit hackier, display the binding in a > > monospace font. Then you could use (variable space font) spaces and > > tabs to line up the start of the binding text, then use (monospace > > font) spaces to align the bindings. That's maybe a bit too much work, > > though, and I'm not at all knowledgeable about how NSAttributedStrings > > actually work, so maybe it's impossible. > > It didn't look obvious how to do it, but I could use some help. I'm not sure either, but I guess the tabstop thing would look something like: NSMutableParagraphStyle *p = [NSMutableParagraphStyle defaultParagraphStyle]; NSArray *tabstops = [NSArray withObject:[[[NSTextTab alloc] initWithTextAlignment:NSTextAlignmentRight location:50 // This is probably in points. options:nil]; [p setTabStops:tabstops]; NSAttributedString *s = [[NSAttributedString alloc] initWithString:yourString attributes:someDictionaryObjectIncludingTheParagraphStyle]; [releaseAllTheAllocedObjects]; I can never remember how to make dictionaries, so I'll leave that to you to work out. ;) Hopefully then all you have to do is set the string as the title and it will be drawn with the correct tabstop. Maybe NSMenuItems are special and it won't work, though. -- Alan Third From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Dec 2020 22:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 45502@debbugs.gnu.org Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.16091956142325 (code B ref 45502); Mon, 28 Dec 2020 22:47:01 +0000 Received: (at 45502) by debbugs.gnu.org; 28 Dec 2020 22:46:54 +0000 Received: from localhost ([127.0.0.1]:37145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ku1Hy-0000bR-7T for submit@debbugs.gnu.org; Mon, 28 Dec 2020 17:46:54 -0500 Received: from sonic313-21.consmr.mail.ir2.yahoo.com ([77.238.179.188]:38120) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ku1Hs-0000b5-Ic for 45502@debbugs.gnu.org; Mon, 28 Dec 2020 17:46:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1609195599; bh=nw7BgoGuPVYThUzkoO+meF/QXHlBNwD9fT/YC0x6dcA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject; b=iECZIcbq/tngBlAbBfnmKuRZIIeqaCngZXrpzSg7VETO9ewsfxUJYs22lHMBcjDEGQRoppb9hVxNMa14+8Z4oohlMP79DADwTuGD73N2UT/WmxwAQ46YZIb9WIUGiryzwPcM7NiPrYGhnEPT9a/zS6eO5fhMkylZTI7Ht1gXayiMd0n5Z69xTY1vreG64Ksfvn+oBLf3S9v7EVv7/WX0FSYkAWVPC2xgiDk0o3TvoH5/QJEYfyldn0L6rCjH/CGFEHad3iQCuJTZu3aHXwOrTmvQmUYh31q0g/J+2cH3XKqWG9CvZqjIUSp9Ck/lTWV2tvJz9x2MKOj591TUOQIYhQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1609195599; bh=ckjccoDzvP8mBXIXrqwRpeA6UIrhpPnlpyVxE88QZhq=; h=From:To:Subject:Date:From:Subject; b=LOrmFHcb0lW9QL5AdeR7PKwBne9dbLhMZ75sXJNsvrfHnZP5k6Ck6X7O3936DdhCTtUxzRl/UVCC8Y2zxtpO8F1OZrgkquNaXzlEGwhkKsvQ9tLeQrEibNhwqdko1k5Zd6MdGmpxRGU0e631q1uTkUGAs/EImGkfwp+w279V1ZhTlKDI5jP56iIL6Dyir/ThpZ3NYWw58L+16crvpkIcka0X+lWPlHkB4sPo48paLmCL8N4AFQX74wF/yiiu/wlKvGsCQJ1ftjpxhUUQZuZk8xTrFxjo3AMnnNUI8t/wnxViDr1RVlNB80mS2iCacOstg5AbGHGHgREO+RAwIHwfQA== X-YMail-OSG: 4pGWJgYVM1np9zTBrLbwmYi.Ya1_MqjrnySesCUkIen3kFhUPBtgJm7qLKRybF. hpI2MyPMqxN.072UaB0wprFGS6HaKtcvdt_TsXtEYGlr7pqUNqa5HMltqqCrPm.RekqqdGMOdSl6 FiW3Tp0Ea8ii7gQM.aKSnA4AyNKZfCqjfv1nS1qnB0eCJyBJyxF1BtxQ0Nq.LKdAqUP8sn5jSGgd F4qlh92aH8MVzs.PsvC5AJODJqrTjU.BPL3hSIoIo82aB.Q8AIhFTx5fbu1bO7KCkW2x92CmBXLm ktLNcCbIDeWp8GkfTjLpNBYa73YZXx76X9UWxa2BJAvNvZHukv8npMuvMB.cioEDn45UefNspihO cBzsa2DQO3xJG1xnP79l9doMCCpBl8SAvk2lXoMuh1_UB.OSqfJo8sY6W6e5Jdv0Lv4WbtBfwe0k xSr4tlpYOHds3nj.j7fBozUHXn0EjUcr8s4FEmdUGYNnufs1yG2hTHyXNITu6qQN1IShbSAO9rVY Ym8I.HTpC03Aauw.evz8IHao8gz5KOU9D7X_0UGQ2Z9Bw0dH1H4VCEP5_h5aMzdW2ttvjH8ARD1O 4sd93z6OAUllk.361xVYbGlmuJaj90N1kI1NUgQezqPt3pKFzs9ssuNLqRZaECQ.oNMs_ud7p8A9 yu5SCH8ztPuTKuBu1tnXmIExBtmtpq7fq1WQ2lpEhSxWE_1g.T4NZyzX.NVpPNployPjlEvu9lMd ZpOQ_0jfaGXnmIDZni7XbznlC2uF2H3CujBuJDVIxRyGz39LIafkfXfzmQHAfV93hZZv7TkzEX1p s9g9iVn9dkTEnJn.0keCWTW41mNwySQS85qkiTbKy06le8Yq8NA6qoCW73PwFdFVB4bG44xoxyz0 JSwXJrxU2KGiyuh77yfyiD4BMK9gC_IvwLhABZKYtEcUPAwaznCAjtLsiu92_GrDvKhx8DQiGUVN G3Q0j35Qr1I8M6kMObTvkgkhUe_QmkDnELFCRZl6cPIaICMs8mCZCsIlBC1q58s5R8HAgugdagV2 fcBefw3K7Il17O5mD2TeYpoqra5KB_nS9u6GZM89acl2c4zklCYuI0hKlwtz0bPXLS3fBbjF24Qt L4oO67COQ6gPgQf1AB3RRYAOzyev1qnPwRUvlz5zYI6rnFT3Kf338ApF1a_BFpOBJp4Ya07BFjN1 d1c6mSKQY2ZKqJ1J4qNboZByWeZeoqFuVyP_94Gjkw.ZN8qn7qEGDO5etuvKeIQJdv.Ev1HyFhAA QMXu_77nTRDPKonMJAiJ7cr63FvUXziSFy6UOEsvAjChxtNIXMZTA1EQ9M0OOjdWa3tkQy8yG9Cf HXT52xOdDHZwI6BTjAEdeOdKlog4vTfciANTnB_Cy3LHFExo0bQZ3gZdlJZ0bZPu6EhstJKLJ5mZ YAljfzqhqjGHZjI2JiY1SrSnalKmSpUev0dqw5o_gjHsd76uMeBBBZkutUVffhssSKsI4rqwwCQQ wzfhlSKc.CNNKuIPZlfZmJ_vr6N_zItARgZIbJwMFrCRXMh7jKE1c4GSkm185REDUsT5ifbK0hJu Tl6kSlhB8UtcdngzDLOdXniThfLAutt3DicCA.cxwBAIhSnqAb6rfCWPkAj_dBL97HPQQ554h5K4 QFiJM5yv3PwT97DgQrhGQ4ya63bjbCMoTU5kqYAawC2NQUBm3tNtVXTUPTjk3MaeWOl2yk2kymGz s5Hi7u2syMz0W.rcj_6YGDdm3RKg33wToXGa08j10gVd3qC2G620v9gZennZuTOAcepwX2SQffhx 2RwE91WyDgHFzFtH.pk_87ed3oK9cI1gIESZSxHTlpAZSFjbV67J8AHFw6I_vbMB8uoPPjG7ruRA fI49wkSvGEer0AAx75giuOgz.9KLDssYqPeDdvvTHcZHR.n3mEHIZORhzd5Sk1BwyJZXcIIp7MBr 4BLYzlt2RazN8LFBmlRiDEAuFR6gh4ik7QXGpzPkazA1iZjOCkII1NrC5VIzTO6630lyS_xSgUrz 9hodVByUrMlUbpKhaH96gk.NMoOMkUuCj7oy_QLv2EOtJdLoXwa70kZbgzE7kH8WtvF16.BFiMpW QfLie4pmu7MlFx3yRm.Bo6fbSbhCRYvG0QYq1w4Da3kTnaR0m0d7YXkZcEwASd2vX5sUg.mIaLv5 ZNMJWsU_MGriprZYm61NuUx0l8V5B21WtwZzuF0qW9A9_nlg.Msqr4zjss0ZjPsNmUTWL8wVLgIe OeC0mw6C8RpvJEgV4EDY_.RnPTAbowUwLFq6h8Ituv8MJNBEBjMjGwKH0Pv8FLyugZ_JDz97V8tj Ut01tdoSf9btqphFiilIxjKoRmdNmEJwTmFXR5FEkXKOLNiwlIFL7_KHHuY7..dl_5nVl.yfur7q U2xRr2GQJSnj.BZH9rZR4cfwrHFFvqDHJ1pew0DvutvsoIYCyEMOdRnE6uXhqepRYm8.wkXGUJwY bJ75bgwd9g8YF.1FDUQgYYpAlt6Ja.evwguBjuAxq1VR5ny3H Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ir2.yahoo.com with HTTP; Mon, 28 Dec 2020 22:46:39 +0000 Received: by smtp417.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 8b167f99a6a89ee96fd4aa545abe9443; Mon, 28 Dec 2020 22:46:37 +0000 (UTC) From: Daniel =?UTF-8?Q?Mart=C3=ADn?= References: Date: Mon, 28 Dec 2020 23:46:36 +0100 In-Reply-To: ("Mattias =?UTF-8?Q?Engdeg=C3=A5rd?="'s message of "Mon, 28 Dec 2020 15:23:25 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.17278 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Apache-HttpAsyncClient/4.1.4 (Java/11.0.8) Content-Length: 1170 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.8 (/) Mattias Engdeg=C3=A5rd writes: > The NS port shows key bindings in a rather cluttered way, with the key > in brackets directly after the menu entry. The Mac port of Emacs is > much neater with the bindings all aligned at a common tab position. We > could do the same, but having done some experiments I actually prefer > a right-alignment of the keys. Proof-of-concept patch attached. > > The alignment is made by padding with spaces, and then with hair > spaces for extra precision; the result is not perfect but probably > better than what we have now. If I get some time, I might do an > experiment with more precise formatting. Thanks for the patch! It crashed Emacs when I tried to open the Gnus menu bar (the Gnus menu bar is an extreme case with lots of bindings). I'm not sure if left-alignment or right-alignment would be better. To improve visuals, Apple seems to align with respect to the =E2=8C=98 symbol,= but that doesn't fit Emacs well because there's no single modifier that is used in almost every keybinding (some use Control, some Meta). Also, it's not uncommon in Emacs to have keybindings that are a couple of keymaps deep. From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Dec 2020 12:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alan Third Cc: 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.160924354430956 (code B ref 45502); Tue, 29 Dec 2020 12:06:02 +0000 Received: (at 45502) by debbugs.gnu.org; 29 Dec 2020 12:05:44 +0000 Received: from localhost ([127.0.0.1]:37839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuDl2-00083D-Bx for submit@debbugs.gnu.org; Tue, 29 Dec 2020 07:05:44 -0500 Received: from mail1471c50.megamailservers.eu ([91.136.14.71]:38248 helo=mail102c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuDkw-00082u-Gi for 45502@debbugs.gnu.org; Tue, 29 Dec 2020 07:05:43 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609243532; bh=8NX2nQ7iiPSEOFdgT/r2htLNq1kHzetfIt7axoQ0YMo=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=AwcFymV3hD20rlgCpRLF4kZuLTJSdaFFBEeEjSm0EiDMHRjVdgpGnt+T02IP508fk SgMGHwnXTCjHd9D55/YhcnBvyPgce8Jn8+MfQ/y2nukzhIr/vFMUFgWh1c9wU1V3zg m0yv2QPLI0hpou11KMTEp1E4xJcQD+wZO7sqMqHg= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail102c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BTC5T6v009664; Tue, 29 Dec 2020 12:05:31 +0000 From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Message-Id: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> Content-Type: multipart/mixed; boundary="Apple-Mail=_7CEE20F4-D8CA-4920-ADCD-EC74C0DFDF06" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Date: Tue, 29 Dec 2020 13:02:21 +0100 In-Reply-To: References: X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F19.5FEB1B8C.0005, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=d6CLNirE c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=hIj89exaAAAA:8 a=Xgo7r8iyDzcWwRRN-UIA:9 a=QEXdDO2ut3YA:10 a=SBdF89ghQyjUy-zPoN4A:9 a=B2y7HmGcmWMA:10 a=lS9wXHQM5UdnNJ4u63Ry:22 X-Origin-Country: SE X-Spam-Score: 1.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: -0.0 (/) --Apple-Mail=_7CEE20F4-D8CA-4920-ADCD-EC74C0DFDF06 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 28 dec. 2020 kl. 19.36 skrev Alan Third : > I'm not sure either, but I guess the tabstop thing would look > something like: [...] Actually seems to work! (In your place I would feign a complete lack of = surprise.) Resulting patch attached. 28 dec. 2020 kl. 23.46 skrev Daniel Mart=C3=ADn : > Thanks for the patch! It crashed Emacs when I tried to open the Gnus > menu bar (the Gnus menu bar is an extreme case with lots of bindings). Confirmed, but that is unrelated to my patch. Alan, will you have a = look? > I'm not sure if left-alignment or right-alignment would be better. To > improve visuals, Apple seems to align with respect to the =E2=8C=98 = symbol, but > that doesn't fit Emacs well because there's no single modifier that is > used in almost every keybinding (some use Control, some Meta). Also, > it's not uncommon in Emacs to have keybindings that are a couple of > keymaps deep. Right; it's easy to use either left or right alignment for the bindings. = (I think we all agree that they should be kept in a separate column to = the right of the menu strings in either case.) I'm going to experiment = with translating modifiers and keys to the standard symbols. Not sure = how to deal with modifiers that are unavailable, such as s-k when no = Super modifier is available. It might be a good idea to normalise how key bindings are displayed on = all platforms to some extent. For example, is better written = C- or C-RET, is better as M- or M-DEL = (although not necessarily exactly the same thing, it's a bit muddy). Of course <> are terrible as angle brackets; we typically want =E2=80=B9=E2= =80=BA or =E2=9F=A8=E2=9F=A9 depending on context and purpose. --Apple-Mail=_7CEE20F4-D8CA-4920-ADCD-EC74C0DFDF06 Content-Disposition: attachment; filename=0001-Right-justify-keys-in-NS-menu-entries-bug-45502.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Right-justify-keys-in-NS-menu-entries-bug-45502.patch" Content-Transfer-Encoding: quoted-printable =46rom=203ad8a068e7743d947377087429b204996c2a650c=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Mon,=2028=20Dec=202020=2015:24:08=20+0100=0A= Subject:=20[PATCH]=20Right-justify=20keys=20in=20NS=20menu=20entries=20= (bug#45502)=0A=0AEach=20menu=20entry=20now=20has=20the=20key=20binding=20= right-aligned,=20as=20an=20attempt=0Ato=20improve=20readability.=20=20= Previously=20the=20keys=20were=20given=20in=20brackets=0Aimmediately=20= following=20the=20menu=20string.=0A=0A*=20src/nsmenu.m=20([EmacsMenu=20= parseKeyEquiv:]):=20Remove.=0A(skipspc):=20New=20helper=20function.=0A= ([EmacsMenu=20addItemWithWidgetValue:]):=20Add=20attributes=20argument.=0A= Use=20attributed=20title=20string.=20=20Don't=20special-case=20Super=20= bindings.=0A([EmacsMenu=20fillWithWidgetValue:]):=20Compute=20maximum=20= width.=20=20Prepare=0Aattributes=20for=20title.=0A---=0A=20src/nsmenu.m=20= |=20103=20++++++++++++++++++++++++++++-----------------------=0A=20= src/nsterm.h=20|=20=20=205=20+--=0A=202=20files=20changed,=2058=20= insertions(+),=2050=20deletions(-)=0A=0Adiff=20--git=20a/src/nsmenu.m=20= b/src/nsmenu.m=0Aindex=2023699627b1..967388f3bb=20100644=0A---=20= a/src/nsmenu.m=0A+++=20b/src/nsmenu.m=0A@@=20-448,33=20+448,16=20@@=20-=20= (BOOL)performKeyEquivalent:=20(NSEvent=20*)theEvent=0A=20}=0A=20=0A=20=0A= -/*=20Parse=20a=20widget_value's=20key=20rep=20(examples:=20's-p',=20= 's-S',=20'(C-x=20C-s)',=20'')=0A-=20=20=20into=20an=20accelerator=20= string.=20=20We=20are=20only=20able=20to=20display=20a=20single=20= character=0A-=20=20=20for=20an=20accelerator,=20together=20with=20an=20= optional=20modifier=20combination.=20=20(Under=0A-=20=20=20Carbon=20more=20= control=20was=20possible,=20but=20in=20Cocoa=20multi-char=20strings=20= passed=20to=0A-=20=20=20NSMenuItem=20get=20ignored.=20=20For=20now=20we=20= try=20to=20display=20a=20super-single=20letter=0A-=20=20=20combo,=20and=20= return=20the=20others=20as=20strings=20to=20be=20appended=20to=20the=20= item=20title.=0A-=20=20=20(This=20is=20signaled=20by=20setting=20= keyEquivModMask=20to=200=20for=20now.)=20*/=0A--(NSString=20= *)parseKeyEquiv:=20(const=20char=20*)key=0A+static=20const=20char=20*=0A= +skipspc=20(const=20char=20*s)=0A=20{=0A-=20=20const=20char=20*tpos=20=3D=20= key;=0A-=20=20keyEquivModMask=20=3D=20NSEventModifierFlagCommand;=0A-=0A= -=20=20if=20(!key=20||=20!*key)=0A-=20=20=20=20return=20@"";=0A-=0A-=20=20= while=20(*tpos=20=3D=3D=20'=20'=20||=20*tpos=20=3D=3D=20'(')=0A-=20=20=20= =20tpos++;=0A-=20=20if=20((*tpos=20=3D=3D=20's')=20&&=20(*(tpos+1)=20=3D=3D= =20'-'))=0A-=20=20=20=20{=0A-=20=20=20=20=20=20return=20[NSString=20= stringWithFormat:=20@"%c",=20tpos[2]];=0A-=20=20=20=20}=0A-=20=20= keyEquivModMask=20=3D=200;=20/*=20signal=20*/=0A-=20=20return=20= [NSString=20stringWithUTF8String:=20tpos];=0A+=20=20while=20(*s=20=3D=3D=20= '=20')=0A+=20=20=20=20s++;=0A+=20=20return=20s;=0A=20}=0A=20=0A-=0A=20-=20= (NSMenuItem=20*)addItemWithWidgetValue:=20(void=20*)wvptr=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= attributes:=20(NSDictionary=20*)attributes=0A=20{=0A=20=20=20NSMenuItem=20= *item;=0A=20=20=20widget_value=20*wv=20=3D=20(widget_value=20*)wvptr;=0A= @@=20-482,36=20+465,28=20@@=20-=20(NSMenuItem=20= *)addItemWithWidgetValue:=20(void=20*)wvptr=0A=20=20=20if=20= (menu_separator_name_p=20(wv->name))=0A=20=20=20=20=20{=0A=20=20=20=20=20= =20=20item=20=3D=20[NSMenuItem=20separatorItem];=0A-=20=20=20=20=20=20= [self=20addItem:=20item];=0A=20=20=20=20=20}=0A=20=20=20else=0A=20=20=20=20= =20{=0A-=20=20=20=20=20=20NSString=20*title,=20*keyEq;=0A-=20=20=20=20=20= =20title=20=3D=20[NSString=20stringWithUTF8String:=20wv->name];=0A+=20=20= =20=20=20=20NSString=20*title=20=3D=20[NSString=20stringWithUTF8String:=20= wv->name];=0A=20=20=20=20=20=20=20if=20(title=20=3D=3D=20nil)=0A=20=20=20= =20=20=20=20=20=20title=20=3D=20@"<=20?=20>";=20=20/*=20(get=20out=20in=20= the=20open=20so=20we=20know=20about=20it)=20*/=0A=20=0A-=20=20=20=20=20=20= keyEq=20=3D=20[self=20parseKeyEquiv:=20wv->key];=0A-#ifdef=20= NS_IMPL_COCOA=0A-=20=20=20=20=20=20/*=20macOS=20mangles=20modifier=20= strings=20longer=20than=20one=20character.=20=20*/=0A-=20=20=20=20=20=20= if=20(keyEquivModMask=20=3D=3D=200)=0A+=20=20=20=20=20=20/*=20Cocoa=20= only=20permits=20a=20single=20key=20(with=20modifiers)=20as=0A+=20=20=20=20= =20=20=20=20=20keyEquivalent,=20so=20we=20stick=20with=20the=20standard=20= Emacs=20notation=0A+=20=20=20=20=20=20=20=20=20for=20all=20key=20= bindings=20for=20the=20sake=20of=20uniformity.=20*/=0A+=20=20=20=20=20=20= if=20(wv->key)=0A=20=20=20=20=20=20=20=20=20{=0A-=20=20=20=20=20=20=20=20= =20=20title=20=3D=20[title=20stringByAppendingFormat:=20@"=20(%@)",=20= keyEq];=0A-=20=20=20=20=20=20=20=20=20=20item=20=3D=20[self=20= addItemWithTitle:=20(NSString=20*)title=0A-=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= action:=20@selector=20(menuDown:)=0A-=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20keyEquivalent:=20@""];=0A+=20=20= =20=20=20=20=20=20=20=20NSString=20*key=20=3D=20[NSString=20= stringWithUTF8String:=20skipspc=20(wv->key)];=0A+=20=20=20=20=20=20=20=20= =20=20title=20=3D=20[title=20stringByAppendingFormat:=20@"\t%@",=20key];=0A= =20=20=20=20=20=20=20=20=20}=0A-=20=20=20=20=20=20else=0A-=20=20=20=20=20= =20=20=20{=0A-#endif=0A-=20=20=20=20=20=20=20=20=20=20item=20=3D=20[self=20= addItemWithTitle:=20(NSString=20*)title=0A-=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= action:=20@selector=20(menuDown:)=0A-=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20keyEquivalent:=20keyEq];=0A= -#ifdef=20NS_IMPL_COCOA=0A-=20=20=20=20=20=20=20=20}=0A-#endif=0A-=20=20=20= =20=20=20[item=20setKeyEquivalentModifierMask:=20keyEquivModMask];=0A=20=0A= +=20=20=20=20=20=20NSAttributedString=20*atitle=20=3D=20= [[NSAttributedString=20alloc]=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20initWithString:=20title=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20attributes:=20attributes];=0A+=20=20=20=20=20=20item=20= =3D=20[[NSMenuItem=20alloc]=20init];=0A+=20=20=20=20=20=20[item=20= setAction:=20@selector=20(menuDown:)];=0A+=20=20=20=20=20=20[item=20= setAttributedTitle:=20atitle];=0A=20=20=20=20=20=20=20[item=20= setEnabled:=20wv->enabled];=0A=20=0A=20=20=20=20=20=20=20/*=20Draw=20= radio=20buttons=20and=20tickboxes.=20=20*/=0A@@=20-524,6=20+499,7=20@@=20= -=20(NSMenuItem=20*)addItemWithWidgetValue:=20(void=20*)wvptr=0A=20=20=20= =20=20=20=20[item=20setTag:=20(NSInteger)wv->call_data];=0A=20=20=20=20=20= }=0A=20=0A+=20=20[self=20addItem:=20item];=0A=20=20=20return=20item;=0A=20= }=0A=20=0A@@=20-548,15=20+524,48=20@@=20-(void)removeAllItems=0A=20=0A=20= -=20(void)fillWithWidgetValue:=20(void=20*)wvptr=0A=20{=0A-=20=20= widget_value=20*wv=20=3D=20(widget_value=20*)wvptr;=0A+=20=20= widget_value=20*first_wv=20=3D=20(widget_value=20*)wvptr;=0A+=20=20= NSFont=20*menuFont=20=3D=20[NSFont=20menuFontOfSize:0];=0A+=20=20= NSDictionary=20*font_attribs=20=3D=20@{NSFontAttributeName:=20menuFont};=0A= +=20=20CGFloat=20maxNameWidth=20=3D=200;=0A+=20=20CGFloat=20maxKeyWidth=20= =3D=200;=0A+=0A+=20=20/*=20Determine=20the=20maximum=20width=20of=20all=20= menu=20items.=20*/=0A+=20=20for=20(widget_value=20*wv=20=3D=20first_wv;=20= wv=20!=3D=20NULL;=20wv=20=3D=20wv->next)=0A+=20=20=20=20if=20= (!menu_separator_name_p=20(wv->name))=0A+=20=20=20=20=20=20{=0A+=20=20=20= =20=20=20=20=20NSString=20*name=20=3D=20[NSString=20= stringWithUTF8String:=20wv->name];=0A+=20=20=20=20=20=20=20=20NSSize=20= nameSize=20=3D=20[name=20sizeWithAttributes:=20font_attribs];=0A+=20=20=20= =20=20=20=20=20maxNameWidth=20=3D=20MAX(maxNameWidth,=20nameSize.width);=0A= +=20=20=20=20=20=20=20=20if=20(wv->key)=0A+=20=20=20=20=20=20=20=20=20=20= {=0A+=20=20=20=20=20=20=20=20=20=20=20=20NSString=20*key=20=3D=20= [NSString=20stringWithUTF8String:=20skipspc=20(wv->key)];=0A+=20=20=20=20= =20=20=20=20=20=20=20=20NSSize=20keySize=20=3D=20[key=20= sizeWithAttributes:=20font_attribs];=0A+=20=20=20=20=20=20=20=20=20=20=20= =20maxKeyWidth=20=3D=20MAX(maxKeyWidth,=20keySize.width);=0A+=20=20=20=20= =20=20=20=20=20=20}=0A+=20=20=20=20=20=20}=0A+=0A+=20=20/*=20Put=20some=20= space=20between=20the=20names=20and=20keys.=20*/=0A+=20=20CGFloat=20= maxWidth=20=3D=20maxNameWidth=20+=20maxKeyWidth=20+=2040;=0A+=0A+=20=20= /*=20Set=20a=20right-aligned=20tab=20stop=20at=20the=20maximum=20width,=20= so=20that=20the=0A+=20=20=20=20=20key=20will=20appear=20immediately=20to=20= the=20left=20of=20it.=20*/=0A+=20=20NSTextTab=20*tab=20=3D=0A+=20=20=20=20= [[NSTextTab=20alloc]=20initWithTextAlignment:=20NSTextAlignmentRight=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20location:=20maxWidth=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20options:=20@{}];=0A+=20=20NSMutableParagraphStyle=20= *pstyle=20=3D=20[[NSMutableParagraphStyle=20alloc]=20init];=0A+=20=20= [pstyle=20setTabStops:=20@[tab]];=0A+=20=20NSDictionary=20*attributes=20= =3D=20@{NSParagraphStyleAttributeName:=20pstyle};=0A=20=0A=20=20=20/*=20= clear=20existing=20contents=20*/=0A=20=20=20[self=20removeAllItems];=0A=20= =0A=20=20=20/*=20add=20new=20contents=20*/=0A-=20=20for=20(;=20wv=20!=3D=20= NULL;=20wv=20=3D=20wv->next)=0A+=20=20for=20(widget_value=20*wv=20=3D=20= first_wv;=20wv=20!=3D=20NULL;=20wv=20=3D=20wv->next)=0A=20=20=20=20=20{=0A= -=20=20=20=20=20=20NSMenuItem=20*item=20=3D=20[self=20= addItemWithWidgetValue:=20wv];=0A+=20=20=20=20=20=20NSMenuItem=20*item=20= =3D=20[self=20addItemWithWidgetValue:=20wv=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20attributes:=20attributes];=0A=20=0A=20=20=20=20= =20=20=20if=20(wv->contents)=0A=20=20=20=20=20=20=20=20=20{=0Adiff=20= --git=20a/src/nsterm.h=20b/src/nsterm.h=0Aindex=20b7b4d3b047..f1d5acde2e=20= 100644=0A---=20a/src/nsterm.h=0A+++=20b/src/nsterm.h=0A@@=20-515,13=20= +515,12=20@@=20#define=20NS_DRAW_TO_BUFFER=201=0A=20=0A=20@interface=20= EmacsMenu=20:=20NSMenu=20=20=0A=20{=0A-=20=20unsigned=20= long=20keyEquivModMask;=0A=20=20=20BOOL=20needsUpdate;=0A=20}=0A=20=0A=20= -=20(void)menuNeedsUpdate:=20(NSMenu=20*)menu;=20/*=20(delegate=20= method)=20*/=0A--=20(NSString=20*)parseKeyEquiv:=20(const=20char=20= *)key;=0A--=20(NSMenuItem=20*)addItemWithWidgetValue:=20(void=20*)wvptr;=0A= +-=20(NSMenuItem=20*)addItemWithWidgetValue:=20(void=20*)wvptr=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= attributes:=20(NSDictionary=20*)attributes;=0A=20-=20= (void)fillWithWidgetValue:=20(void=20*)wvptr;=0A=20-=20(EmacsMenu=20= *)addSubmenuWithTitle:=20(const=20char=20*)title;=0A=20-=20(void)=20= removeAllItems;=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A=0A= --Apple-Mail=_7CEE20F4-D8CA-4920-ADCD-EC74C0DFDF06-- From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Dec 2020 13:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.160925005016841 (code B ref 45502); Tue, 29 Dec 2020 13:55:02 +0000 Received: (at 45502) by debbugs.gnu.org; 29 Dec 2020 13:54:10 +0000 Received: from localhost ([127.0.0.1]:38042 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuFRx-0004NZ-Mg for submit@debbugs.gnu.org; Tue, 29 Dec 2020 08:54:09 -0500 Received: from outbound.soverin.net ([116.202.65.218]:54863) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuFRu-0004N1-L2 for 45502@debbugs.gnu.org; Tue, 29 Dec 2020 08:54:07 -0500 Received: from smtp.soverin.net (unknown [10.10.3.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 37AA86008F; Tue, 29 Dec 2020 13:54:00 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.142]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1609250039; bh=pbJRHmWtHSzAmxjRWgzhmGwjeO5TEGHA9RQWvVJG4BU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HRXhWC0Z1JOXOepHjDxZxdwQT/UiUc9l1R27hA8y/vVTJtVnn/0KOA2KuE77IxVsc udmN/pkAabylY/p8ZUpMVYbDpa3f7V3S243L8p88u6jBfF19DP8Mf5KufBAYcruwFG HXXLE/vpvVuv+o5JvbN13GbopNTZ2TYi2H+/mbFUHP1cajp/GTFGUhLNiGekHkpu0s sG8Hi1OvTyl6LFhQOan04+A/3GmfVIa73YYcKHpg+DR9Ag1A2Qp3VAkhIUFO9yhQOA LetLz7JBlIn/pRQGKCN/uBpPjXw7RzwaOPg4vBs3ZeGXjQj1cpfv+gD7w9rtqzRDgo +BxkRaJzK86Rw== Received: by breton.holly.idiocy.org (Postfix, from userid 501) id BD2CD20294EC08; Tue, 29 Dec 2020 13:53:55 +0000 (GMT) Date: Tue, 29 Dec 2020 13:53:55 +0000 From: Alan Third Message-ID: Mail-Followup-To: Alan Third , Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= References: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> 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: -1.7 (-) On Tue, Dec 29, 2020 at 01:02:21PM +0100, Mattias EngdegÃ¥rd wrote: > 28 dec. 2020 kl. 19.36 skrev Alan Third : > > > I'm not sure either, but I guess the tabstop thing would look > > something like: [...] > > Actually seems to work! (In your place I would feign a complete lack > of surprise.) No feigning required. 😉 > Resulting patch attached. Looks good. As I understand it GNUstep doesn't need this fix, so please make it Cocoa only. > 28 dec. 2020 kl. 23.46 skrev Daniel Martín : > > > Thanks for the patch! It crashed Emacs when I tried to open the Gnus > > menu bar (the Gnus menu bar is an extreme case with lots of bindings). > > Confirmed, but that is unrelated to my patch. Alan, will you have a look? There was a work-around for some problem related to waiting_for_input in the old menu code that was lost when I copied the code from xmenu.c, so I've put it back in and pushed to master. It looks like it fixes the crash here. > > I'm not sure if left-alignment or right-alignment would be better. To > > improve visuals, Apple seems to align with respect to the ⌘ symbol, but > > that doesn't fit Emacs well because there's no single modifier that is > > used in almost every keybinding (some use Control, some Meta). Also, > > it's not uncommon in Emacs to have keybindings that are a couple of > > keymaps deep. > > Right; it's easy to use either left or right alignment for the > bindings. (I think we all agree that they should be kept in a > separate column to the right of the menu strings in either case.) > I'm going to experiment with translating modifiers and keys to the > standard symbols. Not sure how to deal with modifiers that are > unavailable, such as s-k when no Super modifier is available. There's also the problem that we allow setting the left and right modifiers separately, so option or command may not match both keys. -- Alan Third From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Dec 2020 14:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alan Third Cc: 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.160925287621315 (code B ref 45502); Tue, 29 Dec 2020 14:42:02 +0000 Received: (at 45502) by debbugs.gnu.org; 29 Dec 2020 14:41:16 +0000 Received: from localhost ([127.0.0.1]:38086 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuGBX-0005Xj-TI for submit@debbugs.gnu.org; Tue, 29 Dec 2020 09:41:16 -0500 Received: from mail1480c50.megamailservers.eu ([91.136.14.80]:52526 helo=mail118c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuGBV-0005XS-1x for 45502@debbugs.gnu.org; Tue, 29 Dec 2020 09:41:14 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609252866; bh=I7xMwTxRSlCIjPNXzBBrHwpEXGI2yqJx/5qLTC1K0qM=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=iHbAwwqXVmyBWakHLYz6xKwP50xOjsL/lf4fE1qPemDxzaWSJo71UEtMfscN8yqTT 2/DIN7DK3DlxcVne2vofBHteoEtvRqAdHhQx9pogtELS2TZOu6d9Z1B2P7BY0KVrg8 CPS4Maa8siRpI50ICU21mOu7pEydzoMvjwNOikt4= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail118c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BTEf4Eo011665; Tue, 29 Dec 2020 14:41:05 +0000 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= In-Reply-To: Date: Tue, 29 Dec 2020 15:41:03 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F1C.5FEB4002.0037, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=HYRqsRM8 c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=IkcTkHD0fZMA:10 a=M51BFTxLslgA:10 a=hIj89exaAAAA:8 a=USceeXRHY8LJDdpJiVQA:9 a=QEXdDO2ut3YA:10 a=lS9wXHQM5UdnNJ4u63Ry:22 X-Origin-Country: SE X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 29 dec. 2020 kl. 14.53 skrev Alan Third : > Looks good. As I understand it GNUstep doesn't need this fix, so > please make it Cocoa only. Will do, but what do you mean by not needing it -- does it do any harm, given that GNUstep menus do not appear to be working anyway? I have no GNUstep system to try it on so I don't know if it will ev [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.3 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS 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.0 (/) 29 dec. 2020 kl. 14.53 skrev Alan Third : > Looks good. As I understand it GNUstep doesn't need this fix, so > please make it Cocoa only. Will do, but what do you mean by not needing it -- does it do any harm, = given that GNUstep menus do not appear to be working anyway? I have no = GNUstep system to try it on so I don't know if it will even build. > There was a work-around for some problem related to waiting_for_input > in the old menu code that was lost when I copied the code from > xmenu.c, so I've put it back in and pushed to master. It looks like it > fixes the crash here. Thank you, that did it. > There's also the problem that we allow setting the left and right > modifiers separately, so option or command may not match both keys. That's true. Maybe a hybrid like M-=E2=86=93 or C-=E2=8C=AB is still = fine though since the symbols are very recognisable -- I'll give it a = go. From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Dec 2020 15:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.160925704830009 (code B ref 45502); Tue, 29 Dec 2020 15:51:01 +0000 Received: (at 45502) by debbugs.gnu.org; 29 Dec 2020 15:50:48 +0000 Received: from localhost ([127.0.0.1]:39975 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuHGq-0007nx-Cg for submit@debbugs.gnu.org; Tue, 29 Dec 2020 10:50:48 -0500 Received: from outbound.soverin.net ([116.202.65.218]:53819) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuHGm-0007nc-D5 for 45502@debbugs.gnu.org; Tue, 29 Dec 2020 10:50:46 -0500 Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id E78966008F; Tue, 29 Dec 2020 15:50:37 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1609257037; bh=arDTpxcRmUKU5Pn6CYy87JuLXnTM9vgkNY0+RFgRRfg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ickwxBAv2f43MEWd5WH3YP531jpbeJ2oLCC0z39A43F7PN+MGSCUrqGQ+kGWGaLZZ DRnh+8/GPrVvtRJXhJUiwgLR6SoSmOE12InSUq2OOzQI6jQ7Oz7O25lPJq8+wSxx8f NApZ45YRkzrvFVoa0o3g7VGB72HpfNXNQQn00NC2Qa6DeTiphk0+xHXcLNJ3wUfPZ/ EMGXHnKE0Julvys0UHLkq1OD9q0MCSbw8lx+x8WBsqagUn86E8KVQBtWlX5RGYYmlX BMF071wI0BKEK9ZxAcYX/NcYl8S5hsW9q3N5ni03sjFp3Y/ZKzozHd4ylV/HC3zeZ8 KRPAKx6oAXYGw== Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 2CCAB20294EE56; Tue, 29 Dec 2020 15:50:35 +0000 (GMT) Date: Tue, 29 Dec 2020 15:50:34 +0000 From: Alan Third Message-ID: Mail-Followup-To: Alan Third , Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= References: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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: -1.7 (-) On Tue, Dec 29, 2020 at 03:41:03PM +0100, Mattias EngdegÃ¥rd wrote: > 29 dec. 2020 kl. 14.53 skrev Alan Third : > > > Looks good. As I understand it GNUstep doesn't need this fix, so > > please make it Cocoa only. > > Will do, but what do you mean by not needing it -- does it do any > harm, given that GNUstep menus do not appear to be working anyway? I > have no GNUstep system to try it on so I don't know if it will even > build. As far as I'm aware GNUstep is able to display the bindings correctly no matter how many characters they have, so we don't need the work-around. And I'm hoping that we'll be able to get GNUstep menus working again in the future. I think the problem is something to do with drawing the frame rather than a problem with building the menus. But I could be wrong. > > There's also the problem that we allow setting the left and right > > modifiers separately, so option or command may not match both keys. > > That's true. Maybe a hybrid like M-↓ or C-⌫ is still fine though > since the symbols are very recognisable -- I'll give it a go. Yes, I think so. -- Alan Third From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Dec 2020 17:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alan Third Cc: 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.160926327312615 (code B ref 45502); Tue, 29 Dec 2020 17:35:02 +0000 Received: (at 45502) by debbugs.gnu.org; 29 Dec 2020 17:34:33 +0000 Received: from localhost ([127.0.0.1]:40107 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuItF-0003HO-Ep for submit@debbugs.gnu.org; Tue, 29 Dec 2020 12:34:33 -0500 Received: from mail1434c50.megamailservers.eu ([91.136.14.34]:53850 helo=mail263c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuItC-0003H6-FN for 45502@debbugs.gnu.org; Tue, 29 Dec 2020 12:34:31 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609263263; bh=eu4qf2iZLDucudkR1aQ5yw5GEKV1x+iSZR7xI//uwos=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=lGsN1eO9vsGJK31KPSm0fR18/H2WCgdBXtxK0QNIla0K950WUF2k9OAS3xjvXhLcY lZx9HFTx/nEAJ7z0fk4t44yyKCmjfneLxf6qYSZFU46Gxy1pivqIXtDr//JbLi13fZ mMAfZRN67IJvauDzedcXF102N7rJjw3rTO9s5NHk= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail263c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BTHYLfE000971; Tue, 29 Dec 2020 17:34:22 +0000 From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_5BB2F133-3F2C-4C43-83F7-9BB278486381" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Date: Tue, 29 Dec 2020 18:34:20 +0100 In-Reply-To: References: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F17.5FEB689F.0064, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=foiim2wf c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=hIj89exaAAAA:8 a=tGnDvL-RPit1lrgWpAIA:9 a=CjuIK1q_8ugA:10 a=bU5L3tv5xMtoJJm-FKoA:9 a=De_Ol2h6w80A:10 a=lS9wXHQM5UdnNJ4u63Ry:22 X-Origin-Country: SE X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 29 dec. 2020 kl. 16.50 skrev Alan Third : > As far as I'm aware GNUstep is able to display the bindings correctly > no matter how many characters they have, so we don't need the > work-around. And I'm hoping that we'll be able to get GNUstep [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.3 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS 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.0 (/) --Apple-Mail=_5BB2F133-3F2C-4C43-83F7-9BB278486381 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 29 dec. 2020 kl. 16.50 skrev Alan Third : > As far as I'm aware GNUstep is able to display the bindings correctly > no matter how many characters they have, so we don't need the > work-around. And I'm hoping that we'll be able to get GNUstep menus > working again in the future. All right, I've done what I think you meant and pushed to master; please = tell me if I'm on the wrong track. Here is a proof-of-concept patch for using fancy symbols instead of = etc. Not production quality because (1) it's obviously ugly code, (2) I'm = unsure about the PgUp/PgDn/Home/End symbols and (3) it only works with = modifiers if the patch in bug#45536 is applied (which of course I think = it should), but at least it gives a feeling for whether it's a good = thing to do or not. There is also the question whether to follow the platform convention of = always using upper case letters, with an explicit Shift modifier if = necessary. --Apple-Mail=_5BB2F133-3F2C-4C43-83F7-9BB278486381 Content-Disposition: attachment; filename=key-symbols.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="key-symbols.diff" Content-Transfer-Encoding: quoted-printable diff=20--git=20a/src/nsmenu.m=20b/src/nsmenu.m=0Aindex=20= d5321dcdc6..36566e9a11=20100644=0A---=20a/src/nsmenu.m=0A+++=20= b/src/nsmenu.m=0A@@=20-552,9=20+552,76=20@@=20-=20= (void)fillWithWidgetValue:=20(void=20*)wvptr=0A=20=20=20=20=20=20=20=20=20= maxNameWidth=20=3D=20MAX(maxNameWidth,=20nameSize.width);=0A=20=20=20=20=20= =20=20=20=20if=20(wv->key)=0A=20=20=20=20=20=20=20=20=20=20=20{=0A-=20=20= =20=20=20=20=20=20=20=20=20=20NSString=20*key=20=3D=20[NSString=20= stringWithUTF8String:=20skipspc=20(wv->key)];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20NSMutableString=20*key=20=3D=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20[NSMutableString=20stringWithUTF8String:=20skipspc=20= (wv->key)];=0A+=20=20=20=20=20=20=20=20=20=20=20=20[key=20= replaceOccurrencesOfString:=20@""=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= withString:=20@"=E2=8C=AB"=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20options:=20= NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20range:=20= NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20=20=20=20= =20[key=20replaceOccurrencesOfString:=20@"DEL"=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= withString:=20@"=E2=8C=AB"=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20options:=20= NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20range:=20= NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20=20=20=20= =20[key=20replaceOccurrencesOfString:=20@""=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20withString:=20@"=E2=8C=A6"=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20[key=20replaceOccurrencesOfString:=20@""=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20withString:=20@"=E2=86=A9"=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20[key=20replaceOccurrencesOfString:=20@"RET"=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20withString:=20@"=E2=86=A9"=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20[key=20replaceOccurrencesOfString:=20@""=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20withString:=20@"=E2=86=90"=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20[key=20replaceOccurrencesOfString:=20@""=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20withString:=20@"=E2=86=92"=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20[key=20replaceOccurrencesOfString:=20@""=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20withString:=20@"=E2=86=91"=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20[key=20replaceOccurrencesOfString:=20@""=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20withString:=20@"=E2=86=93"=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20[key=20replaceOccurrencesOfString:=20@""=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20withString:=20@"=E2=87=9E"=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20[key=20replaceOccurrencesOfString:=20@""=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20withString:=20@"=E2=87=9F"=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20[key=20replaceOccurrencesOfString:=20@""=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20withString:=20@"=E2=86=96"=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20[key=20replaceOccurrencesOfString:=20@""=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20withString:=20@"=E2=86=98"=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20[key=20replaceOccurrencesOfString:=20@""=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20withString:=20@"=E2=87=A5"=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20[key=20replaceOccurrencesOfString:=20@"TAB"=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20withString:=20@"=E2=87=A5"=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A+=20=20=20=20=20=20=20=20= =20=20=20=20[key=20replaceOccurrencesOfString:=20@""=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20withString:=20@"=E2=87=A4"=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20options:=20NSLiteralSearch=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= range:=20NSMakeRange=20(0,=20[key=20length])];=0A=20=20=20=20=20=20=20=20= =20=20=20=20=20NSSize=20keySize=20=3D=20[key=20sizeWithAttributes:=20= font_attribs];=0A=20=20=20=20=20=20=20=20=20=20=20=20=20maxKeyWidth=20=3D=20= MAX(maxKeyWidth,=20keySize.width);=0A+=20=20=20=20=20=20=20=20=20=20=20=20= Lisp_Object=20newkey=20=3D=20build_string=20([key=20UTF8String]);=0A+=20=20= =20=20=20=20=20=20=20=20=20=20wv->key=20=3D=20SSDATA=20(newkey);=0A=20=20= =20=20=20=20=20=20=20=20=20}=0A=20=20=20=20=20=20=20}=0A=20=0A= --Apple-Mail=_5BB2F133-3F2C-4C43-83F7-9BB278486381-- From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Dec 2020 21:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.160927709221072 (code B ref 45502); Tue, 29 Dec 2020 21:25:01 +0000 Received: (at 45502) by debbugs.gnu.org; 29 Dec 2020 21:24:52 +0000 Received: from localhost ([127.0.0.1]:40379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuMU7-0005To-PX for submit@debbugs.gnu.org; Tue, 29 Dec 2020 16:24:52 -0500 Received: from outbound.soverin.net ([116.202.65.218]:36719) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuMU3-0005TX-7Z for 45502@debbugs.gnu.org; Tue, 29 Dec 2020 16:24:50 -0500 Received: from smtp.soverin.net (unknown [10.10.3.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id EE70E6008F; Tue, 29 Dec 2020 21:24:40 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.142]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1609277080; bh=poUSjkLaGNqPiP7ov6dCUgPtiKdoWIXaSvUF/LKROrQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HGDzDm+Pb/Zw0ZVLUWdJfRG/k+YH5PZSXe/IgbZKusazVpTpufT4nNWmZRDbjzH7E TkHgOJyCq1pVS+VsPDH0fJDPfimK6UfljzwwkLZDJI5iO0TM1gBZPKGJSjcLl2cFjZ UFHqhaGgGYOJpqLbtqaXWjFW8cpqaAz9oJI16ZYWsov1qcYvNs8iB5meIwhz4jXEV/ rZk3ifYJU1RniAzqvV16yxAF4rn2Tg6iAgJvzruRucQIonogZbLIlIhrkrqlObeqGy emuHsVLF9hEKlaUA7fN8KzPAcTHiaOpzoy5Jy9OpKVbbUeaGRwq87vXo+3VbxnFhb1 TsWAxuYYx5VVg== Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 2D28D2029516CD; Tue, 29 Dec 2020 21:24:37 +0000 (GMT) Date: Tue, 29 Dec 2020 21:24:37 +0000 From: Alan Third Message-ID: Mail-Followup-To: Alan Third , Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= References: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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: -1.7 (-) On Tue, Dec 29, 2020 at 06:34:20PM +0100, Mattias Engdegård wrote: > 29 dec. 2020 kl. 16.50 skrev Alan Third : > > > As far as I'm aware GNUstep is able to display the bindings correctly > > no matter how many characters they have, so we don't need the > > work-around. And I'm hoping that we'll be able to get GNUstep menus > > working again in the future. > > All right, I've done what I think you meant and pushed to master; > please tell me if I'm on the wrong track. I've pushed a small change. I also set the alloc'd objects to autorelease. We need to do that because when they're assigned to the NSMenuItem it will retain them, and because we alloc'd them we already have them retained once. At least I hope that's right. For some reason I've found the retain/release cycle really hard to understand, but I think I'm getting there now. > Here is a proof-of-concept patch for using fancy symbols instead of > etc. > > Not production quality because (1) it's obviously ugly code, (2) I'm > unsure about the PgUp/PgDn/Home/End symbols and (3) it only works > with modifiers if the patch in bug#45536 is applied (which of course > I think it should), but at least it gives a feeling for whether it's > a good thing to do or not. I have no opinion on this, really. Although that is some ugly code! ;) I have no ideas for how to improve it, though. > There is also the question whether to follow the platform convention > of always using upper case letters, with an explicit Shift modifier > if necessary. I think that might be confusing. It doesn't matter with most macOS apps because they don't differentiate between shortcuts with upper and lower case characters, but we do, and I feel as a seasoned Emacs user I'd see C-A and think that was actually C-S-a when it might be C-a. -- Alan Third From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Dec 2020 22:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alan Third Cc: 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.160928245829491 (code B ref 45502); Tue, 29 Dec 2020 22:55:02 +0000 Received: (at 45502) by debbugs.gnu.org; 29 Dec 2020 22:54:18 +0000 Received: from localhost ([127.0.0.1]:40478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuNsZ-0007fQ-Ry for submit@debbugs.gnu.org; Tue, 29 Dec 2020 17:54:18 -0500 Received: from mail1479c50.megamailservers.eu ([91.136.14.79]:44352 helo=mail118c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuNsW-0007f8-NQ for 45502@debbugs.gnu.org; Tue, 29 Dec 2020 17:54:10 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609282442; bh=KrSnJlKjBfue2aWONnEEci2UY58LLz/3Hwuuab5co0c=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=oJGlRD8HoxUle0ZZL/cOHyR3Kx37H1GmqF95MVWhc9AnNQNP2VRgnf1S7Ri/tqIZ5 HHnBV+47UvO1zbAMpHQxnUxU2NeCWByhU/SO2QDbsOXiz9nAg1JJ9TSon7vx+XBE4N ROXF6tVXzocYN6k9dPwshpC2tty4+JfJ9ywf6nvw= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail118c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BTMrxla012881; Tue, 29 Dec 2020 22:54:01 +0000 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= In-Reply-To: Date: Tue, 29 Dec 2020 23:53:59 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <99CD03DA-DF1F-4C2C-A2FA-DFD7DF3B2750@acm.org> References: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F19.5FEBB38A.0003, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=HYRqsRM8 c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=IkcTkHD0fZMA:10 a=M51BFTxLslgA:10 a=hIj89exaAAAA:8 a=vQQvgaqYLQnsI-mX4AsA:9 a=QEXdDO2ut3YA:10 a=lS9wXHQM5UdnNJ4u63Ry:22 X-Origin-Country: SE X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 29 dec. 2020 kl. 22.24 skrev Alan Third : > I've pushed a small change. I also set the alloc'd objects to > autorelease. We need to do that because when they're assigned to the > NSMenuItem it will retain them, and because we alloc'd them we [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.3 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS 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: -1.0 (-) 29 dec. 2020 kl. 22.24 skrev Alan Third : > I've pushed a small change. I also set the alloc'd objects to > autorelease. We need to do that because when they're assigned to the > NSMenuItem it will retain them, and because we alloc'd them we already > have them retained once. >=20 > At least I hope that's right. For some reason I've found the > retain/release cycle really hard to understand, but I think I'm > getting there now. Thanks! Is this the standard way of doing it? The objects that you = marked autorelease (tab and pstyle) are only used for the extent of that = method; I take it you prefer autorelease to sending them 'release' at = the end of the method? Presumably 'atitle' should be sent autorelease (or release) as well? > I have no opinion on this, really. Although that is some ugly code! ;) Oh yes, it should at least be table-driven in some way.=20 > I think that might be confusing. It doesn't matter with most macOS > apps because they don't differentiate between shortcuts with upper and > lower case characters, but we do, and I feel as a seasoned Emacs user > I'd see C-A and think that was actually C-S-a when it might be C-a. Agreed. If we were to follow the macOS conventions fully then it would = make sense to use =E2=8C=98K for M-k (if Command is Meta), but otherwise = it's more likely to be confusing. From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Dec 2020 23:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.16092857592624 (code B ref 45502); Tue, 29 Dec 2020 23:50:02 +0000 Received: (at 45502) by debbugs.gnu.org; 29 Dec 2020 23:49:19 +0000 Received: from localhost ([127.0.0.1]:40494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuOjv-0000gG-26 for submit@debbugs.gnu.org; Tue, 29 Dec 2020 18:49:19 -0500 Received: from outbound.soverin.net ([116.202.65.218]:58435) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuOjo-0000fy-O2 for 45502@debbugs.gnu.org; Tue, 29 Dec 2020 18:49:17 -0500 Received: from smtp.soverin.net (unknown [10.10.3.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 57F3E6008F; Tue, 29 Dec 2020 23:49:06 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.142]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1609285745; bh=4quLi+6U6wFf8ZVYta0Pm1frjUItPabwN3ruwMVyjvE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e/8sNt1i+Abh9wmXS8H97JBdgpb7OQ1yUk5mhnll02yOCoT908k9XCo9L8HSDh4oA 8i8GpnGo4mYH/6kPgPCry5ykr+MsaIr+ueHg3e5Ak0To5ESkeYP918ui802uNQkShT qZdQl+s9iITWV1GULoz0jjaSQSatFDFy+LfIg1Xi/WvGdaWOO3rCcobs8uTTG4yE/M 0CV/AZ12qUk0jHQ/NksAMRGASR0Bq+E76U4JKWePnt5Qp9L86DVyy1pDYgSvfEWzYg 1Fr3gOpm+6TpLTterTEUxMj/aGPCbEbY5LMI4ops7P6feazUqP3qPi/fPjpNwJvivE 0PqC/h2Ns3vdw== Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 9653F202951F51; Tue, 29 Dec 2020 23:49:02 +0000 (GMT) Date: Tue, 29 Dec 2020 23:49:02 +0000 From: Alan Third Message-ID: Mail-Followup-To: Alan Third , Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= References: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> <99CD03DA-DF1F-4C2C-A2FA-DFD7DF3B2750@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <99CD03DA-DF1F-4C2C-A2FA-DFD7DF3B2750@acm.org> 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: -1.7 (-) On Tue, Dec 29, 2020 at 11:53:59PM +0100, Mattias Engdegård wrote: > 29 dec. 2020 kl. 22.24 skrev Alan Third : > > > I've pushed a small change. I also set the alloc'd objects to > > autorelease. We need to do that because when they're assigned to the > > NSMenuItem it will retain them, and because we alloc'd them we already > > have them retained once. > > > > At least I hope that's right. For some reason I've found the > > retain/release cycle really hard to understand, but I think I'm > > getting there now. > > Thanks! Is this the standard way of doing it? The objects that you > marked autorelease (tab and pstyle) are only used for the extent of > that method; I take it you prefer autorelease to sending them > 'release' at the end of the method? I think it's maybe visually a little neater to use autorelease, but either way works and I would probably do it the other way in different circumstances. Feel free to change it if you want. > Presumably 'atitle' should be sent autorelease (or release) as well? Yes, I missed that one. And actually, I think the alloc'd NSMenuItem on line 484 will need released too. It should probably be autoreleased because it's returned to the calling function, and the caller can then decide whether to retain it or not (it doesn't in this case). -- Alan Third From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Dec 2020 12:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alan Third Cc: 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.16093308003661 (code B ref 45502); Wed, 30 Dec 2020 12:20:02 +0000 Received: (at 45502) by debbugs.gnu.org; 30 Dec 2020 12:20:00 +0000 Received: from localhost ([127.0.0.1]:42083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuaSO-0000wz-Hy for submit@debbugs.gnu.org; Wed, 30 Dec 2020 07:20:00 -0500 Received: from mail1443c50.megamailservers.eu ([91.136.14.43]:36300 helo=mail264c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuaSL-0000wj-Pw for 45502@debbugs.gnu.org; Wed, 30 Dec 2020 07:19:59 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609330791; bh=OHwIVE3+uHnykNejIrArdO+eZIy9/iaf/upyW15lghM=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=d7+0UChijCiX9UnVDcl7Acf0lz3QiJ/nOKhgu8myDtjOimEMsShmkqCSNZ1TMAaBF rf/sEFCUGrj4+Szu1f9KOoznz1CBXqiUBYfp6pXoHpLrn1BCY3xNwWDNqG7/ihgJcn 2fkvKz98HTVrSZYr/Lhr0B/9pRbUCJk8gBDkRL9c= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail264c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BUCJm8x004424; Wed, 30 Dec 2020 12:19:50 +0000 From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Message-Id: <0F1B9914-2668-4775-822A-49A36D4A9F3F@acm.org> Content-Type: multipart/mixed; boundary="Apple-Mail=_A5E4FB74-4F00-4327-9160-6F58E05CDD5C" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Date: Wed, 30 Dec 2020 13:19:48 +0100 In-Reply-To: References: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> <99CD03DA-DF1F-4C2C-A2FA-DFD7DF3B2750@acm.org> X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F1E.5FEC7067.0007, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=bPlo382Z c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=hIj89exaAAAA:8 a=OsWix0dI85E5UVEG74cA:9 a=CjuIK1q_8ugA:10 a=jH5F5EiGhjIdZ16PmNgA:9 a=B2y7HmGcmWMA:10 a=lS9wXHQM5UdnNJ4u63Ry:22 X-Origin-Country: SE X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 30 dec. 2020 kl. 00.49 skrev Alan Third : > I think it's maybe visually a little neater to use autorelease, but > either way works and I would probably do it the other way in different > circumstances. Feel free to change it if you want. Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.3 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS 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.0 (/) --Apple-Mail=_A5E4FB74-4F00-4327-9160-6F58E05CDD5C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 30 dec. 2020 kl. 00.49 skrev Alan Third : > I think it's maybe visually a little neater to use autorelease, but > either way works and I would probably do it the other way in different > circumstances. Feel free to change it if you want. Thanks, I'm sticking to autorelease for uniformity here; slightly = delayed deallocation is no worse than GC after all. >> Presumably 'atitle' should be sent autorelease (or release) as well? >=20 > Yes, I missed that one. And actually, I think the alloc'd NSMenuItem > on line 484 will need released too. It should probably be autoreleased > because it's returned to the calling function, and the caller can then > decide whether to retain it or not (it doesn't in this case). Yes, fixed. (By the way, 'chording' isn't quite the same as a multi-key sequence; = chords are rather simultaneous presses, like C-M-x, no? To continue a = musical metaphor, perhaps an Emacs key sequence is an arpeggio?) Here is a slightly less ugly variant of the symbol substitution patch. = Maybe we should apply it and see if there are any complaints, or if we = turn against it ourselves later on? --Apple-Mail=_A5E4FB74-4F00-4327-9160-6F58E05CDD5C Content-Disposition: attachment; filename=0001-Use-standard-key-symbols-in-NS-menu-entries.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Use-standard-key-symbols-in-NS-menu-entries.patch" Content-Transfer-Encoding: quoted-printable =46rom=207ccf892b25d04d94bdcb76dfb6a000028e7b3c2a=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Wed,=2030=20Dec=202020=2013:06:47=20+0100=0A= Subject:=20[PATCH]=20Use=20standard=20key=20symbols=20in=20NS=20menu=20= entries=0A=0A*=20src/nsmenu.m=20(skipspc):=20Remove.=0A(key_symbols,=20= prettify_key):=20New.=0A([EmacsMenu=20fillWithWidgetValue:]):=20Call=20= prettify_key.=0A---=0A=20src/nsmenu.m=20|=2070=20= ++++++++++++++++++++++++++++++++++++++++++++--------=0A=201=20file=20= changed,=2060=20insertions(+),=2010=20deletions(-)=0A=0Adiff=20--git=20= a/src/nsmenu.m=20b/src/nsmenu.m=0Aindex=2034912705e2..c124bf500d=20= 100644=0A---=20a/src/nsmenu.m=0A+++=20b/src/nsmenu.m=0A@@=20-458,14=20= +458,6=20@@=20-=20(BOOL)performKeyEquivalent:=20(NSEvent=20*)theEvent=0A=20= }=0A=20=0A=20=0A-static=20const=20char=20*=0A-skipspc=20(const=20char=20= *s)=0A-{=0A-=20=20while=20(*s=20=3D=3D=20'=20')=0A-=20=20=20=20s++;=0A-=20= =20return=20s;=0A-}=0A-=0A=20-=20(NSMenuItem=20*)addItemWithWidgetValue:=20= (void=20*)wvptr=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20attributes:=20(NSDictionary=20*)attributes=0A= =20{=0A@@=20-485,7=20+477,7=20@@=20-=20(NSMenuItem=20= *)addItemWithWidgetValue:=20(void=20*)wvptr=0A=20=20=20=20=20=20=20item=20= =3D=20[[[NSMenuItem=20alloc]=20init]=20autorelease];=0A=20=20=20=20=20=20= =20if=20(wv->key)=0A=20=20=20=20=20=20=20=20=20{=0A-=20=20=20=20=20=20=20= =20=20=20NSString=20*key=20=3D=20[NSString=20stringWithUTF8String:=20= skipspc=20(wv->key)];=0A+=20=20=20=20=20=20=20=20=20=20NSString=20*key=20= =3D=20[NSString=20stringWithUTF8String:=20wv->key];=0A=20#ifdef=20= NS_IMPL_COCOA=0A=20=20=20=20=20=20=20=20=20=20=20/*=20Cocoa=20only=20= permits=20a=20single=20key=20(with=20modifiers)=20as=0A=20=20=20=20=20=20= =20=20=20=20=20=20=20=20keyEquivalent,=20so=20we=20put=20them=20in=20the=20= title=20string=0A@@=20-537,6=20+529,63=20@@=20-(void)removeAllItems=0A=20= }=0A=20=0A=20=0A+typedef=20struct=20{=0A+=20=20const=20char=20*from,=20= *to;=0A+}=20subst_t;=0A+=0A+/*=20Standard=20keyboard=20symbols=20used=20= in=20menus.=20*/=0A+static=20const=20subst_t=20key_symbols[]=20=3D=20{=0A= +=20=20{"",=20=20"=E2=8C=AB"},=0A+=20=20{"DEL",=20=20=20=20=20= =20=20=20=20=20"=E2=8C=AB"},=0A+=20=20{"",=20"=E2=8C=A6"},=0A= +=20=20{"",=20=20=20=20=20"=E2=86=A9"},=0A+=20=20{"RET",=20=20=20= =20=20=20=20=20=20=20"=E2=86=A9"},=0A+=20=20{"",=20=20=20=20=20=20=20= "=E2=86=90"},=0A+=20=20{"",=20=20=20=20=20=20"=E2=86=92"},=0A+=20=20= {"",=20=20=20=20=20=20=20=20=20"=E2=86=91"},=0A+=20=20{"",=20=20= =20=20=20=20=20"=E2=86=93"},=0A+=20=20{"",=20=20=20=20=20=20= "=E2=87=9E"},=0A+=20=20{"",=20=20=20=20=20=20=20"=E2=87=9F"},=0A+=20= =20{"",=20=20=20=20=20=20=20"=E2=86=96"},=0A+=20=20{"",=20=20=20= =20=20=20=20=20"=E2=86=98"},=0A+=20=20{"",=20=20=20=20=20=20=20=20= "=E2=87=A5"},=0A+=20=20{"TAB",=20=20=20=20=20=20=20=20=20=20"=E2=87=A5"},=0A= +=20=20{"",=20=20=20=20"=E2=87=A4"},=0A+};=0A+=0A+/*=20= Transform=20the=20key=20sequence=20KEY=20into=20something=20prettier=20= by=0A+=20=20=20substituting=20keyboard=20symbols.=20*/=0A+static=20char=20= *=0A+prettify_key=20(const=20char=20*key)=0A+{=0A+=20=20while=20(*key=20= =3D=3D=20'=20')=20key++;=0A+=0A+=20=20int=20len=20=3D=20strlen=20(key);=0A= +=20=20char=20*buf=20=3D=20xmalloc=20(len=20+=201);=0A+=20=20memcpy=20= (buf,=20key,=20len=20+=201);=0A+=20=20for=20(int=20i=20=3D=200;=20i=20<=20= ARRAYELTS=20(key_symbols);=20i++)=0A+=20=20=20=20{=0A+=20=20=20=20=20=20= ptrdiff_t=20fromlen=20=3D=20strlen=20(key_symbols[i].from);=0A+=20=20=20=20= =20=20char=20*p=20=3D=20buf;=0A+=20=20=20=20=20=20while=20(p=20<=20buf=20= +=20len)=0A+=20=20=20=20=20=20=20=20{=0A+=20=20=20=20=20=20=20=20=20=20= char=20*match=20=3D=20memmem=20(buf,=20len,=20key_symbols[i].from,=20= fromlen);=0A+=20=20=20=20=20=20=20=20=20=20if=20(!match)=0A+=20=20=20=20=20= =20=20=20=20=20=20=20break;=0A+=20=20=20=20=20=20=20=20=20=20ptrdiff_t=20= tolen=20=3D=20strlen=20(key_symbols[i].to);=0A+=20=20=20=20=20=20=20=20=20= =20eassert=20(tolen=20<=3D=20fromlen);=0A+=20=20=20=20=20=20=20=20=20=20= memcpy=20(match,=20key_symbols[i].to,=20tolen);=0A+=20=20=20=20=20=20=20=20= =20=20memmove=20(match=20+=20tolen,=20match=20+=20fromlen,=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20len=20-=20(match=20+=20= fromlen=20-=20buf)=20+=201);=0A+=20=20=20=20=20=20=20=20=20=20len=20-=3D=20= fromlen=20-=20tolen;=0A+=20=20=20=20=20=20=20=20=20=20p=20=3D=20match=20= +=20tolen;=0A+=20=20=20=20=20=20=20=20}=0A+=20=20=20=20}=0A+=20=20= Lisp_Object=20result=20=3D=20build_string=20(buf);=0A+=20=20xfree=20= (buf);=0A+=20=20return=20SSDATA=20(result);=0A+}=0A+=0A=20-=20= (void)fillWithWidgetValue:=20(void=20*)wvptr=0A=20{=0A=20=20=20= widget_value=20*first_wv=20=3D=20(widget_value=20*)wvptr;=0A@@=20-560,7=20= +609,8=20@@=20-=20(void)fillWithWidgetValue:=20(void=20*)wvptr=0A=20=20=20= =20=20=20=20=20=20maxNameWidth=20=3D=20MAX(maxNameWidth,=20= nameSize.width);=0A=20=20=20=20=20=20=20=20=20if=20(wv->key)=0A=20=20=20=20= =20=20=20=20=20=20=20{=0A-=20=20=20=20=20=20=20=20=20=20=20=20NSString=20= *key=20=3D=20[NSString=20stringWithUTF8String:=20skipspc=20(wv->key)];=0A= +=20=20=20=20=20=20=20=20=20=20=20=20wv->key=20=3D=20prettify_key=20= (wv->key);=0A+=20=20=20=20=20=20=20=20=20=20=20=20NSString=20*key=20=3D=20= [NSString=20stringWithUTF8String:=20wv->key];=0A=20=20=20=20=20=20=20=20=20= =20=20=20=20NSSize=20keySize=20=3D=20[key=20sizeWithAttributes:=20= font_attribs];=0A=20=20=20=20=20=20=20=20=20=20=20=20=20maxKeyWidth=20=3D=20= MAX(maxKeyWidth,=20keySize.width);=0A=20=20=20=20=20=20=20=20=20=20=20}=0A= --=20=0A2.21.1=20(Apple=20Git-122.3)=0A=0A= --Apple-Mail=_A5E4FB74-4F00-4327-9160-6F58E05CDD5C-- From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Dec 2020 12:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.160933242414278 (code B ref 45502); Wed, 30 Dec 2020 12:48:02 +0000 Received: (at 45502) by debbugs.gnu.org; 30 Dec 2020 12:47:04 +0000 Received: from localhost ([127.0.0.1]:42113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuasa-0003iD-2Y for submit@debbugs.gnu.org; Wed, 30 Dec 2020 07:47:04 -0500 Received: from outbound.soverin.net ([116.202.65.218]:45775) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kuasX-0003hj-U2 for 45502@debbugs.gnu.org; Wed, 30 Dec 2020 07:47:02 -0500 Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 20CBE6008F; Wed, 30 Dec 2020 12:46:55 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1609332414; bh=pTVXoczdgQSl+VlkqT1QUvPVZ7w8KfXzr39+pw9YO2g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T+YgsVPHPqYVHHuRYEbubCNI6mhvkGH2jAsnRbN09S8XsLcFqkU2HXRsKjRIbwdyW A+p8hlqnx3zVUZcAyyQOQgbMKLV6eHxjUvpB+adL6JlVb6AxTUYKjwGaiAmm9qxExh GxqCkK4Y5NFLrJDFGLDarmiptddH9WEkFST7cruRx6IlX2QHg35IeoIocr+9407he0 vvtzPWYVIMNj7iF7qc85MkO4WkRW+o0a6FsZp2Ti8Cptmv5U+H+/8D9iW1j30jVb/C Jsw6e9kqEA/DP1Y8WdIA8w4H6BVwRRyf7Ka9oPTwWVHv/Z22+g6If2lj/FC3agVBEM 9jAB0M+YriEIQ== Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 8BE2A202956C9A; Wed, 30 Dec 2020 12:46:52 +0000 (GMT) Date: Wed, 30 Dec 2020 12:46:52 +0000 From: Alan Third Message-ID: Mail-Followup-To: Alan Third , Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= References: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> <99CD03DA-DF1F-4C2C-A2FA-DFD7DF3B2750@acm.org> <0F1B9914-2668-4775-822A-49A36D4A9F3F@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0F1B9914-2668-4775-822A-49A36D4A9F3F@acm.org> 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: -1.7 (-) On Wed, Dec 30, 2020 at 01:19:48PM +0100, Mattias Engdegård wrote: > 30 dec. 2020 kl. 00.49 skrev Alan Third : > > (By the way, 'chording' isn't quite the same as a multi-key > sequence; chords are rather simultaneous presses, like C-M-x, no? To > continue a musical metaphor, perhaps an Emacs key sequence is an > arpeggio?) Good point. I thought about it for a while and wasn't really sure what to write, so my comment wasn't very good even ignoring that. :) > Here is a slightly less ugly variant of the symbol substitution > patch. Maybe we should apply it and see if there are any complaints, > or if we turn against it ourselves later on? It looks good to me, so I see no reason not to apply it and see if anyone complains. Oh, I noticed that the Mark menu in dired has the Help menu search entry. I guess I've missed something somewhere. I wondered if that was set somewhere but couldn't see any reference to it so assumed macOS was doing something clever when it saw a "Help" top level submenu... BTW, this isn't a comment on your code, I'm just curious. I notice you use C functions within Obj C classes where I would probably have just created another method. Is that just because they're dealing with C code exclusively or something else? -- Alan Third From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Dec 2020 13:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.160933376516350 (code B ref 45502); Wed, 30 Dec 2020 13:10:01 +0000 Received: (at 45502) by debbugs.gnu.org; 30 Dec 2020 13:09:25 +0000 Received: from localhost ([127.0.0.1]:42125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kubED-0004Fd-78 for submit@debbugs.gnu.org; Wed, 30 Dec 2020 08:09:25 -0500 Received: from outbound.soverin.net ([116.202.65.218]:48037) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kubEB-0004FL-Ba for 45502@debbugs.gnu.org; Wed, 30 Dec 2020 08:09:24 -0500 Received: from smtp.soverin.net (unknown [10.10.3.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 3A21C6008F; Wed, 30 Dec 2020 13:09:17 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.142]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1609333756; bh=gz/N+hS5BhwA7cu80DpgQfswH7MPhzqJ9+rmfjy1eQU=; h=Date:From:To:Subject:References:In-Reply-To:From; b=B5drKeFbkUSLn+08UCiz1IJUf1t1IrnIO5tulCtU3vzxYUfau6XM7F9qA4hL53rQ3 MNDaW3425rY5I+5Q0KgFn7sIAdHo606dYacRemRpeZMRAGJ3JJF85wL2itFFQuXSS7 K2fxsU9OSmz+NK9R5+CO2prhJYZuZxHYYVL7dAIkjsqpCknpIlAIzW96HYlvtQroOs NziFUkGKqEK3TJCGgrmMdiQEC33KWLPsObjTwqhR2s34khJ5Rhin0dhMcT+cUw993R 8VYQMyndbtQ7Jd1X6YTKmUZZUZg3h8LI7dfrgW9XPEd9sxM0Jj4akIkY8t4D1s0Wpm NqgUN0p1EYTdQ== Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 2CD95202959EA2; Wed, 30 Dec 2020 13:09:02 +0000 (GMT) Date: Wed, 30 Dec 2020 13:09:02 +0000 From: Alan Third Message-ID: Mail-Followup-To: Alan Third , Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= References: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> <99CD03DA-DF1F-4C2C-A2FA-DFD7DF3B2750@acm.org> <0F1B9914-2668-4775-822A-49A36D4A9F3F@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: -1.7 (-) On Wed, Dec 30, 2020 at 12:46:52PM +0000, Alan Third wrote: > Oh, I noticed that the Mark menu in dired has the Help menu search > entry. I guess I've missed something somewhere. I wondered if that was > set somewhere but couldn't see any reference to it so assumed macOS > was doing something clever when it saw a "Help" top level submenu... Ah, got it! modified src/nsmenu.m @@ -365,6 +365,9 @@ else submenu = [menu addSubmenuWithTitle: wv->name]; + if ([[submenu title] isEqualToString:@"Help"]) + [NSApp setHelpMenu:submenu]; + if (deep_p) [submenu fillWithWidgetValue: wv->contents]; -- Alan Third From unknown Mon Aug 18 11:29:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45502: [PATCH] Prettier key bindings in NS menu entries Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Dec 2020 13:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Alan Third Cc: 45502@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= Received: via spool by 45502-submit@debbugs.gnu.org id=B45502.160933396616711 (code B ref 45502); Wed, 30 Dec 2020 13:13:02 +0000 Received: (at 45502) by debbugs.gnu.org; 30 Dec 2020 13:12:46 +0000 Received: from localhost ([127.0.0.1]:42134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kubHP-0004LR-39 for submit@debbugs.gnu.org; Wed, 30 Dec 2020 08:12:46 -0500 Received: from mail18c50.megamailservers.eu ([91.136.10.28]:52768) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kubHJ-0004LD-Sa for 45502@debbugs.gnu.org; Wed, 30 Dec 2020 08:12:41 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609333955; bh=98/MGcEbraso0ZC8zpzB6SCKJV+Fx4jy1mK1di/q0RM=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=kuBcLDb3T7admQFnMWwGwnvHewKeSb+vpRAMrZZ/PDAC8d52KNHFWGF5Y5sIx+YMZ yxqFJgzx9834DRdqlVJYx1RwmrPZUsAP5BIxwuyriFXrZbh+YOjxddsV1RnEN6+CsS 6xA3KtbuXkKMOfJXEgJyeMklJYy9ZDZWqd+16ky8= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail18c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BUDCXbm031698; Wed, 30 Dec 2020 13:12:35 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= In-Reply-To: Date: Wed, 30 Dec 2020 14:12:32 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <62263FDE-74E8-4531-9F30-940F60EB1477@acm.org> References: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> <99CD03DA-DF1F-4C2C-A2FA-DFD7DF3B2750@acm.org> <0F1B9914-2668-4775-822A-49A36D4A9F3F@acm.org> X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F1A.5FEC7CC3.0058, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=e5N4tph/ c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=hIj89exaAAAA:8 a=GaEmlizfvmKoY74UCY4A:9 a=CjuIK1q_8ugA:10 a=lS9wXHQM5UdnNJ4u63Ry:22 X-Origin-Country: SE X-Spam-Score: 1.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: -0.0 (/) 30 dec. 2020 kl. 13.46 skrev Alan Third : > It looks good to me, so I see no reason not to apply it and see if > anyone complains. Good, will do. > Oh, I noticed that the Mark menu in dired has the Help menu search > entry. I guess I've missed something somewhere. I wondered if that was > set somewhere but couldn't see any reference to it so assumed macOS > was doing something clever when it saw a "Help" top level submenu... It's on the menu with the same index as Help normally has (because Dired = adds multiple menus to the bar); the same effect can be seen in M-x = shell. Perhaps we manage to confuse the Cocoa automatics somehow? > BTW, this isn't a comment on your code, I'm just curious. I notice you > use C functions within Obj C classes where I would probably have just > created another method. Is that just because they're dealing with C > code exclusively or something else? It's mostly accidental, but it is true that there is a tension between = different styles here -- I find plain functions to be fine for doing the = job of a function (being a functional programmer at heart helps, of = course...) and Objective-C allows it seamlessly. Methods don't bring = much when they don't somehow operate on the object state, and they = require declaration in the .h file even if only used locally (I might be = mistaken here). Thus no religion here; I can do it either way. From unknown Mon Aug 18 11:29:40 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Subject: bug#45502: closed (Re: bug#45502: [PATCH] Prettier key bindings in NS menu entries) Message-ID: References: <0C5CEE19-1D6C-4AAD-868E-D249579BCF29@acm.org> X-Gnu-PR-Message: they-closed 45502 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 45502@debbugs.gnu.org Date: Wed, 30 Dec 2020 15:54:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1609343642-27395-1" This is a multi-part message in MIME format... ------------=_1609343642-27395-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #45502: [PATCH] Prettier key bindings in NS menu entries which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 45502@debbugs.gnu.org. --=20 45502: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D45502 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1609343642-27395-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 45502-done) by debbugs.gnu.org; 30 Dec 2020 15:53:17 +0000 Received: from localhost ([127.0.0.1]:50794 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kudmm-00076r-SK for submit@debbugs.gnu.org; Wed, 30 Dec 2020 10:53:17 -0500 Received: from mail1447c50.megamailservers.eu ([91.136.14.47]:43094 helo=mail265c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kudmj-00076b-QI for 45502-done@debbugs.gnu.org; Wed, 30 Dec 2020 10:53:15 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609343587; bh=55EKd1eHCLwSfjJH5aKtYqBzcoqJYpi/nq2j8+6fvt8=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=s193fkLRXjyzNoX6zoLiYwcsN5RqC0Gc/CU0464x7nJ6BZszPh69kGkSL/xUr6OSY HaAn9TOVIg2CjHDo4fbymR60tG/ViQiE5ly0Tiie1yjOy7wqu1EpfDa4TTfdRpqFfM Rl2UU/pNTktRWQiVJjhgMYXcaAcmn9DAO+u3tc8s= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail265c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BUFr5Ys011627; Wed, 30 Dec 2020 15:53:06 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: bug#45502: [PATCH] Prettier key bindings in NS menu entries From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: Date: Wed, 30 Dec 2020 16:53:04 +0100 Content-Transfer-Encoding: 7bit Message-Id: <0C5CEE19-1D6C-4AAD-868E-D249579BCF29@acm.org> References: <02937096-EAF5-4B74-A1C7-CCE6E64C67E3@acm.org> <99CD03DA-DF1F-4C2C-A2FA-DFD7DF3B2750@acm.org> <0F1B9914-2668-4775-822A-49A36D4A9F3F@acm.org> To: Alan Third X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F20.5FECA263.002C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=QoAgIm6d c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=hIj89exaAAAA:8 a=axwwj7NztJQ8be-NxcMA:9 a=CjuIK1q_8ugA:10 a=LZ7w871ZH3oA:10 a=lS9wXHQM5UdnNJ4u63Ry:22 X-Origin-Country: SE X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 30 dec. 2020 kl. 14.09 skrev Alan Third : > Ah, got it! Good catch! I think we've squeezed this bug dry by now; closing. Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.3 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 45502-done Cc: 45502-done@debbugs.gnu.org, =?utf-8?Q?Daniel_Mart=C3=ADn?= 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.0 (/) 30 dec. 2020 kl. 14.09 skrev Alan Third : > Ah, got it! Good catch! I think we've squeezed this bug dry by now; closing. ------------=_1609343642-27395-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 28 Dec 2020 14:23:39 +0000 Received: from localhost ([127.0.0.1]:34684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kttQx-0008R0-1W for submit@debbugs.gnu.org; Mon, 28 Dec 2020 09:23:39 -0500 Received: from lists.gnu.org ([209.51.188.17]:59098) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kttQv-0008Qt-RP for submit@debbugs.gnu.org; Mon, 28 Dec 2020 09:23:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kttQv-0001bX-L4 for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2020 09:23:37 -0500 Received: from mail212c50.megamailservers.eu ([91.136.10.222]:59906 helo=mail194c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kttQs-00030m-OY for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2020 09:23:37 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1609165408; bh=fU0paIHjuXiqMuDrb3jUBowpt4ocBax5qDEIlmSorxI=; h=From:Subject:Date:To:From; b=QRUDTcGRDOLUYK+5R2T/c0PQMOBfI7rMZpLeoz2Y4M2lUMD5XbrqIY7+TkIniu+V5 NuZzpHki6p02GvzihGNyyLRK7tZbTBQrDNQaaf8xdBjZdC2QikKIqol6+T6rlYo+G4 vP/R7uW/Gku5oCtsBNJfOEQy7lhB0LIxU3/IGhyA= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0BSENQJD007881 for ; Mon, 28 Dec 2020 14:23:27 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Content-Type: multipart/mixed; boundary="Apple-Mail=_F8693C92-8DE6-46E3-B196-EFD187D21980" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: [PATCH] Prettier key bindings in NS menu entries Message-Id: Date: Mon, 28 Dec 2020 15:23:25 +0100 To: bug-gnu-emacs@gnu.org X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F2A.5FE9EA60.0028, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=AfXP4EfG c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=M51BFTxLslgA:10 a=cgnavh2NdbwcH_dWKUcA:9 a=CjuIK1q_8ugA:10 a=qwvwYxifb6zOxjQCdIIA:9 a=De_Ol2h6w80A:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.10.222; envelope-from=mattiase@acm.org; helo=mail194c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit 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: -2.3 (--) --Apple-Mail=_F8693C92-8DE6-46E3-B196-EFD187D21980 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii The NS port shows key bindings in a rather cluttered way, with the key = in brackets directly after the menu entry. The Mac port of Emacs is much = neater with the bindings all aligned at a common tab position. We could = do the same, but having done some experiments I actually prefer a = right-alignment of the keys. Proof-of-concept patch attached. The alignment is made by padding with spaces, and then with hair spaces = for extra precision; the result is not perfect but probably better than = what we have now. If I get some time, I might do an experiment with more = precise formatting. --Apple-Mail=_F8693C92-8DE6-46E3-B196-EFD187D21980 Content-Disposition: attachment; filename=right-justify-keys.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="right-justify-keys.diff" Content-Transfer-Encoding: 7bit diff --git a/src/nsmenu.m b/src/nsmenu.m index 3f0cd0c6ed..6c96f5f123 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -450,32 +450,14 @@ - (BOOL)performKeyEquivalent: (NSEvent *)theEvent } -/* Parse a widget_value's key rep (examples: 's-p', 's-S', '(C-x C-s)', '') - into an accelerator string. We are only able to display a single character - for an accelerator, together with an optional modifier combination. (Under - Carbon more control was possible, but in Cocoa multi-char strings passed to - NSMenuItem get ignored. For now we try to display a super-single letter - combo, and return the others as strings to be appended to the item title. - (This is signaled by setting keyEquivModMask to 0 for now.) */ --(NSString *)parseKeyEquiv: (const char *)key +static const char * +skipspc (const char *s) { - const char *tpos = key; - keyEquivModMask = NSEventModifierFlagCommand; - - if (!key || !*key) - return @""; - - while (*tpos == ' ' || *tpos == '(') - tpos++; - if ((*tpos == 's') && (*(tpos+1) == '-')) - { - return [NSString stringWithFormat: @"%c", tpos[2]]; - } - keyEquivModMask = 0; /* signal */ - return [NSString stringWithUTF8String: tpos]; + while (*s == ' ') + s++; + return s; } - - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr { NSMenuItem *item; @@ -488,31 +470,20 @@ - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr } else { - NSString *title, *keyEq; + NSString *title; title = [NSString stringWithUTF8String: wv->name]; if (title == nil) title = @"< ? >"; /* (get out in the open so we know about it) */ - keyEq = [self parseKeyEquiv: wv->key]; -#ifdef NS_IMPL_COCOA - /* macOS mangles modifier strings longer than one character. */ - if (keyEquivModMask == 0) - { - 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 setKeyEquivalentModifierMask: keyEquivModMask]; + /* Cocoa only permits a single key (with modifiers) as + keyEquivalent, so we stick with the standard Emacs notation + for all key bindings for the sake of uniformity. */ + if (wv->key) + title = [title stringByAppendingString: + [NSString stringWithUTF8String: skipspc (wv->key)]]; + item = [self addItemWithTitle: (NSString *)title + action: @selector (menuDown:) + keyEquivalent: @""]; [item setEnabled: wv->enabled]; @@ -557,14 +528,69 @@ -(void)removeAllItems - (void)fillWithWidgetValue: (void *)wvptr { - widget_value *wv = (widget_value *)wvptr; + widget_value *first_wv = (widget_value *)wvptr; + NSFont *menuFont = [NSFont menuFontOfSize:0]; + NSDictionary *attributes = + [NSDictionary dictionaryWithObject:menuFont forKey:NSFontAttributeName]; + NSSize spaceSize = [@" " sizeWithAttributes:attributes]; + CGFloat spaceWidth = spaceSize.width; + const char hair_str[] = "\u200a"; // HAIR SPACE + int hair_bytes = sizeof hair_str - 1; + NSSize hairSize = [[NSString stringWithUTF8String: hair_str] + sizeWithAttributes:attributes]; + CGFloat hairWidth = spaceSize.width; + CGFloat maxNameWidth = 0; + CGFloat maxKeyWidth = 0; + + /* Determine maximum width of menu items. */ + for (widget_value *wv = first_wv; wv != NULL; wv = wv->next) + if (!menu_separator_name_p (wv->name)) + { + NSString *name = [NSString stringWithUTF8String: wv->name]; + NSSize nameSize = [name sizeWithAttributes: attributes]; + CGFloat nameWidth = nameSize.width; + maxNameWidth = MAX(maxNameWidth, nameWidth); + if (wv->key) + { + NSString *key = [NSString stringWithUTF8String: skipspc (wv->key)]; + NSSize keySize = [key sizeWithAttributes: attributes]; + CGFloat keyWidth = keySize.width; + maxKeyWidth = MAX(maxKeyWidth, keyWidth); + } + } + CGFloat maxWidth = maxNameWidth + maxKeyWidth; /* clear existing contents */ [self removeAllItems]; /* add new contents */ - for (; wv != NULL; wv = wv->next) + for (widget_value *wv = first_wv; wv != NULL; wv = wv->next) { + if (wv->key && !menu_separator_name_p (wv->name)) + { + /* Modify name to include padding to right-justify key binding. */ + NSString *name = [NSString stringWithUTF8String: wv->name]; + NSSize nameSize = [name sizeWithAttributes: attributes]; + CGFloat nameWidth = nameSize.width; + NSString *key = [NSString stringWithUTF8String: skipspc (wv->key)]; + NSSize keySize = [key sizeWithAttributes: attributes]; + CGFloat keyWidth = keySize.width; + CGFloat padWidth = maxWidth - (nameWidth + keyWidth); + /* Use plain spaces as far as possible, and hair spaces for + the rest. */ + int extra_spaces = 4; + int nspaces = padWidth / spaceWidth + extra_spaces; + int nhairs = fmod(padWidth, spaceWidth) / hairWidth + 0.5; + int name_len = strlen (wv->name); + Lisp_Object s = make_uninit_string (name_len + nspaces + + nhairs * hair_bytes); + memcpy (SSDATA (s), wv->name, name_len); + memset (SDATA (s) + name_len, ' ', nspaces); + for (int i = 0; i < nhairs; i++) + memcpy (SDATA (s) + name_len + nspaces + i * hair_bytes, hair_str, + hair_bytes); + wv->name = SSDATA (s); + } NSMenuItem *item = [self addItemWithWidgetValue: wv]; if (wv->contents) diff --git a/src/nsterm.h b/src/nsterm.h index b7b4d3b047..c4873b6082 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -515,7 +515,6 @@ #define NS_DRAW_TO_BUFFER 1 @interface EmacsMenu : NSMenu { - unsigned long keyEquivModMask; BOOL needsUpdate; } --Apple-Mail=_F8693C92-8DE6-46E3-B196-EFD187D21980-- ------------=_1609343642-27395-1--