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: The new keymap functions Date: Sun, 14 Nov 2021 10:41:58 -0500 Message-ID: References: <87mtm7h8kf.fsf@gnus.org> <87o86nbaio.fsf@gnus.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="22133"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: xenodasein@tutanota.de, Emacs Devel To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 14 16:42:49 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 1mmHeb-0005XN-1O for ged-emacs-devel@m.gmane-mx.org; Sun, 14 Nov 2021 16:42:49 +0100 Original-Received: from localhost ([::1]:52146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmHeZ-0002qm-6M for ged-emacs-devel@m.gmane-mx.org; Sun, 14 Nov 2021 10:42:47 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmHdx-0002AS-TG for emacs-devel@gnu.org; Sun, 14 Nov 2021 10:42:09 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:4536) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmHdr-0005VB-4N for emacs-devel@gnu.org; Sun, 14 Nov 2021 10:42:09 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 671D8805E4; Sun, 14 Nov 2021 10:42:01 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id DC88A805B9; Sun, 14 Nov 2021 10:41:59 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1636904519; bh=T1w4yDv9J9v5tTi9hXtKGRd/PTpjtnnmb/BmXRgHnYQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=cdWuSb6qrfyT7I2Za7YFmqnnOYXVhTbwvikezEOXdRg2dQJxH2y7r/4tZ3Sf/QK0z zcTSSqyQcyMEwO76g/yIg43K+8fFST0KkkdYxUXWL9dj8bMsXy8ktMdqUgzUWZ3xR2 cVMc+FlFptw3y7ssrG3gkX10FKO3v2rizZIigExKqIPJlsDIfEirlbo4CuyY2/mAOn tpTeFsW9o/984umoVmKGTCZScMIqyLEO8K2i48qz93+upKYM8cVEfeVBFVLwRqdezW cdmLJ3+ZxpicX38/7nEwc7lDm+0aMUa7yNpNGbu+Kl/oaEcAH8P5ZFNj5njcrP6Nx/ arAzPs6Pq2Ydg== Original-Received: from pastel (unknown [45.72.128.33]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A374D120728; Sun, 14 Nov 2021 10:41:59 -0500 (EST) In-Reply-To: <87o86nbaio.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 14 Nov 2021 05:56:31 +0100") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca 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.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:279423 Archived-At: > If you give a definition of nil, then it stores t, so you can never > actually get back the inheritance. (If it's nil, then it looks it up in > the parent map.) That's right. For chartables (and arrays), a nil entry *is* the absence of a binding (rather than an explicit binding to nil), so instead we use `t` there to mean an explicit binding to nil. > We presumably want to keep doing this for backwards compatibility, so I > guess adding a new optional parameter to `define-key' to really set it > to nil if requested is the way to go? (And the same in the sparse-map > case.) That's right: the best way to write a "remove key-binding" function is most likely to make `define-key` accept a special `:internal-remove-binding` value for the binding: for char-tables and arrays you can just make it store a nil in the table, and for cons cells, it should remove the cons-cell (which will probably require more changes to the code, tho maybe you can get away with calling `delq` to remove the cons cell rather than having to remember the previous cons-cell so your can `setcdr` it). If we could go back in time, we'd use nil for `:internal-remove-binding` and `t` for "hide parent bindings" ;-) Stefan