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: master c9cb59b 2/2: * etc/TODO: Entry about converting to defvar-keymap. Date: Sat, 11 Dec 2021 04:02:53 +0100 Message-ID: <87zgp7x2qq.fsf@gnus.org> References: <83ilvwsdxg.fsf@gnu.org> <83ee6ks8rn.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="21514"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Stefan Kangas , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 11 04:03:46 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 1mvsfq-0005Qf-Ia for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Dec 2021 04:03:46 +0100 Original-Received: from localhost ([::1]:51930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mvsfo-0005I4-0m for ged-emacs-devel@m.gmane-mx.org; Fri, 10 Dec 2021 22:03:44 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvsf9-0004cz-J5 for emacs-devel@gnu.org; Fri, 10 Dec 2021 22:03:04 -0500 Original-Received: from [2a01:4f9:2b:f0f::2] (port=51190 helo=quimby.gnus.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvsf7-0007Ad-Sb; Fri, 10 Dec 2021 22:03:03 -0500 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=INr4uuDH10K5QErTj5unYKpA1O0XcppcA7RyEWDKLas=; b=YLNeUm2P0n7jM1yvZXPnExrPxH ISsMsbBnJjqhBv2QBWqEzENeseC3RvP7Vi0YnP1xt9viz9gj/mmeXBIvIFu0ZpdAPXmMsejsEDaDJ 6REwSvOWV+hA1vKmy+w7gV5HTHJvrNJETx5yHcrt7Duww99OgNOkCQqOkcZ4OLUwvTfM=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mvsf0-00006w-Ew; Sat, 11 Dec 2021 04:02:57 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAFVBMVEXq8fnAqLegeX9e OEAjFBucVUH///8QE4DzAAAAAWJLR0QGYWa4fQAAAAd0SU1FB+UMCg0iAI96+IcAAAGdSURBVDjL 1VNBbsNACNzkBbHzgtjtvTLwAsgHgvn/Vzqw2ciVUqnXcshGMzALw7q1fx8T4i28LLTc3sArmSm1 H9RpmomAI5peDtnzShVJ2DSYeSnQO9V4/ur4lY5hjeatejvzC3RSIhAkt0s78TE/CQMhy3TNRBsE o107K3iKz2NFEQtwY5MoSJBTVIvsz1AlLhEumATnKs17Kco8hlI4oyvxrTe4i2DknIGcrUUKoMEt b+yixRQRXSRSXnoCPQnom7o8hlU8iEdyTttHZUHZn0TFA832+meFD8ZjM+1X9q7oRRDb2ikMqAPN YHUtsVZWUNboaJzvOJtSCKokk7OMlctRmChlSMRu+LnvyorXw628wVwibpmZQzA8aUDZcq8SBpPz QoWV0RIDsmLB+c7QExJRWvvAAn2TYFgrNIiczg1dMS6BICzjkso11xxQhx8Ch1JS63JsAbALtLIJ VCjeLoaoJZpIIrh8r9fONVx5IfUByI52jdGuvExcOdW4+IY/MKAeLJDCuBO/xB8JpeeZ32CenhOb YKB8AjDE+RtdBtpHyoFRdQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMS0xMi0xMFQxMzozNDowMCsw MDowMD0NvwUAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjEtMTItMTBUMTM6MzQ6MDArMDA6MDBMUAe5 AAAAAElFTkSuQmCC X-Now-Playing: Section 25's _From The Hip_: "Inspiration" In-Reply-To: <83ee6ks8rn.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 10 Dec 2021 18:51:40 +0200") X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:4f9:2b:f0f::2 (failed) Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 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_MED=-2.3, RDNS_NONE=0.793, 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.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" Xref: news.gmane.io gmane.emacs.devel:281637 Archived-At: Eli Zaretskii writes: >> Please feel free to revert it if you disagree. > > I will, unless Lars disagrees. Are we talking about reverting the TODO item? That's fine with me, because I think it's a bit early to mandate rewriting all the keymaps, but I do think that should be our long term goal. Normally I'm against code churn, but that's mainly because it makes it hard to do code archaeology to determine what the meaning of a particular piece of code was. It's often unclear what some piece of code was meant to achieve, so you have to look at the other changes made at the same time, and then try to piece things together. That's not really the case with keymaps, though -- there's little logic to unravel, so if they change syntactically, it's no big deal. The advantages of the conversion has to outweigh that "no big deal", though, but I think in this case they do: 1) In the future, we can envision programmers only having to deal with one single way to represent key bindings in Emacs Lisp code. It would be nice if that were the case, but to get there, we have to covert the keymaps. 2) The temptation to rewrite a map when doing adding a key or two is great, but it makes that single commit harder to read. So converting maps as a separate commit makes things easier to read, not harder. 3) Today the vast majority of the keys are set as such: (define-key calc-mode-map "dp" 'calc-show-plain) While doing conversion to defvar-keymap, we'd also convert to #', which gives us byte compilation support for mis-spelled commands. I found a couple of bindings that pointed to commands that doesn't exist when doing the few conversions that I've done. It's mainly a help when adding new bindings, of course, but people will cargo cult the previous line when adding new bindings, and won't get help from the byte compiler. 4) The shorter syntax is less error-prone in general, since you don't repeat the keymap name in every line. This means that people that hack on this in the future will be able to move slightly faster if the maps have been converted. 5) If we never get to where C-i/TAB can be round-tripped reliably by other means (Stefan M had some ideas, but I think we stalled?), I have a patch waiting to fix this by other means -- but not for `define-key', of course. So `defvar-keymap'd keymaps will be displayed the same as the way they were defined in `C-h b', which is nice. So I'm all for Stefan K continuing to convert keymaps while procrastinating. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no