From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: [WIP PATCH] Adding keys to keymaps in alphabetical order (for use with `mode-line-mode-menu') Date: Sat, 19 Jun 2021 14:31:14 +0200 Message-ID: <87tulu11f1.fsf@gnus.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5033"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Jim Porter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 19 14:32:28 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 1lua9E-00017f-0P for ged-emacs-devel@m.gmane-mx.org; Sat, 19 Jun 2021 14:32:28 +0200 Original-Received: from localhost ([::1]:33320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lua9B-0006DB-Ml for ged-emacs-devel@m.gmane-mx.org; Sat, 19 Jun 2021 08:32:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lua88-0005ME-IZ for emacs-devel@gnu.org; Sat, 19 Jun 2021 08:31:20 -0400 Original-Received: from quimby.gnus.org ([2a01:4f9:2b:f0f::2]:40570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lua86-0007P3-O9 for emacs-devel@gnu.org; Sat, 19 Jun 2021 08:31:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=YII2cCGFNS0VAED5I5ujlU/CidVdovRy07UzhJR1uWA=; b=up5luJ30yyatt7OWIt2aZ7ZTSR /PzrPhxISSuU8fi/L/7fM1HiNqC8whmfCLy+d2WaKsFa/aiC8aaW7PjUhAd25BC6gVst5vcEeW5Ne kzHE4xRrl/LiXSWXPqgpYfKnyHx3/8BDRnlRSoIXnMjrSugy4OW2Zpgqz5PSMMh7gWow=; Original-Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lua82-0001xD-R0; Sat, 19 Jun 2021 14:31:17 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAElBMVEX6+/i0tq51eoI5 P1tNUmT////HiKSZAAAAAWJLR0QF+G/pxwAAAAd0SU1FB+UGEws3KgBYq0MAAAF+SURBVDjLzZJR lqwgDETB6QVA6wK0YQEPkwUoyf7XNAngCL4z/8NHt4drpSoxxvx3nPmTx3rfHj6/vDHTqn9v5u0B OMlvBGY+B8AcnVkwC2A3AjYWs4lPSeBsXrxKyYdkxiTwEChn7XNHZ/ECo71YSLJSKo9gQmaPCvgB Mse4xdHdHuIiNx+3jCCypRxzxC0oOO42cjjVIzCOsabPruaUd37EmteSKjPxYGKxxpVZ8lBrSheo Crwkr6MCbICxfa+5gVw7FyFsPaCbtGpL9cAQ+efsxaOmyjvdgFRiQfuQKXbJ6KhfcJPVyZ2Ay94Y S4DYlbkBU2mjXGEHAuG7TLYCwAYWRPdqxqokqGBCcBKZClIAQAosaTRRNAByUHcm4F6abLMQQACq AHAFlAIqA9KyyVCqYwGsQN6oYN16IIKiUTC3Unh9jGJ+6io4BW14vHvPJa6AIH1IJdXkt9zoFp8X SMvpfbZpSqIwHfj3JRss4KUdelzU/Ab7VMYl5jZ9A+57jQag6idkAAAAJXRFWHRkYXRlOmNyZWF0 ZQAyMDIxLTA2LTE5VDExOjU1OjQyKzAwOjAwGIeMmgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0w Ni0xOVQxMTo1NTo0MiswMDowMGnaNCYAAAAASUVORK5CYII= X-Now-Playing: Oval's _Scis_: "Piqqo" In-Reply-To: (Jim Porter's message of "Thu, 17 Jun 2021 20:39:42 -0700") Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org 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, 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:270945 Archived-At: Jim Porter writes: > Currently, there's not a simple way of inserting a key binding into a > keymap in alphabetical order. This would be nice for > `mode-line-mode-menu'; to see the issue, you can run the following: > > emacs -Q > ;; on the mode name in the mode-line > ;; See the nice alphabetical list > M-x ruler-mode > ;; on the mode name in the mode-line again > ;; "Ruler" is first(?!) Yup; I can reproduce this issue, too. > 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? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no