From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Merging scratch/substitute-command-keys to master Date: Sat, 17 Oct 2020 12:19:44 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10861"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Oct 17 18:21:06 2020 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 1kTox7-0002gG-Jo for ged-emacs-devel@m.gmane-mx.org; Sat, 17 Oct 2020 18:21:05 +0200 Original-Received: from localhost ([::1]:44582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTox6-0001a1-Gk for ged-emacs-devel@m.gmane-mx.org; Sat, 17 Oct 2020 12:21:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTovy-00012y-Ck for emacs-devel@gnu.org; Sat, 17 Oct 2020 12:19:54 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:46778) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTovt-0001n4-TM for emacs-devel@gnu.org; Sat, 17 Oct 2020 12:19:52 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 719914402A5; Sat, 17 Oct 2020 12:19:48 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9E7A144026D; Sat, 17 Oct 2020 12:19:46 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1602951586; bh=rbv3yw8DK1Xb9ZnAwKmepGt3cVB3ZBzoqAgFKydSFcI=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=FbGq5rIPgua9HsZ++6PlpA0RLSP3VpKXW9t39dpNWiZj6DT3p6TkjrSe0Wmp73rs1 592MIc4pgXGv/JNWtXAoPJFxGL2pQOnrbJQtUa001inBPAho821CA1EKbOBPqE6+RE 4m0zhoTSo6wFUjwJbiviTJJnFbbm3A3MNFMQLU0tDFoNaUw7AmGLe+p6khuOraSOXP jtG5BF+iBGIaZSZ86TxTtsGj2mHtmjbNzBNH/pjLiob72HZMlRSiBiW0PYLB6iJz1F 9rt7QBhWOF5vG2Bsidf28JKlgMqY9yAqMVK39JYi+z9ZNhzyZkjGl3qNv80Zcwl0A+ F4/v5h7FbrY4w== Original-Received: from alfajor (unknown [157.52.9.240]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1BADE120249; Sat, 17 Oct 2020 12:19:46 -0400 (EDT) In-Reply-To: (Stefan Kangas's message of "Sat, 17 Oct 2020 14:03:25 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/17 09:13:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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:257952 Archived-At: > One obvious concern is performance. Here is what I've used to > benchmark it: > > (with-temp-buffer > (dired-mode) > (let* ((times 100) > (result (benchmark-run times > (documentation 'dired-mode)))) > (cl-mapcar '/ result (make-list 3 (float times))))) > > Old C version: (0.02171680510 0.2 0.01730526807) > New Lisp version: (0.02775125134 0.24 0.01882684842) LGTM! > [It would be useful if someone could help verify the above results.] I don't have a clean baseline against which to run such tests, but I can confirm that the speed is comparable (I do see a 50% increase of calls to the GCs (instead of the 20% increase you're seeing), but I don't think it's something we should worry about). > Finally, note that I didn't yet rip out the old C code, and that the > branch is currently based on the master branch from May. AFAICT it applies cleanly to the current master. See comments below. Other than those details, LGTM, > (BTW, do we generally merge branches as-is with their full history or > do we squash them and push as a single commit?) We generally do either of those or yet something else (e.g. rebase, with or without cleaning up the history). I like to just merge, personally. Stefan I used `git diff HEAD...origin/scratch/substitute-command-keys`: > diff --git a/lisp/help.el b/lisp/help.el > index b7d867eb70..196c431607 100644 > --- a/lisp/help.el > +++ b/lisp/help.el > @@ -147,12 +147,12 @@ help-print-return-message > pop-up-frames > (special-display-p (buffer-name standard-output))) > (setq help-return-method (cons (selected-window) t)) > - ;; If the help output buffer is a special display buffer, > - ;; don't say anything about how to get rid of it. > - ;; First of all, the user will do that with the window > - ;; manager, not with Emacs. > - ;; Secondly, the buffer has not been displayed yet, > - ;; so we don't know whether its frame will be selected. > + ;; If the help output buffer is a special display buffer, > + ;; don't say anything about how to get rid of it. First of > + ;; all, the user will do that with the window manager, not > + ;; with Emacs. Secondly, the buffer has not been displayed > + ;; yet, so we don't know whether its frame will be > + ;; selected. > nil) > ((not (one-window-p t)) > (setq help-return-method This looks like a spurious change. > +Each substring of the form \[COMMAND] is replaced by either a In Emacs's `master` the ELisp major mode should show you those \[ with a bright red color on the backslash because it does nothing. > +Each substring of the form \{MAPVAR} is replaced by a summary of Same here (and a few other places). > +(defvar internal--seen) [...] > +(defun describe-map-tree (startmap partial shadow prefix title no-menu > + transl always-title mention-shadow) [...] > + (setq internal--seen nil) [...] This `setq` will give a global value to the var. So you might as well also give it a global value in the `defvar`. Also, I'd prefer it if the variable used a prefix that's related to the file where it's defined (i.e. `help--`), although it's true that `help.el` is one of those files that doesn't even try to pretend it obeys the prefix rule. > +(defvar help--previous-description-column) Same comment here: give it a default value. > +;;; The Lisp version is 100 times slower than the C equivalent: I think you meant "This" rather then "The". > +;; (defun describe-keymap-or-char-table [...] > +;; (let* ((val (aref keymap idx)) `aref` will signal an error when applied to a keymap. So your `keymap` variable doesn't hold a keymap, and so your function name is misleading. Also this function should probably have a "help--" prefix because it should stay as an internal detail. > + enum text_quoting_style style = text_quoting_style(); > + switch (style) You need a space before "()", and I think you can dispense with the `style` variable and directly do `switch (text_quoting_style ())`. > + return get_keyelt (object, NILP(autoload) ? false : true); ^^ SPC > + Lisp_Object msg; I think you don't need/want this var here. > + { > + msg = build_unibyte_string("Key translations"); ^ ^^ Lisp_Object SPC Your compiler will be just as happy with many such "small scope" vars as with your larger scope var. Also, you might want to use `AUTO_STRING` here. > @@ -2793,8 +2815,11 @@ DEFUN ("describe-buffer-bindings", Fdescribe_buffer_bindings, Sdescribe_buffer_b BTW, I see that `describe-buffer-bindings` is a natural next candidate for ELispification ;-) > +DEFUN ("describe-keymap-or-char-table", Fdescribe_keymap_or_char_table, [...] > + CHECK_VECTOR_OR_CHAR_TABLE (vector); The code says VECTOR_OR_CHAR_TABLE, so your function's name might want to do the same. Or maybe call it `describe-vector` since it seems to be a thin wrapper around that function. > @@ -3654,6 +3742,10 @@ syms_of_keymap (void) > be preferred. */); > Vwhere_is_preferred_modifier = Qnil; > where_is_preferred_modifier = 0; > + DEFVAR_LISP ("internal--seen", Vinternal_seen, > + doc: /* List of seen keymaps. > +This is used for internal purposes only. */); > + Vinternal_seen = Qnil; This doesn't belong here, since this var is not used in the C code AFAICT.