From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#52293: [External] : bug#52293: 29.0.50; [PATCH v3] Prevent further cases of duplicated separators in context menus Date: Sun, 12 Dec 2021 17:46:58 -0800 Message-ID: <8e9b29cd-8700-1a60-1d91-b6995d8f433a@gmail.com> References: <86tufn5jn9.fsf@mail.linkov.net> <86pmqa14fc.fsf@mail.linkov.net> <15eebcb1-b67a-8363-bc23-cf113913856f@gmail.com> <86h7bkhlo7.fsf@mail.linkov.net> <37047ada-fa33-88dd-5237-769611fec61b@gmail.com> <83wnkfw8ud.fsf@gnu.org> <86ilvysyq3.fsf@mail.linkov.net> <834k7ix4ij.fsf@gnu.org> <86pmq6taeb.fsf@mail.linkov.net> <83czm6unfs.fsf@gnu.org> <414be477-34d4-c777-f623-3e0e59c0dd08@gmail.com> <83o85mpaqb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5493"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "52293@debbugs.gnu.org" <52293@debbugs.gnu.org>, "juri@linkov.net" To: Drew Adams , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 13 02:48:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mwaRn-0001Es-Qg for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 13 Dec 2021 02:48:11 +0100 Original-Received: from localhost ([::1]:39572 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwaRm-0005wI-9N for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Dec 2021 20:48:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwaRe-0005vs-Ar for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 20:48:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41946) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mwaRd-0005k5-SB for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 20:48:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mwaRd-0001wN-Ny for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 20:48:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Dec 2021 01:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52293 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 52293-submit@debbugs.gnu.org id=B52293.16393600287267 (code B ref 52293); Mon, 13 Dec 2021 01:48:01 +0000 Original-Received: (at 52293) by debbugs.gnu.org; 13 Dec 2021 01:47:08 +0000 Original-Received: from localhost ([127.0.0.1]:53492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwaQl-0001t9-It for submit@debbugs.gnu.org; Sun, 12 Dec 2021 20:47:07 -0500 Original-Received: from mail-pg1-f174.google.com ([209.85.215.174]:42877) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwaQj-0001sf-DO for 52293@debbugs.gnu.org; Sun, 12 Dec 2021 20:47:05 -0500 Original-Received: by mail-pg1-f174.google.com with SMTP id l18so8520374pgj.9 for <52293@debbugs.gnu.org>; Sun, 12 Dec 2021 17:47:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=aJLqtsAr96VTQtckJnOBNK9OjqvP/YUxB8WsA06KgwM=; b=Gq3yZNO0WR73RzljliLi33Aam0oozJfeMu5iM3QZJH9ct91bY2BqTPzkVc8B9lZHS4 4oZ+Vq2fbWztwHiewoCSDi+NKjEH1LjaCl3QO6CF2R/0oEfWGp83IsrCUMzV9e3CMqnd cw+KFmAHzHSJS+40np6emuxH7eTVLMmSAGoiaHWzlYrcveFKOE6DSNg58ww97sQOcgg/ 5yrUFObKXPbTutB1bpkxa6hjx4J07NQes6r3+Dr3pky8EgJNZkWBLoHkWXZFxf5qrG0X vFilTIpX4/+lVNQgFLoSmwEntdyd6L8CJ3mS+liZBqlXU1MeHZY1xLZTdAlN1F9P2QVF uQfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=aJLqtsAr96VTQtckJnOBNK9OjqvP/YUxB8WsA06KgwM=; b=gU3HTHo7nvLpG8HHawz4vWzyjVPH3cCOs475VRv9Yl/KWYy7CSFGp+SEbiZgk2cfHk EkFOuVZq7biiibDGe6vUxTZj52es7LDe+/vuXNlMVadyRiNB9UObtFhB1CfitshBGeNg 6br5ulTWD6G7CQzz3uZph2r5V8x4AjrxQM6hCdXjN4RYFNTLOBsSE9iXOt+ErNMzawS+ SD+30CKOTjwsaxfpgBrCbpB0QP0TS3ZzZAIjnz+VLS8orV9ZDrmvr6TqeeZrPyRVCL4U b7jrvAPAS4ayvYOPJRh6PAF2D7IZl296DemzuerNn5H96V1MXQCnFUNGVo6MlpDofkSU giyQ== X-Gm-Message-State: AOAM533+1YRVlI+hW8khA4UAzl8faamCZvT4yZhCmzfccmF21VDK4Nyf Jvof3PdAe7jgiQg3cSDT4wk= X-Google-Smtp-Source: ABdhPJw5gD5ebNqlWWkEVjS9MPFWArjOjcP+dZx2xGzBLSvBLKLBfnYARqm4DMla0goQEk5fWGm29g== X-Received: by 2002:a05:6a00:cc9:b0:49f:b439:8930 with SMTP id b9-20020a056a000cc900b0049fb4398930mr31244012pfv.86.1639360019490; Sun, 12 Dec 2021 17:46:59 -0800 (PST) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id t13sm10012755pfl.214.2021.12.12.17.46.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Dec 2021 17:46:59 -0800 (PST) In-Reply-To: Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:222284 Archived-At: On 12/12/2021 5:16 PM, Drew Adams wrote: >>> 3. I think there's zero need for any naming >>> convention for menu-item names, whether >>> separators or other. >> >> The goal was to make it easier to remember the names of the separators >> if you wanted to add a new item after a particular separator that had >> already been added. It's easier to remember if they're all >> `foo-separator' instead of a mix of styles. > > Why does anyone need to _remember_ such names? > What's the use case for remembering? A third-party package author may want to insert context menu items in a particular spot in the menu (i.e. use `define-key-after'). Because the naming convention of separators is inconsistent, the author can more easily slip up and use the wrong name. As you might be able to tell, this is a very small issue. But the fix was easy, so I posted a patch for it. I really don't have a problem with closing that bug as wontfix if it's controversial. > Deduplication? We're not talking about removing > exact duplicates are we? I thought this was about > removing consecutive separators, leaving only one. > This involves no duplicate menu items: > > (define-key menu [separator-1] '("--")) > (define-key menu [separator-2] '("--")) That's correct. The above menu items would be de-duplicated since they're both separators. However, that logic only applies to "simple" separators, so the de-duplication code doesn't apply to this: (define-key menu [separator-1] '(menu-item "--")) (define-key menu [separator-2] '(menu-item "--")) (It's possible that's just an accidental omission in the original code though.) > More importantly, I didn't know this was about > removing any ordinary `define-key' bindings. > I really hope it's not. I thought this was only > for Juri's new context menus. This is *only* for context menus. The de-duplication code is in `context-menu-map', which is a function that gets called when opening the context menu. It calls all the elements of `context-menu-functions' in order, and then does the de-duplication step. No other menus will be affected by this. In any case, I think I prefer the solution I proposed in my followup: instead of removing consecutive separators so things look right, we can *add* separators between different "sections" of the context menu. Sections can be marked by the `:section' keyword and a name for the section (note: this only applies to the context menu, not other menus). That should completely prevent any unwanted manipulation of menus, since the programmer needs to opt into this behavior explicitly. In my limited tests, that method is also less brittle than the current method (this bug is an example of the brittleness). See my other message[1] for more details. [1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-12/msg01079.html