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#52237: 29.0.50; [PATCH] Doubled separators in context-menu-mode Date: Thu, 2 Dec 2021 10:09:29 -0800 Message-ID: <6e042c91-802b-a7c6-8dc6-2ef5d5a6d1ab@gmail.com> References: <0bbe5580-8e05-4e18-5b91-04b41b6f19bc@gmail.com> 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="9768"; mail-complaints-to="usenet@ciao.gmane.io" To: Drew Adams , "52237@debbugs.gnu.org" <52237@debbugs.gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 02 19:10:31 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 1msqXP-0002Nd-MY for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Dec 2021 19:10:31 +0100 Original-Received: from localhost ([::1]:54634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1msqXM-0007xy-IZ for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Dec 2021 13:10:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1msqWw-0007xG-UI for bug-gnu-emacs@gnu.org; Thu, 02 Dec 2021 13:10:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37644) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1msqWw-0007jP-Ki for bug-gnu-emacs@gnu.org; Thu, 02 Dec 2021 13:10:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1msqWw-0003PS-9Y for bug-gnu-emacs@gnu.org; Thu, 02 Dec 2021 13:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Dec 2021 18:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52237 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo patch Original-Received: via spool by 52237-submit@debbugs.gnu.org id=B52237.163846857913070 (code B ref 52237); Thu, 02 Dec 2021 18:10:02 +0000 Original-Received: (at 52237) by debbugs.gnu.org; 2 Dec 2021 18:09:39 +0000 Original-Received: from localhost ([127.0.0.1]:49190 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msqWZ-0003Ok-0n for submit@debbugs.gnu.org; Thu, 02 Dec 2021 13:09:39 -0500 Original-Received: from mail-pl1-f181.google.com ([209.85.214.181]:46724) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1msqWW-0003OV-32 for 52237@debbugs.gnu.org; Thu, 02 Dec 2021 13:09:37 -0500 Original-Received: by mail-pl1-f181.google.com with SMTP id p18so264974plf.13 for <52237@debbugs.gnu.org>; Thu, 02 Dec 2021 10:09:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=gP84A7dR5pYZ7030cX4d9hXLR55nDkzATyIKURqZODU=; b=Jee9wsIZPhVu03QsJ1wmUzQcXP9fXBQzk7WF2pfIfLtgdjQ2l3d4lpbLEyoA8lWAyz v94AfmKD/lmj2shiE6lWjzIyr0IZfZRqHBW5GOgHw//ZBnx2OmWvCC0KcHVxLjPU1FZi PmZm6qIb7iwOVrW91xflpoZONmpi95iI1aSvnZck9pXlQqUMllg2bU5ZyTD5F4BeFLkb UMFk1dc6h1XQUCTeWExMr9/6mqYzlV1EhcsVBKsVjZgmoQyMVZsnbSNxjrznF6+teW0B iSWti8j1gHIA4WtRw7XrXYrgcEUbs73i472vkGJD2MRVXhNnjBJnUmu6oaEAUEvnQhPO qrrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=gP84A7dR5pYZ7030cX4d9hXLR55nDkzATyIKURqZODU=; b=V+wa1MXpPMTn2BFTWwT/MC1ku0fJ9LHMRMZv1yMThZV7Rl/gVUEGHsHaqwPPBm3IYs FI9LzO17sjkq02pRgC8EEqmPa7y2xroEbDzp/amIiVG9dn48oUFoSZ82q4+AGqmwdPIC Y0BEVAyzvJP8/Uk9ftIBHitmoDAzQEluLkIJho51sOp399z+IFOa/AsjkABpGWDigAwg Js8ish84nQVmQFY2d2WSSkp9bpp+4Bv4w8AFdLrGmz0lAvHAQqw1UHiCdWXJn4nYHuFG heWG0HsGWxvjqRBh4btFKusZ1LNcHbZrRM8Sg0OT95x3yOnfJz0aWGfIvP1fL28d/zts QwzQ== X-Gm-Message-State: AOAM5333MxxhfWYZmqenILL/Kl4bkdavDV0Nb7mE9n/UHfYAR8lCv/C6 gxOS//VxylAPHhlKxDFFg8ZqWpU6mNc= X-Google-Smtp-Source: ABdhPJyfA4ogsP1W2N8lMTmXhh0OIQKp81aOQF+NEwRfrkMIamnp107nXGi/H3j/iQghQDpdbxItUA== X-Received: by 2002:a17:90a:9907:: with SMTP id b7mr7817386pjp.137.1638468570365; Thu, 02 Dec 2021 10:09:30 -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 i5sm288344pgo.36.2021.12.02.10.09.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Dec 2021 10:09:29 -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:221336 Archived-At: On 12/2/2021 9:31 AM, Drew Adams wrote: > Why should any repetition of separators be removed > or ignored? > > If someone codes that then they presumably want that. > Vanilla Emacs need not code such repetition. As far as I understand (which isn't very far; I've only just started tinkering with context-menu-mode), the general idea is that the context menu is generated dynamically by a list of functions stored in `context-menu-functions'. Each of these can add items to the menu. Some of these, like `context-menu-minor', first add a separator and then iterate over a list of things (minor modes in this case) to add more items. If that list is empty, you just get a separator, but then that separator might get doubled up with the separator from the *next* context menu function. In some cases, these separators are used as anchors to determine where to put the results of *later* context menu functions too. For example, `context-menu-middle-separator' is one of the default entries in `context-menu-functions', and as the name implies, it *only* adds a separator. Some other context menu functions (e.g. `elisp-context-menu') look for that separator to know where to put new menu items, so we want that separator to be there during construction, even if it might result in duplicated separators by the end (which `context-menu-map' would then strip out before display). This logic could apply to separators generated by other functions too, such as `context-menu-minor' described above.