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 08:54:20 +0000 Message-ID: <818f9907c2b1fe8b54b1@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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30799"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Kangas , emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 13 10:57:19 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 1maa4d-0007o9-4g for ged-emacs-devel@m.gmane-mx.org; Wed, 13 Oct 2021 10:57:19 +0200 Original-Received: from localhost ([::1]:36288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1maa4b-0001DP-7U for ged-emacs-devel@m.gmane-mx.org; Wed, 13 Oct 2021 04:57:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maa1q-00078m-5P for emacs-devel@gnu.org; Wed, 13 Oct 2021 04:54:26 -0400 Original-Received: from heytings.org ([95.142.160.155]:48832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maa1o-0007WN-7A for emacs-devel@gnu.org; Wed, 13 Oct 2021 04:54:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1634115262; bh=Ob+EcgdtjUwVkm/FN+U4vl3/Z1GMROKWXBFvpsULrjc=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=d2ilKtzaoQhkaF97KubTTMh8HOqX5AoX6vv4OBp2jsEw/RxOKdS3prm0UF94yJocL UeuDmrUwRkMekfuUg310FSbL8+rJDEsLjXgx85qb9KySp6YPJ5K1ujtBBco2A1/t+N Gt70+PfDCSjsYn3dofhvv/bY+mSjilPENoql0JyRbet2hBbz797MJF9UCKZbrskKkE AwNXiBprvyKUqEiBHjvF7kph1i4VtbpgGXjXLFBzWbC0Vmo3OpBArWckG8/CAEtsUT P5/zvWI9AORv3ElMrjBG3eQu/0wKmXw7KBUquO2g8/GPB/NsS7V3+tvma0LOpRhW+a /4TK0EYjAveEA== In-Reply-To: <87h7dm9en7.fsf@gnus.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:276866 Archived-At: >> Aha. Now I understand the argument. But surely that's pretty minor, >> given that we can just document this difference? People might >> appreciate the easier to read syntax many times more than they will >> struggle with this minor additional complexity. > > Well, we have a bunch of different key syntaxes, and two of them are > strings and therefore aren't marked as syntactically different. > But their syntaxes are different, aren't they? >> It seems somewhat unfortunate to me that we are effectively doubling >> down on the mistakes of the past. I'd rather take one step forward >> now, in the hope that we can do something about "define-key" later. > > I don't think that's a forlorn hope. We'd have to introduce a new > function. > Is this not possible as follows (it's a POC), without introducing a new function? diff --git a/src/keymap.c b/src/keymap.c index be45d2be1e..7cad7cb4d1 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1059,6 +1059,11 @@ DEFUN ("define-key", Fdefine_key, Sdefine_key, 3, 3, 0, { bool metized = false; + if (STRINGP (key) && + (strstr (SSDATA (key), "C-") || strstr (SSDATA (key), "M-")) && + !NILP (Ffboundp (Qkbd))) + key = safe_call1 (Qkbd, key); + keymap = get_keymap (keymap, 1, 1); ptrdiff_t length = CHECK_VECTOR_OR_STRING (key); @@ -3261,4 +3266,6 @@ syms_of_keymap (void) defsubr (&Stext_char_description); defsubr (&Swhere_is_internal); defsubr (&Sdescribe_buffer_bindings); + + DEFSYM (Qkbd, "kbd"); }