From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#52293: 29.0.50; [PATCH v4] Prevent further cases of duplicated separators in context menus Date: Tue, 04 Jan 2022 10:19:13 +0200 Organization: LINKOV.NET Message-ID: <86zgobgbge.fsf@mail.linkov.net> References: <834k7ix4ij.fsf@gnu.org> <86pmq6taeb.fsf@mail.linkov.net> <83czm6unfs.fsf@gnu.org> <414be477-34d4-c777-f623-3e0e59c0dd08@gmail.com> <83o85mpaqb.fsf@gnu.org> <8e9b29cd-8700-1a60-1d91-b6995d8f433a@gmail.com> <86czm0eue5.fsf@mail.linkov.net> <8c440269-262a-ba78-6630-d3f90c2fcc19@gmail.com> <86fsqwmig7.fsf@mail.linkov.net> <1c1995a2-c033-51c8-4aa6-7458ad07c75c@gmail.com> <86mtl3629t.fsf@mail.linkov.net> <723c8965-31be-b636-beee-478fb77423ec@gmail.com> <86ee6egs8b.fsf@mail.linkov.net> <86fsq63pli.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4457"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: "52293@debbugs.gnu.org" <52293@debbugs.gnu.org> To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 04 09:21:18 2022 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 1n4f4I-0000zm-1W for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Jan 2022 09:21:18 +0100 Original-Received: from localhost ([::1]:51526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4f4G-0005qs-Rq for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Jan 2022 03:21:16 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4f43-0005nb-NV for bug-gnu-emacs@gnu.org; Tue, 04 Jan 2022 03:21:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53667) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n4f42-0007Eg-4q for bug-gnu-emacs@gnu.org; Tue, 04 Jan 2022 03:21:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n4f42-0005Td-1d for bug-gnu-emacs@gnu.org; Tue, 04 Jan 2022 03:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Jan 2022 08:21:02 +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.164128442120981 (code B ref 52293); Tue, 04 Jan 2022 08:21:02 +0000 Original-Received: (at 52293) by debbugs.gnu.org; 4 Jan 2022 08:20:21 +0000 Original-Received: from localhost ([127.0.0.1]:36978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4f3N-0005SJ-80 for submit@debbugs.gnu.org; Tue, 04 Jan 2022 03:20:21 -0500 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:56627) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4f3K-0005Rv-0l; Tue, 04 Jan 2022 03:20:19 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 6E5D740007; Tue, 4 Jan 2022 08:20:09 +0000 (UTC) In-Reply-To: (Jim Porter's message of "Sun, 2 Jan 2022 22:14:51 -0800") 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:223628 Archived-At: close 52293 29.0.50 thanks >>> I've attached an updated patch that lets context-menu-functions add items >>> to the beginning of the keymap as they currently do, while still removing >>> consecutive separators correctly. Since this logic is a bit tricky, it >>> could probably use an automated test or two, but before I write some, >>> I wanted to check that the strategy I'm using seems reasonable. It's >>> probably easiest to explain the logic by just pointing to the patch; >>> I added several comments describing the behavior so that reviewers (and >>> future readers) should be able to make sense of it. >> Thanks, I suppose it's for master, not for the release branch? > > Yeah, it's based on top of my previous patches that only landed on master, > so the same applies for this one. I don't personally have an issue with if > it merged to the release branch, but I also understand that we can't keep > adding things to Emacs 28 forever. > > Attached is an updated patch with unit tests as well as a fix to the > behavior from the previous version; in my last patch, it didn't delete the > last separator in the menu if it was *before* the "Context Menu" overall > prompt string. (This could happen if all the context-menu-functions *only* > used `define-key'.) > > I've fixed that, though it did make the function a bit more complex. I've > compensated for that with some more comments and what I hope are pretty > thorough tests to make sure everything works as expected. Thank you for the fix and for the unit tests. Now pushed to master. It seems this bug report can be closed now. If you have more patches, it can be reopened.