From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.devel Subject: Re: master 859190f 2/3: Convert some keymaps to defvar-keymap Date: Tue, 12 Oct 2021 14:34:02 -0700 Message-ID: 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> <87czoa9e7p.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28102"; 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 Tue Oct 12 23:34:42 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 1maPQ2-00078A-KD for ged-emacs-devel@m.gmane-mx.org; Tue, 12 Oct 2021 23:34:42 +0200 Original-Received: from localhost ([::1]:36984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1maPQ0-0004PF-E3 for ged-emacs-devel@m.gmane-mx.org; Tue, 12 Oct 2021 17:34:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maPPS-0003g3-Fr for emacs-devel@gnu.org; Tue, 12 Oct 2021 17:34:06 -0400 Original-Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:54945) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1maPPQ-0005zW-Pq for emacs-devel@gnu.org; Tue, 12 Oct 2021 17:34:06 -0400 Original-Received: by mail-pj1-x102d.google.com with SMTP id np13so616505pjb.4 for ; Tue, 12 Oct 2021 14:34:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:in-reply-to:references:mime-version:date:message-id:subject:to :cc; bh=tj/ispfFK2mnbOz/zH7IlbLmc2ueHn3CWEKcoIflyDw=; b=AfvME6R++Ia1MPm4ZAgL1SmyW5mEhW+OcsGCOU4jVuSDPDPXQGySocEGk6KBfNBDqT owmkYyEHDS3tPiR4dpqGE5NLDPKySJFqE9JuL9xU58FGpS/NJFr+2uBDWGo+ytrwDcVn w15XveGTHtm+iThTKNx49q3BnI2HCVaBSwdyO45/4fa712k7kTkNf3os0+6ZB32gJ7IE +Lg5Sv2JyPHFvJtZwHvQAqT4COh4nlt7+S8IhiCQ8INdJBuEdwTu/HB6xBTBiqKsomcI Ids9eDkj7VwQ3VqoFVMEtt0AwvUKJyl2qcNbmvHcpYkPGIbaPjosZ8IVdp9kQL6iznEr BceA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc; bh=tj/ispfFK2mnbOz/zH7IlbLmc2ueHn3CWEKcoIflyDw=; b=r0bFRosPxWgPymw0cfSkEXZGqZXo5SKHjbdUgY2Vc3uuKa+h1N43jMch/1r2om+IKS mw6OdIo33xVl7jDhz2bMt8cglpFa9czlgJbARDFnURFhyjnkI+SP19TTR+IbCqvG0LhN AWC5qK4hfOf+M+EXYoACyfpQP7MhcC801pDQtubEl6zwygmSVF1zGztKnvhIJa74Q8x7 iOBpd0+SVZvHIKyiDmfya2WJqlGYq4o8pXX6NawMnrFJdYjQUewxgF4iPuSGuywEObNC +wHq53Mn5CL/dbHlV7oJhV2CSRLEGPIBkVIkWWCnXPxNlfRGVrGCH8ic8LClKJSvlg5E 7j0w== X-Gm-Message-State: AOAM533MM47lpTpFMqcSyqTKTp7IyM0zfAVxD/I5Bx8N59qak3rBbCb/ oXoRIZJz+wIWZjfQsi562A6PAkM/4bfaPt/dnow= X-Google-Smtp-Source: ABdhPJxE/Fp5esowgR7Ffbuhc5Q8eTGQsRnckZC4pSvx/StNMzOItpRq5do5j8luIGWoXI445i9SQgy0XHyhrIGputU= X-Received: by 2002:a17:902:e74a:b0:13f:3538:fca0 with SMTP id p10-20020a170902e74a00b0013f3538fca0mr14505099plf.22.1634074443246; Tue, 12 Oct 2021 14:34:03 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 12 Oct 2021 14:34:02 -0700 In-Reply-To: <87czoa9e7p.fsf@gnus.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=stefankangas@gmail.com; helo=mail-pj1-x102d.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:276839 Archived-At: Lars Ingebrigtsen writes: > Lars Ingebrigtsen writes: > >> In the current Emacs tree, we have >7K instances of define-key with a >> string as a parameter, and 441 with (kbd ...). > > And 258 on the [(control ?+)]. Right, but how much of that is preloaded code, how much is unchanged since the 1990's, how much is written by core developers who can't use `kbd' due to bootstrap and just got out of the habit, etc.? In my case, I would definitely prefer to use kbd everywhere, but it feels out of place to convert an entire string of bindings to my preferred style just because I'm adding a keybinding. So I don't do that. IOW, I don't think that counting instances in core will necessarily lead to a very representative sample of current Emacs Lisp in this case. For comparison, here are the top packages on MELPA, excluding dash.el and other library packages without keybindings: https://github.com/magit/magit/blob/348d9b98614c824be3e2f05eef5ab91d67f6695e/lisp/magit.el#L283 https://github.com/emacs-helm/helm/blob/b2bd8a2a938030c70e7da84bd49cadcc095ec2b9/helm.el#L212 https://github.com/flycheck/flycheck/blob/784f184cdd9f9cb4e3dbb997c09d93e954142842/flycheck.el#L1096 https://github.com/bbatsov/projectile/blob/7f64570d3e6829d767d340c8584f3e4f3472ee81/projectile.el#L5377 https://github.com/company-mode/company-mode/blob/4c08ef468678bbf3b3c9e750f6e694eea1aa8423/company.el#L807 https://github.com/jrblevin/markdown-mode/blob/862ae8addd29bf6affca1a35fd0176cb0c1392da/markdown-mode.el#L5316 Six different principal authors, but all of them use kbd. I stopped checking after markdown-mode, but all I checked before that uses kbd. > (And as Eli said, `kbd' isn't something that we currently can use > everywhere, because the implementation depends on (basically) > everything. If the `kbd' syntax is to be used in keymaps everywhere, > somebody has to re-implement it to be self contained.) Yeah, that would need fixing if we want to use it in preloaded code. >From a quick glance, it looks like the meat of this is in `edmacro-parse-keys'. From there, you have a ton of calls to `cl-lib', regexps and what have you. But nothing in there looks like it should be impossible to get in shape, even for early bootstrap, does it? Personally though, I'd be quite happy even if we could just do what Juri said and add a :kbd keyword to defvar-keymap (t by default), and use :kbd nil in our preloaded code. I'm pretty sure that at least the above package authors (the "kbd" users) would also be happy. It's too nice of an addition to Emacs Lisp to not get it all the way over the finish line when we have the chance.