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.devel Subject: easy-menu-define keys for key-valid-p (was: Info-mode patch) Date: Tue, 04 Jul 2023 09:50:47 +0300 Organization: LINKOV.NET Message-ID: <86jzvgnqfo.fsf_-_@mail.linkov.net> References: <867cropyh3.fsf@mail.linkov.net> <86mt0kulli.fsf@mail.linkov.net> <86wmzmzs1s.fsf@mail.linkov.net> <86edluyxhl.fsf@mail.linkov.net> <86bkgxfm34.fsf@mail.linkov.net> <86zg4gddtf.fsf@mail.linkov.net> <86v8f2xkr4.fsf@mail.linkov.net> <835y72noo4.fsf@gnu.org> <83zg4dmd4k.fsf@gnu.org> <83pm59m8vs.fsf@gnu.org> <86sfa46e1l.fsf@mail.linkov.net> <833524n7pk.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13255"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: arthur.miller@live.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 04 08:58:57 2023 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 1qGa01-0003J6-BW for ged-emacs-devel@m.gmane-mx.org; Tue, 04 Jul 2023 08:58:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGZzD-00052C-1j; Tue, 04 Jul 2023 02:58:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGZzB-00051q-41 for emacs-devel@gnu.org; Tue, 04 Jul 2023 02:58:05 -0400 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGZz8-0001sE-PA; Tue, 04 Jul 2023 02:58:04 -0400 X-GND-Sasl: juri@linkov.net X-GND-Sasl: juri@linkov.net X-GND-Sasl: juri@linkov.net Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id F1C5B60004; Tue, 4 Jul 2023 06:57:57 +0000 (UTC) In-Reply-To: <833524n7pk.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 03 Jul 2023 21:57:59 +0300") Received-SPF: pass client-ip=217.70.183.195; envelope-from=juri@linkov.net; helo=relay3-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:307402 Archived-At: >> >> >> >> It seems you found a bug in 'key-valid-p'! >> >> >> >> And indeed it returns nil: >> >> >> >> >> >> >> >> (key-valid-p " ") >> >> >> > >> >> >> > Why is it a bug? " " has no meaning, >> >> >> > since it isn't a mouse event. >> >> >> >> >> >> Is "remap" a mouse event? >> >> > >> >> > Why is "remap" relevant to the issue at hand? >> >> >> >> I converted from "old idiom" in info.el to new defvar-keymap. When >> >> seeing "remap" (a dummy event) works, I just expected defvar-keymap was >> >> done the way that it is possible to use all keys, fake-kyes, events, >> >> and whatnot the same way. Similar as I expected 'frame to have same >> >> meaning everywhere for the uniformity. >> >> >> >> Would look more tidy if it was possible to keep all key definitions in >> >> the same place as in the old code. >> > >> > Do you mean that we had a binding like [tool-bar C-Back\ in\ history] >> > somewhere? >> >> This symbol is generated automatically by 'easy-menu-define' >> from the menu item "Back in History" with spaces inside. > > key-valid-p invalidates keys that have embedded whitespace, so we need > to decide whether we want to add that or modify easy-menu-define to > produce more reasonable symbols. Currently easy-menu-intern keeps spaces in strings: (defsubst easy-menu-intern (s) (if (stringp s) (intern s) s)) Replacing it with: (defsubst easy-menu-intern (s) (if (stringp s) (intern (string-replace " " "-" (downcase s))) s)) produces from the menu item "Back in History" a more reasonable symbol 'back-in-history' for which (key-valid-p " C-") returns t and can be used in defvar-keymap. OTOH, [tool-bar C-Back\ in\ history] worked in 27.2 but broke in 28.2 with " C- is undefined". After the change above, [tool-bar C-back-in-history] works again.