From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.devel Subject: Re: master 859190f 2/3: Convert some keymaps to defvar-keymap Date: Wed, 13 Oct 2021 16:07:42 +0000 Message-ID: <818f9907c2dff3b49971@heytings.org> References: <20211004081724.6281.11798@vcs0.savannah.gnu.org> <20211004081727.4F24921048@vcs0.savannah.gnu.org> <871r4qcs8s.fsf@gnus.org> <87o87ubcnl.fsf@gnus.org> <87h7dm9en7.fsf@gnus.org> <818f9907c2b1fe8b54b1@heytings.org> <83tuhlnkxm.fsf@gnu.org> <818f9907c2f359a71f49@heytings.org> <83czo9nj4g.fsf@gnu.org> <818f9907c244b9db0bea@heytings.org> <834k9lnd2i.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8829"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, stefankangas@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 13 18:08:45 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 1mago7-0001ow-UB for ged-emacs-devel@m.gmane-mx.org; Wed, 13 Oct 2021 18:08:44 +0200 Original-Received: from localhost ([::1]:46344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mago6-0007wU-SO for ged-emacs-devel@m.gmane-mx.org; Wed, 13 Oct 2021 12:08:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1magnE-0007FO-7u for emacs-devel@gnu.org; Wed, 13 Oct 2021 12:07:48 -0400 Original-Received: from heytings.org ([95.142.160.155]:49532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1magnA-0000NX-Vv; Wed, 13 Oct 2021 12:07:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1634141262; bh=0OAI3XhBWSb2/kzCvqGO2NU6iNfl2E5OYppTj+4Fu7g=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=Sm6MIardOfgimgUakvheEka/5mpGznvSYqkxRVAyQLu3njBnP3I8s8Flz7tarWWYf 97tTEORyd+69r4ZU3Jw6bPX7AOity97dCbzPg66NvPX9/ytP5Phx4lbdWWHfUjlqnl d+knZ6po9LPi2Z/nRjvLK2W35LR+WKNvUxrgNpEwvgKLPGWG633mIsnSIjgX9KHMPh QY1kUN5UoviTgeCP395noO1485De30aZ9LwrMHUMAh5lm0Bx7KqgHjH7dsGJueBdLx idLU/7y3CZ2eB0IKXV/k4zvmzzsk7CKMtza1cv0d99NQCFB1J7Op7xtdZFQ8zuoUBQ M+oGj2wKn8KtA== In-Reply-To: <834k9lnd2i.fsf@gnu.org> Received-SPF: pass client-ip=95.142.160.155; envelope-from=gregory@heytings.org; helo=heytings.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, SPF_HELO_PASS=-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:276922 Archived-At: >> No need to apologize. But what do you (and others) think of the idea? >> It would be a (IMO elegant) way to "phase out strings (where every char >> represents an event)". > > What do you intend to do with the "effectively preload kbd.el" part of > my comments? If you indeed intend to preload kbd.el, that could be a > bummer, I think. If you have other ideas, please tell. > Well, Lars (and Stefan K) already replied that it's a no go, so I don't think it's useful to explore this further. To reply to your question anyway: perhaps I'm misunderstanding something, but I don't see why this would in itself imply preloading anything new. The (fboundp 'kbd) check, and checking that the return value of safe_call1 is non-nil (which I didn't do in the proof of concept) means that this would not have any effect until subr.el and edmacro.el (there's no "kbd.el", so I guess you mean "edmacro.el") are loaded. Here's a slightly more elaborate proof of concept: diff --git a/src/keymap.c b/src/keymap.c index be45d2be1e..8e0a99a4b0 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1059,6 +1059,15 @@ DEFUN ("define-key", Fdefine_key, Sdefine_key, 3, 3, 0, { bool metized = false; + Lisp_Object kbd_key; + if (STRINGP (key) && + (strstr (SSDATA (key), "C-") || strstr (SSDATA (key), "M-") || + strstr (SSDATA (key), "S-") || strstr (SSDATA (key), "H-") || + strstr (SSDATA (key), "s-")) && + !NILP (Ffboundp (Qkbd)) && + !NILP (kbd_key = safe_call1 (Qkbd, key))) + key = kbd_key; + keymap = get_keymap (keymap, 1, 1); ptrdiff_t length = CHECK_VECTOR_OR_STRING (key); @@ -3261,4 +3270,6 @@ syms_of_keymap (void) defsubr (&Stext_char_description); defsubr (&Swhere_is_internal); defsubr (&Sdescribe_buffer_bindings); + + DEFSYM (Qkbd, "kbd"); }