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.devel Subject: Re: [WIP PATCH] Adding keys to keymaps in alphabetical order (for use with `mode-line-mode-menu') Date: Sun, 20 Jun 2021 22:31:44 -0700 Message-ID: References: <87tulu11f1.fsf@gnus.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="28305"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jun 21 07:32:25 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lvCXp-0007Fe-2V for ged-emacs-devel@m.gmane-mx.org; Mon, 21 Jun 2021 07:32:25 +0200 Original-Received: from localhost ([::1]:55350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lvCXn-0006P2-Os for ged-emacs-devel@m.gmane-mx.org; Mon, 21 Jun 2021 01:32:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lvCXF-0005kB-KG for emacs-devel@gnu.org; Mon, 21 Jun 2021 01:31:49 -0400 Original-Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:35357) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lvCXD-0001OZ-In for emacs-devel@gnu.org; Mon, 21 Jun 2021 01:31:49 -0400 Original-Received: by mail-pf1-x42f.google.com with SMTP id t32so1391555pfg.2 for ; Sun, 20 Jun 2021 22:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=DlNcK2FId7+ZF1HdjKP+CbnqdFf8MIoYUI7kucEpMqo=; b=Q9qfm+t58M78JHlKPkLNf14AlPp2yJU6tA21sLkTp1MtbQVLRvb061Voll+IU4rflL MNSj6YVkjCFmojtOopTHDK5D/f/mso+56rxERUT/UHex6tmhKUL3NYDvI1HupwMEStwx nRWqqaymbwAuskFvcBTQ8CxsFYDyaXqdt3lKRBGEkemd6V+8krHf6zXXV/gFnaSxKneU lDwPgAAus/qV/+7LoCpVL1+iO4vUxj4KNN7EkzyqUnslQg8Q2bGBv+uUWZRrYmQmfRWO /wUDgq1AaZNyipZczm9bMAgX1MZfgWfFjF0SkDFXd0YCQyVRnnAZRD/1DU1tzDfpKIC4 gQkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=DlNcK2FId7+ZF1HdjKP+CbnqdFf8MIoYUI7kucEpMqo=; b=lqFMVdaV6gqFzbERUKuiqZ2SLte0EiYqlh/YkIghMIOI4OIy7dJyUpRCghDlEaMZYO I3gSMQx4yCfGFBcOCJVR2VZTi0O4dE2nlCIdNRqIz09hJ/uxmYvkRDuljEuXosmOHkc6 qIkFT48TUsYAdBfElU4/f3WJNF8qfmNuSfrvUhLlKnQ692uYLBWXkrDdMs09tHUNaTI/ nfyyNKJrbsTCJq4M5MvXo1U6e9rDMypjpvwfrTv1DEkQrNSs8zBfmg+3vRPJBey5Sd8B OJrKk/oI4yuHSSzCkJExpsip2jagSVQGvuyaWrDbpspbzVLxfAo8WfLdU1O5rWssOaIA JdVQ== X-Gm-Message-State: AOAM531zMC6tGbgx4dvv1Vlg0eFYM/pcX0C5uMHV/ayC09IU9LkM2ZRO yDAbc8YXMf+zUWQVYDbfZfPUu+N+kuo= X-Google-Smtp-Source: ABdhPJxC6lrHd0RWYbqnDItv2TBBbqeg7q8apYr+79nrIrY0gxKgaEJStooBJFZ8YwWjXE0xn4mneQ== X-Received: by 2002:a65:4109:: with SMTP id w9mr21853505pgp.24.1624253505534; Sun, 20 Jun 2021 22:31:45 -0700 (PDT) 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 p29sm7374195pfq.55.2021.06.20.22.31.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 20 Jun 2021 22:31:45 -0700 (PDT) In-Reply-To: <87tulu11f1.fsf@gnus.org> Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=jporterbugs@gmail.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:270960 Archived-At: On 6/19/2021 5:31 AM, Lars Ingebrigtsen wrote: > Jim Porter writes: > >> I've attached a simple patch that fixes this by adding a >> `define-key-sorted' function. I imagine it still needs some work to >> handle more complex cases, but it works well enough for >> `mode-line-mode-menu'. > > Hm... instead of adding a new function, perhaps it would make more > sense to just make the mode menu sort entries before displaying? That would also work, and have the added benefit that it's resilient even if a package neglects to use `define-key-sorted'. I'll look into the best way to trigger a sort just before opening the menu. Ideally, we could avoid re-sorting every time (unless the list has changed), but that might be more work than it's worth, given that the list is unlikely to be more than a few dozen elements. - Jim