From unknown Fri Jun 20 18:17:56 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#62207 <62207@debbugs.gnu.org> To: bug#62207 <62207@debbugs.gnu.org> Subject: Status: 29.0.60; Trying to remove non-existent key binding instead adds a binding Reply-To: bug#62207 <62207@debbugs.gnu.org> Date: Sat, 21 Jun 2025 01:17:56 +0000 retitle 62207 29.0.60; Trying to remove non-existent key binding instead ad= ds a binding reassign 62207 emacs submitter 62207 Jonas Bernoulli severity 62207 normal tag 62207 fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 15 12:07:56 2023 Received: (at submit) by debbugs.gnu.org; 15 Mar 2023 16:07:56 +0000 Received: from localhost ([127.0.0.1]:40415 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcTfQ-0000yj-1L for submit@debbugs.gnu.org; Wed, 15 Mar 2023 12:07:56 -0400 Received: from lists.gnu.org ([209.51.188.17]:59514) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcTfO-0000yb-A3 for submit@debbugs.gnu.org; Wed, 15 Mar 2023 12:07:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcTfO-0007T1-4O for bug-gnu-emacs@gnu.org; Wed, 15 Mar 2023 12:07:54 -0400 Received: from mail.hostpark.net ([212.243.197.30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcTfM-0001BC-5r for bug-gnu-emacs@gnu.org; Wed, 15 Mar 2023 12:07:53 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 2FD37164CC for ; Wed, 15 Mar 2023 17:07:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :subject:subject:from:from:received:received; s=sel2011a; t= 1678896463; bh=ApGY4ttqmljsDAgKdM+PlGh7nAFEncQSUGeLqE8rOf0=; b=k 8ppQRPspjUQ7RfFItJVX4JWK+mL/JdeAO1LIyJwMwB2rZklEO1SMimm92wbqHbs0 ONDhPUDPYJAQaRSZnZuSnPjBpSIGwF1GPJWy7+YBvjUV3WDueY4suPubDoWVS9Ti g9fsMUP1g5rBkRlEvmnLlHByz40h5OqqgnsUzce2tg= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id QYeiUcM1Uatv for ; Wed, 15 Mar 2023 17:07:43 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id E058D164B7 for ; Wed, 15 Mar 2023 17:07:43 +0100 (CET) From: Jonas Bernoulli To: bug-gnu-emacs@gnu.org Subject: 29.0.60; Trying to remove non-existent key binding instead adds a binding Date: Wed, 15 Mar 2023 17:07:42 +0100 Message-ID: <875yb2gfqp.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: none client-ip=212.243.197.30; envelope-from=jonas@bernoul.li; helo=mail.hostpark.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) (keymap-unset map key t) is supposed to remove a binding completely, and that works if there actually is a binding: (let ((map (make-sparse-keymap))) (keymap-set map "i" 'bound) (keymap-unset map "i" t) map) => (keymap) However if you try to remove a binding that does not actually exist, then the opposite happens, a "nil binding" is *added*: (let ((map (make-sparse-keymap))) (keymap-unset map "i" t) map) => (keymap (105)) From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 15 12:51:37 2023 Received: (at submit) by debbugs.gnu.org; 15 Mar 2023 16:51:38 +0000 Received: from localhost ([127.0.0.1]:40458 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcULh-0002yu-JK for submit@debbugs.gnu.org; Wed, 15 Mar 2023 12:51:37 -0400 Received: from lists.gnu.org ([209.51.188.17]:55118) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcULg-0002yl-GS for submit@debbugs.gnu.org; Wed, 15 Mar 2023 12:51:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcULg-0004V5-6t for bug-gnu-emacs@gnu.org; Wed, 15 Mar 2023 12:51:36 -0400 Received: from mail.hostpark.net ([212.243.197.30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcULe-0000hm-5M for bug-gnu-emacs@gnu.org; Wed, 15 Mar 2023 12:51:35 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 03F1116408 for ; Wed, 15 Mar 2023 17:51:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1678899089; bh=F0v079KatpJWeQ3RgAcd1EUI r4cfLMKGunX6s0gJPSU=; b=cuROmPHAhOVL/dsi+BtNzz3QOF9ql1vKwoxJnqL9 B0E5rhbcMH10OuH2CWMf+JRnYSNYyBZzRBjP4TbQxeYhNzILpXJvraqD1EqMfq7g FizqveLyyZg+V8x2hOcjva2fIlsox+ahFGjkvEPmjKg/wyFm3hY6Vn1ln3ia78TS B88= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id WFDOogFHS5zd for ; Wed, 15 Mar 2023 17:51:29 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id A8408164A8 for ; Wed, 15 Mar 2023 17:51:29 +0100 (CET) From: Jonas Bernoulli To: bug-gnu-emacs@gnu.org Subject: Re: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <875yb2gfqp.fsf@bernoul.li> References: <875yb2gfqp.fsf@bernoul.li> Date: Wed, 15 Mar 2023 17:51:27 +0100 Message-ID: <87v8j2hsa8.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: none client-ip=212.243.197.30; envelope-from=jonas@bernoul.li; helo=mail.hostpark.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) As a side-note, it would be nice if it were possible to lookup a key in a keymap only, while ignoring bindings in its parent keymap. I was reminded of this because I had to resurrect some old code of mine to work around this bug. The workaround is: (defun my--keymap-unset (keymap key &optional remove) (if remove (when (kmu-lookup-local-key keymap key nil t) (keymap-unset keymap key t)) (keymap-unset keymap key))) And below is the code I had to resurrect in order to make that happen. If `lookup-key', and similar, took a NOPARENT argument, all of that could be avoided. (defun kmu-lookup-local-key ( keymap key &optional accept-default no-remap position) "In KEYMAP, look up key sequence KEY. Return the definition. Unlike `keymap-lookup' (which see) this doesn't consider bindings made in KEYMAP's parent keymap." (keymap-lookup (kmu--strip-keymap keymap) key accept-default no-remap position)) (defun kmu--strip-keymap (keymap) "Return a copy of KEYMAP with all parent keymaps removed. This not only removes the parent keymap of KEYMAP but also recursively the parent keymap of any keymap a key in KEYMAP is bound to." (cl-labels ((strip-keymap (keymap) (set-keymap-parent keymap nil) (cl-loop for _key being the key-code of keymap using (key-binding binding) do (and (keymapp binding) (not (kmu-prefix-command-p binding)) (strip-keymap binding))) keymap)) (strip-keymap (copy-keymap keymap)))) (defun kmu-prefix-command-p (object) "Return non-nil if OBJECT is a symbol whose function definition is a keymap. The value returned is the keymap stored as OBJECT's variable definition or else the variable which holds the keymap." (and (symbolp object) (fboundp object) (keymapp (symbol-function object)) (if (and (boundp object) (keymapp (symbol-value object))) (symbol-value object) (kmu-keymap-variable (symbol-function object))))) (defun kmu-keymap-variable-p (object) "Return t if OBJECT is a symbol whose variable definition is a keymap." (and (symbolp object) (boundp object) (keymapp (symbol-value object)))) From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 15 13:13:33 2023 Received: (at 62207) by debbugs.gnu.org; 15 Mar 2023 17:13:33 +0000 Received: from localhost ([127.0.0.1]:40465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcUgu-0003ai-MD for submit@debbugs.gnu.org; Wed, 15 Mar 2023 13:13:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53242) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcUgs-0003aM-Qq for 62207@debbugs.gnu.org; Wed, 15 Mar 2023 13:13:31 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcUgm-0003y4-Mk; Wed, 15 Mar 2023 13:13:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=jsJIHNMbZZs6kMqvRdH1nH6GiZExEkgdeV3fL1CQc+I=; b=I7RDwD1GNprP xXi0XwoZi31/VIbJob5ipj32VfWqyt0ZPbQZiLB6tGrUFTF7wbPfzwttgl3kU+H/N5BBiDyFhgcQr sUGOxxVqxwKO0mXH4rsYUq7UUuJQ0rGGDwS+MMyZs0CKQ30pbzc65h6I5mYPnRV7RwT1XbhoGaVRY mYAAzP/6bW9G6HgeJXZFGVeemIf3V1e77uBiEygqHT7T/3/752x+UMDyYkdmaEIOZqfKPqzC0P/ja mPwEcKxZiEyiv6WXWw7uAgOm7QsAF2vndl0dZ81vg6LwSSqwZM+A7Myy1X5gOtsI7qgKuW2Bo/bib olKP+3yb/FkNB7581DwrDg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcUgm-0007aW-2R; Wed, 15 Mar 2023 13:13:24 -0400 Date: Wed, 15 Mar 2023 19:13:20 +0200 Message-Id: <83pm9aq6of.fsf@gnu.org> From: Eli Zaretskii To: Jonas Bernoulli , Stefan Monnier , Lars Ingebrigtsen In-Reply-To: <875yb2gfqp.fsf@bernoul.li> (message from Jonas Bernoulli on Wed, 15 Mar 2023 17:07:42 +0100) Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding References: <875yb2gfqp.fsf@bernoul.li> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Jonas Bernoulli > Date: Wed, 15 Mar 2023 17:07:42 +0100 > > However if you try to remove a binding that does not actually exist, > then the opposite happens, a "nil binding" is *added*: > > (let ((map (make-sparse-keymap))) > (keymap-unset map "i" t) > map) > => (keymap (105)) The same happens when you call define-key with REMOVE non-nil. keymap-unset just calls define-key, and does little else. Stefan, it sounds like the part of store_in_keymap after the label keymap_end should do nothing if REMOVE is non-zero, am I right? From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 15 13:36:12 2023 Received: (at 62207) by debbugs.gnu.org; 15 Mar 2023 17:36:12 +0000 Received: from localhost ([127.0.0.1]:40497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcV2p-0004Jl-Pr for submit@debbugs.gnu.org; Wed, 15 Mar 2023 13:36:12 -0400 Received: from mail-wm1-f46.google.com ([209.85.128.46]:46612) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcV2n-0004JW-8k for 62207@debbugs.gnu.org; Wed, 15 Mar 2023 13:36:10 -0400 Received: by mail-wm1-f46.google.com with SMTP id l7-20020a05600c1d0700b003eb5e6d906bso1794086wms.5 for <62207@debbugs.gnu.org>; Wed, 15 Mar 2023 10:36:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678901763; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Q7++Me/lV1CkIzjfXSLUvNRS2p2lRyOK3/fgpizjx7k=; b=pjSnFV99wWpWVM70Sx3Z+UymkievJgrptFUanpFQFTyBIBlDWtzBuNczTOrwlh2/yh 4HKZS5hJZqp78kdCzrTlDXZqfS/OP7t4w9W8onrLDWl/4w1HSRGH2ISreZU7tvUeSC9/ RTIvDJTjQRZQ2PP2katbHTGuy82yPO777EAblEm8rlr17TB87nwsUQS7R5fH+CAFs2ul fs6F7oGbxmc4slZ/pa7beNliMRnC0n3F6WAuRmfmVA0DYlA5bmlnW3ZkAA1YpQgowYkL oPzejm6eNT2HoVWorDFMaxZbHP/ExTvdl6Zb9++zH91tE8bU48OdQczKFgh3AWI9X2uE cwbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678901763; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Q7++Me/lV1CkIzjfXSLUvNRS2p2lRyOK3/fgpizjx7k=; b=KygJw4nW9ggfirhRj4sInhlr3surdHDk6tJWAe79Pi1LqAtIifyt3fhKdruULDhQKy cvSAyqwFcdxdT0Ct8KD1LSZhlkQwgWM3P2bTikXKxV32gK/Hi0Riy831Y46xfRhmmZzG /GmVX0nsV5JkEGpyxqXYsrLROdplsqNXySYLNQQtUBJuQE8SkpU3KjSfSgH5lIRajEqt iwPO+1tv2enqq1hqjmhfmPEzF4BkvRFZL2RtsU0wRkGDIZEwBJEvjQk0L+wquzekGkNx Jp41f+u1MYjhmpOPCOk78V2srTPfZk2io14aIlXpAcn+bLC3qt5+ku7zogSeueEdreYY UEog== X-Gm-Message-State: AO0yUKVsx5qfoVKaIizUbTSjVk2fT9fAirkNR0/pB+t+Yr/tCbums+m6 puG3y7phyunHoylLNmxfDGmAh028d1o= X-Google-Smtp-Source: AK7set8xZVwgrY3mb4xBqTpbksJHObrCVZdHEPHo4DgZZKU1YgQZEyFuMAXwEqGffbniR6VxPbjg3A== X-Received: by 2002:a05:600c:190a:b0:3e0:6c4:6a38 with SMTP id j10-20020a05600c190a00b003e006c46a38mr18248177wmq.33.1678901762668; Wed, 15 Mar 2023 10:36:02 -0700 (PDT) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id p15-20020a7bcdef000000b003dc4480df80sm2413884wmj.34.2023.03.15.10.36.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 10:36:02 -0700 (PDT) From: Robert Pluim To: Jonas Bernoulli Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <87v8j2hsa8.fsf@bernoul.li> (Jonas Bernoulli's message of "Wed, 15 Mar 2023 17:51:27 +0100") References: <875yb2gfqp.fsf@bernoul.li> <87v8j2hsa8.fsf@bernoul.li> Date: Wed, 15 Mar 2023 18:36:01 +0100 Message-ID: <871qlpvrwe.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Wed, 15 Mar 2023 17:51:27 +0100, Jonas Bernoulli said: Jonas> As a side-note, it would be nice if it were possible to lookup a Jonas> key in a keymap only, while ignoring bindings in its parent keymap. A feature request and a bug report? Tsk ;-) Luckily the infrastructure is actually there already. The following passes my admittedly quick testing for both. diff --git c/lisp/keymap.el i/lisp/keymap.el index 4f02639ffe2..706da70d360 100644 --- c/lisp/keymap.el +++ i/lisp/keymap.el @@ -370,7 +370,7 @@ key-translate (make-char-table 'keyboard-translate-table nil))) (aset keyboard-translate-table (key-parse from) (key-parse to))) -(defun keymap-lookup (keymap key &optional accept-default no-remap position) +(defun keymap-lookup (keymap key &optional accept-default no-remap position noparent) "Return the binding for command KEY in KEYMAP. KEY is a string that satisfies `key-valid-p'. @@ -406,8 +406,10 @@ keymap-lookup (keymap--check key) (when (and keymap position) (error "Can't pass in both keymap and position")) + (when (and (not keymap) noparent) + (error "Must specify keymap when noparent is t")) (if keymap - (let ((value (lookup-key keymap (key-parse key) accept-default))) + (let ((value (lookup-key keymap (key-parse key) accept-default noparent))) (if (and (not no-remap) (symbolp value)) (or (command-remapping value) value) diff --git c/src/keymap.c i/src/keymap.c index 23453eaa9a6..a660a687994 100644 --- c/src/keymap.c +++ i/src/keymap.c @@ -887,22 +887,23 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object idx, keymap_end: /* We have scanned the entire keymap, and not found a binding for IDX. Let's add one. */ - { - Lisp_Object elt; + if (!remove) + { + Lisp_Object elt; - if (CONSP (idx) && CHARACTERP (XCAR (idx))) - { - /* IDX specifies a range of characters, and not all of them - were handled yet, which means this keymap doesn't have a - char-table. So, we insert a char-table now. */ - elt = Fmake_char_table (Qkeymap, Qnil); - Fset_char_table_range (elt, idx, NILP (def) ? Qt : def); - } - else - elt = Fcons (idx, def); - CHECK_IMPURE (insertion_point, XCONS (insertion_point)); - XSETCDR (insertion_point, Fcons (elt, XCDR (insertion_point))); - } + if (CONSP (idx) && CHARACTERP (XCAR (idx))) + { + /* IDX specifies a range of characters, and not all of them + were handled yet, which means this keymap doesn't have a + char-table. So, we insert a char-table now. */ + elt = Fmake_char_table (Qkeymap, Qnil); + Fset_char_table_range (elt, idx, NILP (def) ? Qt : def); + } + else + elt = Fcons (idx, def); + CHECK_IMPURE (insertion_point, XCONS (insertion_point)); + XSETCDR (insertion_point, Fcons (elt, XCDR (insertion_point))); + } } return def; @@ -1240,14 +1241,15 @@ DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 3, 0, if (NILP (keymaps)) command = Fkey_binding (command_remapping_vector, Qnil, Qt, position); else - command = Flookup_key (keymaps, command_remapping_vector, Qnil); + command = Flookup_key (keymaps, command_remapping_vector, Qnil, Qnil); return FIXNUMP (command) ? Qnil : command; } static Lisp_Object -lookup_key_1 (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default) +lookup_key_1 (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default, Lisp_Object noparent) { bool t_ok = !NILP (accept_default); + bool noinherit = !NILP (noparent); if (!CONSP (keymap) && !NILP (keymap)) keymap = get_keymap (keymap, true, true); @@ -1275,7 +1277,7 @@ lookup_key_1 (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default) if (!FIXNUMP (c) && !SYMBOLP (c) && !CONSP (c) && !STRINGP (c)) message_with_string ("Key sequence contains invalid event %s", c, 1); - Lisp_Object cmd = access_keymap (keymap, c, t_ok, 0, 1); + Lisp_Object cmd = access_keymap (keymap, c, t_ok, noinherit, 1); if (idx == length) return cmd; @@ -1290,7 +1292,7 @@ lookup_key_1 (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default) /* Value is number if KEY is too long; nil if valid but has no definition. */ /* GC is possible in this function. */ -DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 3, 0, +DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 4, 0, doc: /* Look up key sequence KEY in KEYMAP. Return the definition. This is a legacy function; see `keymap-lookup' for the recommended function to use instead. @@ -1310,9 +1312,9 @@ DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 3, 0, usable as a general function for probing keymaps. However, if the third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will recognize the default bindings, just as `read-key-sequence' does. */) - (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default) + (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default, Lisp_Object noparent) { - Lisp_Object found = lookup_key_1 (keymap, key, accept_default); + Lisp_Object found = lookup_key_1 (keymap, key, accept_default, noparent); if (!NILP (found) && !NUMBERP (found)) return found; @@ -1390,7 +1392,7 @@ DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 3, 0, } /* Check for match. */ - found = lookup_key_1 (keymap, new_key, accept_default); + found = lookup_key_1 (keymap, new_key, accept_default, noparent); if (!NILP (found) && !NUMBERP (found)) break; @@ -1432,7 +1434,7 @@ DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 3, 0, } /* Check for match. */ - found = lookup_key_1 (keymap, new_key, accept_default); + found = lookup_key_1 (keymap, new_key, accept_default, noparent); if (!NILP (found) && !NUMBERP (found)) break; } @@ -1823,7 +1825,7 @@ DEFUN ("key-binding", Fkey_binding, Skey_binding, 1, 4, 0, } Lisp_Object value = Flookup_key (Fcurrent_active_maps (Qt, position), - key, accept_default); + key, accept_default, Qnil); if (NILP (value) || FIXNUMP (value)) return Qnil; @@ -1864,7 +1866,7 @@ DEFUN ("minor-mode-key-binding", Fminor_mode_key_binding, Sminor_mode_key_bindin int j; for (int i = j = 0; i < nmaps; i++) if (!NILP (maps[i]) - && !NILP (binding = Flookup_key (maps[i], key, accept_default)) + && !NILP (binding = Flookup_key (maps[i], key, accept_default, Qnil)) && !FIXNUMP (binding)) { if (KEYMAPP (binding)) @@ -2013,7 +2015,7 @@ DEFUN ("accessible-keymaps", Faccessible_keymaps, Saccessible_keymaps, { /* If a prefix was specified, start with the keymap (if any) for that prefix, so we don't waste time considering other prefixes. */ - Lisp_Object tem = Flookup_key (keymap, prefix, Qt); + Lisp_Object tem = Flookup_key (keymap, prefix, Qt, Qnil); /* Flookup_key may give us nil, or a number, if the prefix is not defined in this particular map. It might even give us a list that isn't a keymap. */ @@ -2453,7 +2455,7 @@ preferred_sequence_p (Lisp_Object seq) shadow_lookup (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default, bool remap) { - Lisp_Object value = Flookup_key (keymap, key, accept_default); + Lisp_Object value = Flookup_key (keymap, key, accept_default, Qnil); if (FIXNATP (value)) /* `key' is too long! */ return Qnil; @@ -3237,7 +3239,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args, one in the same keymap. */ if (!NILP (entire_map)) { - Lisp_Object tem = Flookup_key (entire_map, kludge, Qt); + Lisp_Object tem = Flookup_key (entire_map, kludge, Qt, Qnil); if (!EQ (tem, definition)) continue; From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 15 13:39:53 2023 Received: (at 62207) by debbugs.gnu.org; 15 Mar 2023 17:39:53 +0000 Received: from localhost ([127.0.0.1]:40501 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcV6O-0004Ok-OQ for submit@debbugs.gnu.org; Wed, 15 Mar 2023 13:39:52 -0400 Received: from mail-wr1-f54.google.com ([209.85.221.54]:40683) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcV6N-0004OV-RO for 62207@debbugs.gnu.org; Wed, 15 Mar 2023 13:39:52 -0400 Received: by mail-wr1-f54.google.com with SMTP id t15so18047317wrz.7 for <62207@debbugs.gnu.org>; Wed, 15 Mar 2023 10:39:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678901984; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=JagR5DcKldTFND4qwEMfB/oi2xGIyjQ3S8fW4DJfQwo=; b=UQVKsBnN3ycHrKOFa5rOOhthrK9Ev0+c7E5h+kUCPM32k4ZGSX9a+eDGvp9Sbp9vUX bnfZ7IJrQIGW2FC495Jqw6Krs9i/JZWE3E2BDikljG9txesJwZb7ExpSFo2AZlHu9FxF ky+sR/gdx7TtOpgfgCEZrJOZE6y3AxBqk4a5xO6kxVJvoMeAQ+zKhvSxhVEpFmP3jUU9 xiekbNIM9/5kILklYDXeO2MlO1VkyPaxc2ydiHAZgCm0Ak3fF1laOe0YOh3j3glXDhYR EqU6+speWqjqhKuz4OgyoBDOaqBPSQGC471bK8+/KVOGQSFj+fKww2LgyDfthixC9KOx HSDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678901984; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JagR5DcKldTFND4qwEMfB/oi2xGIyjQ3S8fW4DJfQwo=; b=EHZCrTJOmU1tVEwaxxJX+TGMVgPT+qQh7zsv33EK9xBBjvxLOWQIg1BykFmbJxbb+w th8/Nj8ulo7r07fkemQA1jwTPuAkeHskBsCKpcE53Pd6lLkqOLcZCJPTMuPr/sfmk9Yg dOCXVfqQD8tzcecM7SkXeNkfOD358/t3D0191Lji6znbJE3Pn89mS7nXeRjdCPZr+kis uTOlekn6tngQlyhrGatklrHfuT0SkWfl5w6NPNWZ3MegZCqSyAwvJbEeT+rCY003Dzn1 d97RoLjTPcFl2CGusoCCdIYcKB+IV1emFqQ0Hj20KgcV42laAeWqh6lVR6Of5o0PiVOT 9GZw== X-Gm-Message-State: AO0yUKWbbdi1uULwJ8iJZ35yBaPGZuZhB42AN8V5cwg9qu7JxQnaNyJU 72lp0PCJmsc7ZGev7i9K8eg/m4vaDqA= X-Google-Smtp-Source: AK7set91U0mMGe4oZc4XeZkgTy0dXZabfoumKb46RKcSxrPtqgvzDA7gHCUyqkug5oHHzMFdeieGww== X-Received: by 2002:adf:f58b:0:b0:2ce:a9f9:4608 with SMTP id f11-20020adff58b000000b002cea9f94608mr2787926wro.38.1678901984241; Wed, 15 Mar 2023 10:39:44 -0700 (PDT) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id a5-20020a056000100500b002cea299a575sm5082667wrx.101.2023.03.15.10.39.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 10:39:43 -0700 (PDT) From: Robert Pluim To: Eli Zaretskii Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <83pm9aq6of.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 15 Mar 2023 19:13:20 +0200") References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> Date: Wed, 15 Mar 2023 18:39:43 +0100 Message-ID: <87sfe5ud5s.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, Lars Ingebrigtsen , Jonas Bernoulli , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Wed, 15 Mar 2023 19:13:20 +0200, Eli Zaretskii said: >> From: Jonas Bernoulli >> Date: Wed, 15 Mar 2023 17:07:42 +0100 >>=20 >> However if you try to remove a binding that does not actually exist, >> then the opposite happens, a "nil binding" is *added*: >>=20 >> (let ((map (make-sparse-keymap))) >> (keymap-unset map "i" t) >> map) >> =3D> (keymap (105)) Eli> The same happens when you call define-key with REMOVE non-nil. Eli> keymap-unset just calls define-key, and does little else. Eli> Stefan, it sounds like the part of store_in_keymap after the label Eli> keymap_end should do nothing if REMOVE is non-zero, am I right? That=CA=BCs the conclusion I came to. See the patch in my other message. Robert --=20 From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 15 14:03:09 2023 Received: (at 62207) by debbugs.gnu.org; 15 Mar 2023 18:03:10 +0000 Received: from localhost ([127.0.0.1]:40540 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcVSv-00053y-L9 for submit@debbugs.gnu.org; Wed, 15 Mar 2023 14:03:09 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62684) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcVSt-00053k-Nf for 62207@debbugs.gnu.org; Wed, 15 Mar 2023 14:03:08 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 130D21000C4; Wed, 15 Mar 2023 14:03:02 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A8FE51000BD; Wed, 15 Mar 2023 14:03:00 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1678903380; bh=HAAjspyZwOVlQYhnt+qxlZ7Hn6HbdD1XJinrQeuAIqg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=hjIJde5mMeDTEXq8HBJeCpVfILk8ym3FdndXMWUS7DMyXQ0IwAbLUtwHhQZsWJrE+ BW9e4wBY6YNAfZDwrVUzHCjyhBvMBL1cHZL55uboTDHx+TyFy2J8n0S1Hiq37O6xKe TAzIgJ9GDADDmRGYf0P12Wwe+Wc3MJhAuQNFvP+luZnIhvXk8BvMp7KGYnA7Ina/XN b+Lrg6drErobMvQehhGAefhQe6o5/1VeQU8SQ36vEdkvk+SXOnsRl/cnvVe3Rl4nG/ b/dwZdjtvYWZSeY00nFWuBYTkMMBeKEO6Wp/UyGtcC8X3uCU8EZeSM7Ms65Rz0k6zF 9oyMrlRrYLabQ== Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7060E12326D; Wed, 15 Mar 2023 14:03:00 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <83pm9aq6of.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 15 Mar 2023 19:13:20 +0200") Message-ID: References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> Date: Wed, 15 Mar 2023 14:02:59 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.014 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: Lars Ingebrigtsen , Jonas Bernoulli , 62207@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Stefan, it sounds like the part of store_in_keymap after the label > keymap_end should do nothing if REMOVE is non-zero, am I right? Sounds right, yes. This said, the semantics of REMOVE a bit murky, so I'd rather tell people not to use it. Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 15 14:20:08 2023 Received: (at 62207) by debbugs.gnu.org; 15 Mar 2023 18:20:08 +0000 Received: from localhost ([127.0.0.1]:40557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcVjL-0005Vw-UC for submit@debbugs.gnu.org; Wed, 15 Mar 2023 14:20:08 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:33932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcVjI-0005VH-PU for 62207@debbugs.gnu.org; Wed, 15 Mar 2023 14:20:05 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 1F82380937; Wed, 15 Mar 2023 14:12:56 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 743F6807AF; Wed, 15 Mar 2023 14:12:50 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1678903970; bh=iOY8p049FnoKS4UscGW01yUzxOG3e1c4bnFqpJ21QAc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Zjr8EF45KMDCoq+z6DSrSiLOwHc2nT+65JJCgPcnPfkIBGzj0sseMPS2ozoqL2DvY utDgWhvtq1Jb0RIorBJEvf01ziA/tKYolqGyNe2ttAu8Cf4/HNXaVue2TW5VSWuqPQ xA0smPMP05lRCI5abXlz6bmCryJCJf+1PDQ2y99YaGRe3P2BlVWASnSSb/xbj74Dmq daHEk6ntWEZSZJInm5xvDuwu4aC2EuZ27qFUuCxV9csZTmg9iLwNm9FjVD3iUVLpCr UXQwpCI4E14FM+g5UDd7eu/zHuM5Ghbr8cpNSvyps9rAJJeUua+z0iM1pTG/pN7AGJ Vt+2inIBgPfjA== Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 622CA120FE7; Wed, 15 Mar 2023 14:12:50 -0400 (EDT) From: Stefan Monnier To: Robert Pluim Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <871qlpvrwe.fsf@gmail.com> (Robert Pluim's message of "Wed, 15 Mar 2023 18:36:01 +0100") Message-ID: References: <875yb2gfqp.fsf@bernoul.li> <87v8j2hsa8.fsf@bernoul.li> <871qlpvrwe.fsf@gmail.com> Date: Wed, 15 Mar 2023 14:12:47 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.103 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, Jonas Bernoulli X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Jonas> As a side-note, it would be nice if it were possible to lookup a > Jonas> key in a keymap only, while ignoring bindings in its parent keymap. Could you explain why you need `keymap-unset-key` and why you need to lookup "all but the ignore the parent"? I'm curious because the meaning of these can be subtly more complex than meets the eye once you consider things like `make-compose-keymap`. > A feature request and a bug report? Tsk ;-) Luckily the infrastructure > is actually there already. Hmm... if you need to add yet-another-arg to `Flookup_key`, than I'm not sure it qualifies as "the infrastructure is actually there already." BTW, `map-keymap-internal` could be another way to attack the problem (it has other downsides, but it stops before entering the parents). Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 15 18:27:05 2023 Received: (at 62207) by debbugs.gnu.org; 15 Mar 2023 22:27:05 +0000 Received: from localhost ([127.0.0.1]:40681 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcZaL-0004Mv-9a for submit@debbugs.gnu.org; Wed, 15 Mar 2023 18:27:05 -0400 Received: from mail.hostpark.net ([212.243.197.30]:37224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcZaH-0004MT-SR for 62207@debbugs.gnu.org; Wed, 15 Mar 2023 18:27:04 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id DEB30164F8; Wed, 15 Mar 2023 23:26:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1678919218; bh=SvvACDZY7ANo6etf/kwDP5d0 dOwHK5XwS8scq0DaKWs=; b=rR4CiyTUF1Hure26OElWqocCHsEyh5ey1uXZcGYN FpkOc6OsEEKVWbsjOE4770IrhELIaiUlmcIGnEsDPWUoPCKMQT3On+MtomYqHhMq vNYvi/t5nY6xNHFOW4ygyPZQsChqA/WZybi78NP9hh70SYYSOQf/RtETCV8jZx90 l40= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id hLirC31GBoBz; Wed, 15 Mar 2023 23:26:58 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 8AA46164DF; Wed, 15 Mar 2023 23:26:58 +0100 (CET) From: Jonas Bernoulli To: Stefan Monnier , Robert Pluim Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: References: <875yb2gfqp.fsf@bernoul.li> <87v8j2hsa8.fsf@bernoul.li> <871qlpvrwe.fsf@gmail.com> Date: Wed, 15 Mar 2023 23:26:58 +0100 Message-ID: <87sfe5irbh.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Stefan Monnier writes: >> Jonas> As a side-note, it would be nice if it were possible to lookup a >> Jonas> key in a keymap only, while ignoring bindings in its parent keymap. > > Could you explain why you need `keymap-unset-key` Directional commands usually involve the keys "b", "p", "n" and "f". These keys are mnemonic but are also scattered all across the keyboard. So in my own Emacs I have chosen to use "physically-mnemonic" bindings instead: "i" "j" "k" "l" [ Maybe that was a stupid decision. But I made it very early in my readline/Emacs career. There is no way back. ] That makes it necessary to edit many keymaps. Using keymap-unser with non-nil REMOVE makes that much less painful. It's still painful but any relieve is welcome. In magit-section-mode-map, for example, I make these changes default custom "p" replaced by "i" magit-section-backward "n" replaced by "k" magit-section-forward magit-mode-map has the above keymap as parent. It also binds "i" to magit-gitignore. I could just override that binding using (keymap-set magit-mode-map "i" #'magit-section-backward) but it is much clean to (keymap-unset magit-mode-map "i" t) It is also more future-proof. Imagine the author of Magit decides that magit-section-{forward,backward}-sibling are actually more important than magit-section-{forward,backward}, and thus exchanges the respective key bindings. If I previously removed the conflicting binding in magit-mode-map, my bindings continue to be consistent; "i"/"k" continue to do the inverse of one another. But if I was forced to explicitly double down on bindings in derived keymaps, then that would be less robust. In this case I would end up with this in magit-mode-map: "i" magit-section-backward "k" magit-section-forward-sibling > lookup "all but the ignore the parent"? kmu-lookup-local-key In KEYMAP, look up key sequence KEY. Return the definition. Unlike `keymap-lookup' (which see) this doesn't consider bindings made in KEYMAP's parent keymap. A long time ago I tried to automate the process of moving directional commands to different keys. When mapping through bindings of a keymap in order to do that, it was important to ignore bindings made in the parent keymap. So I used a variant of map-keymap that did that, and it made sense to implement a variant of lookup-key along the same line. I have not used these functions in a major way since I stopped trying to automate the remapping. But they just came in handy. When using keymap-unset to remove a binding but there isn't actually a binding, then that ends up adding a binding. To work around that bug I have to first check if there is a binding. But it must be a binding in the keymap itself, not a parent keymap. > I'm curious because the meaning of these can be subtly more complex than > meets the eye once you consider things like `make-compose-keymap`. My current implementation seems to treat later keymaps in composed keymaps like parent keymaps. Maybe that makes sense, maybe a proper implementation should make a distinctions between parent keymaps and "tail" keymaps. >> A feature request and a bug report? Tsk ;-) Luckily the infrastructure >> is actually there already. I had a hunch the two might require changes in the same part of the code. ;D > Hmm... if you need to add yet-another-arg to `Flookup_key`, than I'm not > sure it qualifies as "the infrastructure is actually there already." What I care about the most is that the bug is fixed (instead of users being told to not use the REMOVE argument, as you seem to suggest elsewhere in this thread). Key lookup that ignores parent keymaps would be nice, but not nearly as important as the bugfix. > BTW, `map-keymap-internal` could be another way to attack the problem > (it has other downsides, but it stops before entering the parents). > > > Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 17 04:23:54 2023 Received: (at 62207) by debbugs.gnu.org; 17 Mar 2023 08:23:54 +0000 Received: from localhost ([127.0.0.1]:43564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd5NP-0007dR-Kw for submit@debbugs.gnu.org; Fri, 17 Mar 2023 04:23:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd5NK-0007d9-Hs for 62207@debbugs.gnu.org; Fri, 17 Mar 2023 04:23:49 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pd5NE-000060-2d; Fri, 17 Mar 2023 04:23:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=1yeRR6K/X7pz80jzxgaEbI14ER2OCrvUAgpSR2cdRoE=; b=D2Hy1AiBbBxA 67VNeEi0FDyjQA8hc833w59p5XDBixLwGUGYPWn0zHq+Oi3NKZjdmXeMJHUDY3VIK7guse2fbywAf ELkSDibUaULRPMaCAi4NavP2UpuGujswtvmWz7SpCoEtksznV1rTP7aQgfnH85RL6EXIecW3Csg8m FscugS1etRs55NKcUK6cJKsa4yf48xBzsheeOQDzPwKT+Q3xfBDQSMDjiJj/IEPZMj55UAExyfQXu CZ52L493UfRWK1JZ2YTBS1vQIxSpwsPyQnPf2CJLFQKA4Qyqj0cEfe416xP1Y7wbSqvmkdT8UDFVR 3pI2AcAjuAEyogOTHYJ3bg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pd5ND-0006tc-BF; Fri, 17 Mar 2023 04:23:39 -0400 Date: Fri, 17 Mar 2023 10:23:37 +0200 Message-Id: <83ttyjeqgm.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Wed, 15 Mar 2023 14:02:59 -0400) Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: larsi@gnus.org, jonas@bernoul.li, 62207@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: Jonas Bernoulli , Lars Ingebrigtsen , > 62207@debbugs.gnu.org > Date: Wed, 15 Mar 2023 14:02:59 -0400 > > > Stefan, it sounds like the part of store_in_keymap after the label > > keymap_end should do nothing if REMOVE is non-zero, am I right? > > Sounds right, yes. Then Robert, please install on the emacs-29 branch the part of your suggested patch which fixes the problem with REMOVE. The other part should go to master, I think. > This said, the semantics of REMOVE a bit murky, so I'd rather tell > people not to use it. Robert, could you please say something to this effect in the doc string? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 17 04:54:16 2023 Received: (at 62207) by debbugs.gnu.org; 17 Mar 2023 08:54:16 +0000 Received: from localhost ([127.0.0.1]:43643 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd5qp-00004x-Us for submit@debbugs.gnu.org; Fri, 17 Mar 2023 04:54:16 -0400 Received: from mail-wm1-f43.google.com ([209.85.128.43]:42731) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd5qn-0008WO-LT for 62207@debbugs.gnu.org; Fri, 17 Mar 2023 04:54:14 -0400 Received: by mail-wm1-f43.google.com with SMTP id o11-20020a05600c4fcb00b003eb33ea29a8so2800283wmq.1 for <62207@debbugs.gnu.org>; Fri, 17 Mar 2023 01:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679043247; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xt70AXRp04V95Nm0NGXWpC6nBv1ULf/Iy3gpwulzKZc=; b=MS/WBU9zBILAwBx3qPD7FJFB300LnlLJ1oHSvOLwHgumiAh20GtMHLFIAwFn6ggQfK ol4G0HYdunIbkjUQNaXx2odZQHXXloQ8HpC6m0rND6MJHPthFtY8uTcUjuJJd3VwLc5a ctGJmsximUI8HWTPBz3hlSJ0lzP5e3XmZxF7aQEzLG+P7MZcBrO8IH8FLUuzD0MUiQZt qfWJf+sUDZs15ZeWDDpCSDP39v8Kb+zOEi2Nb9nvJv4DCKKwVufRxaUSOxYnmb7LXv3R YVlvNL4tW4/3tNvAs31Lgd4xvZKaPrUlkm9VPadgP3Fup9TyfR27knZx+LV+TC5OPY6g O9gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679043247; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xt70AXRp04V95Nm0NGXWpC6nBv1ULf/Iy3gpwulzKZc=; b=4CyGke0N4IGFhpWefKhlqVC5EpqOrt6nV545PUsw8/R/iGrKLc9uhJcUJK64iCm9M1 6QafqC1GxlwE9NM5f3wm3ZQGuwWhbV4WX2m8SRweLGno0Vq3h8+I+eXe8YkqsR26oV17 PBXcSVQYPR00Be1VrOt9dpKR3Os3lBzYCN5AphKCaHruLTvsmg9E52WpvYXnQYgskcD6 jf1wE9OXWBKdyII0uPFGn7dCE62kMPQpkHNU9m0eJx1/vJj44ogCgrpubFImMxZ5jVST StmBtsfg7Ns0Q1OLChDPDTNjVdOT93NYJy+/xz+3atbyb4qpjQ83pspffEFYwd0v86gv oCIQ== X-Gm-Message-State: AO0yUKWoHCqEiCToQegFgKPVqdtsLd4a11SNO3Iue5a/3/NchY3AQk4n cA/KEvsfnzWgvi1fTHfjB/HMiJ/9/OY= X-Google-Smtp-Source: AK7set+XDOCtx5HuDam9nItSYkGhMaVpgE94WSu5Ebe9tyxGljGAZfpc6QQy4V7GhTcLRqk0K+S3EA== X-Received: by 2002:a05:600c:4ecf:b0:3eb:29fe:70ec with SMTP id g15-20020a05600c4ecf00b003eb29fe70ecmr26328919wmq.27.1679043246983; Fri, 17 Mar 2023 01:54:06 -0700 (PDT) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id u13-20020a7bc04d000000b003eb0d6f48f3sm7189194wmc.27.2023.03.17.01.54.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Mar 2023 01:54:06 -0700 (PDT) From: Robert Pluim To: Eli Zaretskii Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <83ttyjeqgm.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 17 Mar 2023 10:23:37 +0200") References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> Date: Fri, 17 Mar 2023 09:54:05 +0100 Message-ID: <87ilezu5aq.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, larsi@gnus.org, jonas@bernoul.li, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Fri, 17 Mar 2023 10:23:37 +0200, Eli Zaretskii said: >> From: Stefan Monnier >> Cc: Jonas Bernoulli , Lars Ingebrigtsen , >> 62207@debbugs.gnu.org >> Date: Wed, 15 Mar 2023 14:02:59 -0400 >>=20 >> > Stefan, it sounds like the part of store_in_keymap after the label >> > keymap_end should do nothing if REMOVE is non-zero, am I right? >>=20 >> Sounds right, yes. Eli> Then Robert, please install on the emacs-29 branch the part of your Eli> suggested patch which fixes the problem with REMOVE. The other pa= rt Eli> should go to master, I think. The former I can do. Stefan seemed to object to the other part. It=CA=BCs also not been tested a great deal =F0=9F=98=80 >> This said, the semantics of REMOVE a bit murky, so I'd rather tell >> people not to use it. Eli> Robert, could you please say something to this effect in the doc Eli> string? Sorry to be difficult, but why? I think the semantics are clear, although I=CA=BCd prefer it if the first line of the docstring for `keymap-unset' said Unset key sequence KEY in KEYMAP. to reduce confusion with the REMOVE argument. Robert --=20 From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 17 05:55:32 2023 Received: (at 62207) by debbugs.gnu.org; 17 Mar 2023 09:55:32 +0000 Received: from localhost ([127.0.0.1]:43713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd6o8-0001fO-GO for submit@debbugs.gnu.org; Fri, 17 Mar 2023 05:55:32 -0400 Received: from mail-wr1-f50.google.com ([209.85.221.50]:38519) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd6o6-0001fA-Qz for 62207@debbugs.gnu.org; Fri, 17 Mar 2023 05:55:31 -0400 Received: by mail-wr1-f50.google.com with SMTP id o7so3877886wrg.5 for <62207@debbugs.gnu.org>; Fri, 17 Mar 2023 02:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679046924; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=wRLsQhXwdq7b8kWEd7azbKZ+QPSyCkxYDwxQbYodBAY=; b=Asn7eavT4q+cwrZH+VjmUXoDM+SxjAdiiIiq4pkHY7EIoCFFv29sxWpDVRKIs43gPx rq31eZ3tFVM9WXrzWF2sDcydOaPgNrfsB7TVB7qxduGp/HJpmIResnlVymt5VWrAD+gW vOKkjfJlPxyOG5moQ6iLCPLQ+e/L/WAyYB3/mXc99rPL4kg0MNQYee39RoJI/eU2gjeW UfokgEtvi0wVWt/Oh5p82ERUVe8OPh32dr2xXfVTwqnc/bLuGXMRN3e4t6E6osfCF9Ke skB5zXoRIcqGaaEHVOJ9q1YtMvpaR89TdQQqLQ/F8ug/MmIG9PCvcYR168I2xhZXyFkh oN4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679046924; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wRLsQhXwdq7b8kWEd7azbKZ+QPSyCkxYDwxQbYodBAY=; b=17LOmxiUERsQKzYtrWJLjGNs1k4oerW2c4ryMnrZvl2YWLVzxnIoigqmejmrXsSKDO fu8dBimqoyzGYHk1DZ2LEEOBIjZAm1PrxblAoWTEpZMzLXdw8VX88VO9xRGB6diZIdrx eHHJuw9J8yroDntSSCL5kEWHRUa0SB3X2RBhMfTS3eDYMPk3XRnFFgc/WPPWrBahJfbi OV/ihlf1xMtSNtmFqrK+r7k0EmfXKvXouyikGCQREHWaOSMtgtU0ecWFsrVgrRbFksXh hWISoENk2gP3JRTCb61ei5mb+Q+LoIj/itK7474p/N5A5HPCsYC9NnZ4Bt8HLuwIb0ph zDwA== X-Gm-Message-State: AO0yUKUZvo/BjRPmdEarnwrqtaWNz+u6BNS+Mo2ZlDu1/nTFnXcFSFOO pKlogMCCu+M0kqFFZrl4b/M= X-Google-Smtp-Source: AK7set8kNZeZcb/4PYebI4CsHuCi+RyaUcovZH6gogdA3SiAvYZayvPqHb8CTZwVnStlJp6uZC74dg== X-Received: by 2002:a05:6000:110a:b0:2ce:a93d:41a7 with SMTP id z10-20020a056000110a00b002cea93d41a7mr6530165wrw.40.1679046924459; Fri, 17 Mar 2023 02:55:24 -0700 (PDT) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id n17-20020a5d4c51000000b002c54c9bd71fsm1525543wrt.93.2023.03.17.02.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Mar 2023 02:55:23 -0700 (PDT) From: Robert Pluim To: Eli Zaretskii Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <87ilezu5aq.fsf@gmail.com> (Robert Pluim's message of "Fri, 17 Mar 2023 09:54:05 +0100") References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> Date: Fri, 17 Mar 2023 10:55:23 +0100 Message-ID: <87edpnu2gk.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, jonas@bernoul.li, larsi@gnus.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Fri, 17 Mar 2023 09:54:05 +0100, Robert Pluim s= aid: Robert> Sorry to be difficult, but why? I think the semantics are clear, Robert> although I=CA=BCd prefer it if the first line of the docstring = for Robert> `keymap-unset' said Robert> Unset key sequence KEY in KEYMAP. Robert> to reduce confusion with the REMOVE argument. `keymap-unset' is also not documented in the lisp reference manual. How about this? @findex keymap-unset @defun keymap-unset keymap key &optional remove This function is the inverse of @code{keymap-set}, it unsets the binding for @var{key} in @var{keymap}, which is the same as setting the binding to @code{nil}. In order to instead remove the binding completely, specify @var{remove} as non-nil. This only makes a difference if @var{keymap} has a parent keymap. When unsetting a key in a child map, it will still shadow the same key in the parent keymap. Removing the binding will allow the key in the parent keymap to be used. Robert --=20 From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 17 07:32:56 2023 Received: (at 62207) by debbugs.gnu.org; 17 Mar 2023 11:32:57 +0000 Received: from localhost ([127.0.0.1]:43824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd8KO-0006k1-HD for submit@debbugs.gnu.org; Fri, 17 Mar 2023 07:32:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43166) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd8KM-0006jo-W7 for 62207@debbugs.gnu.org; Fri, 17 Mar 2023 07:32:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pd8KG-0001fJ-KI; Fri, 17 Mar 2023 07:32:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=ZRI2mMUKGvHH5ty3R4+oZFqppI5jSAc82IwWEfQLlkU=; b=mfMr/oQIhdThz89c9kCB G/3370AkXOvfM8oUIE0z/vqk386uLCEr3BznhsOljfzmpohaYIuAFFwyRbbsJXZjWXDE4T5AmirPH URWgy5N/RKd5sy5KGiLEcno/+toFW4CwaKJSpuji1LY8yXUtAwXM5cs25B77OsQsvp3OUZHSY3h3P Hdp004pD7yzPBPheL5WAkXRm9XPl+wRG/AaUBbFbW6NSt4xdJhhI8pTWtn82opCFwzr5Hfw96RPt7 20U812Ov37yozQPngLRQiVxjf02uMhvmKKkVNSIaadGrCYqJEGqIazRExpLIPLbY2Uq1UHBG5H3qr 7uknggpTO6nEIg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pd8KF-00057g-Rb; Fri, 17 Mar 2023 07:32:48 -0400 Date: Fri, 17 Mar 2023 13:32:48 +0200 Message-Id: <83pm97ehpb.fsf@gnu.org> From: Eli Zaretskii To: Robert Pluim In-Reply-To: <87ilezu5aq.fsf@gmail.com> (message from Robert Pluim on Fri, 17 Mar 2023 09:54:05 +0100) Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, larsi@gnus.org, jonas@bernoul.li, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Robert Pluim > Cc: Stefan Monnier , larsi@gnus.org, > jonas@bernoul.li, 62207@debbugs.gnu.org > Date: Fri, 17 Mar 2023 09:54:05 +0100 > > >>>>> On Fri, 17 Mar 2023 10:23:37 +0200, Eli Zaretskii said: > > >> From: Stefan Monnier > >> Cc: Jonas Bernoulli , Lars Ingebrigtsen , > >> 62207@debbugs.gnu.org > >> Date: Wed, 15 Mar 2023 14:02:59 -0400 > >> > >> > Stefan, it sounds like the part of store_in_keymap after the label > >> > keymap_end should do nothing if REMOVE is non-zero, am I right? > >> > >> Sounds right, yes. > > Eli> Then Robert, please install on the emacs-29 branch the part of your > Eli> suggested patch which fixes the problem with REMOVE. The other part > Eli> should go to master, I think. > > The former I can do. Stefan seemed to object to the other part. Itʼs > also not been tested a great deal 😀 OK, then just the emacs-29 part for now. The rest is not urgent anyway. > >> This said, the semantics of REMOVE a bit murky, so I'd rather tell > >> people not to use it. > > Eli> Robert, could you please say something to this effect in the doc > Eli> string? > > Sorry to be difficult, but why? I think the semantics are clear, > although Iʼd prefer it if the first line of the docstring for > `keymap-unset' said > > Unset key sequence KEY in KEYMAP. > > to reduce confusion with the REMOVE argument. If this part is still controversial, I'm okay with only fixing the bug itself. As for REMOVE, let's see what Stefan has to say in defense of his request, and take it from there. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 17 07:36:43 2023 Received: (at 62207) by debbugs.gnu.org; 17 Mar 2023 11:36:43 +0000 Received: from localhost ([127.0.0.1]:43834 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd8O3-0006pm-HN for submit@debbugs.gnu.org; Fri, 17 Mar 2023 07:36:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39186) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pd8Nz-0006pX-Jl for 62207@debbugs.gnu.org; Fri, 17 Mar 2023 07:36:43 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pd8Nu-00043z-1K; Fri, 17 Mar 2023 07:36:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=2pZPc+o6RxBXPe4Akbij2a3T041dJaqzukf7vODwnu0=; b=rhmVgwOoW05d tXShHuUeOG3lMS3ZFnZHiARFuFqLfjyAEqEV9MftEb1jLCHfjwook1G34hWj0W3GKn4dRU6Qn5z3Z gr2pflvMnwCmvWo42FGX666v33HYFQ5ByWTSx/QZVBrs/8hWD6X42RSnhQ7mPcK/jMSXxtdlNbNph aXbgJ0v57wmfPu1TIoiiYCpteKIo9u0EgnusQFmiICFAntqfyHrQfUsuTtoW4qFogFaP+whbSum4L UkTQkRqd3R2OELnl4Ou3IbyE4WvjW8S+n3rU5F9MZgw95weYrBHGUgO1nJ27mcZFRD40UtzYG+z0F 3fggntHghcZPZ5KJs9VVXQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pd8Nt-0005RX-E1; Fri, 17 Mar 2023 07:36:33 -0400 Date: Fri, 17 Mar 2023 13:36:34 +0200 Message-Id: <83mt4behj1.fsf@gnu.org> From: Eli Zaretskii To: Robert Pluim In-Reply-To: <87edpnu2gk.fsf@gmail.com> (message from Robert Pluim on Fri, 17 Mar 2023 10:55:23 +0100) Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> <87edpnu2gk.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, jonas@bernoul.li, larsi@gnus.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Robert Pluim > Cc: 62207@debbugs.gnu.org, larsi@gnus.org, jonas@bernoul.li, Stefan > Monnier > Date: Fri, 17 Mar 2023 10:55:23 +0100 > > `keymap-unset' is also not documented in the lisp reference > manual. How about this? > > @findex keymap-unset > @defun keymap-unset keymap key &optional remove > This function is the inverse of @code{keymap-set}, it unsets the > binding for @var{key} in @var{keymap}, which is the same as setting > the binding to @code{nil}. In order to instead remove the binding > completely, specify @var{remove} as non-nil. This only makes a > difference if @var{keymap} has a parent keymap. When unsetting a key > in a child map, it will still shadow the same key in the parent > keymap. Removing the binding will allow the key in the parent keymap > to be used. LGTM, thanks. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 17 09:20:19 2023 Received: (at 62207) by debbugs.gnu.org; 17 Mar 2023 13:20:19 +0000 Received: from localhost ([127.0.0.1]:43973 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdA0I-0003an-O9 for submit@debbugs.gnu.org; Fri, 17 Mar 2023 09:20:19 -0400 Received: from mail-wm1-f54.google.com ([209.85.128.54]:33428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdA0G-0003aU-Ao; Fri, 17 Mar 2023 09:20:16 -0400 Received: by mail-wm1-f54.google.com with SMTP id g6-20020a05600c4ec600b003ed8826253aso629160wmq.0; Fri, 17 Mar 2023 06:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679059210; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=TDimjZ+uKr3uI2au77mNq6E1b4r2JAQwMJ88/YJHQ9g=; b=aSYuSD7kddIcu8ALvzcCZUZJ9EjWmqj9TMbvKz90mjputbvz6UV3SHQzrvUx7EokDq +Bx8Wvpmzn0NDFQuAFmXetdtEv/QA4+H7e3jk82KuNu0B0MzeCELHP9EVrAsYeqkXL9W do8PvMao/M5t2aLUMRZtsoNhly5UI7IgO2Ai1qHiMq4UWKeOo0ymuMMnWOuHm+Py5Hwj 7i2TinNcY4DUFstreQvjwMDqxsXKg6Ba3dYBLi7v0nRQ4GXPTVpCbwwQXwHveNk1VoL2 MbIDOI5bQRdSAdGP7iyZPnGcdbNoMY3yiBu5k0ukgCk51rK3GeecLe4YCe+sWs2Emx+H Xvsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679059210; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TDimjZ+uKr3uI2au77mNq6E1b4r2JAQwMJ88/YJHQ9g=; b=FcGYjfS6PDI9tdv+6lGKFxDEv1M/3pKxpq9QMsioiZHa2O2NuXxLDmIQ/W8vxzkyXa mlbw6E2DpivVmtOv+IbFHga7IIYM9UdNbXW8NkiYlsOvWxKVmJYjgz8NSKMdIv9uMFEU e5Pqcgi/LkdsMegTnl69aFkRBy/2nwkJ+m82/0A3bvLEZp/SW+PNKxSNp0W5vifMaZh4 pR1ev4AC1Zj6ko1V2Gb+koNjIsoNgpFzxvUDPJTmRjB1Z5F48Y7ThzqwWveTOksRsx/R 456ALEX+8fgphLcAhMrRrB/nVHwhsmOAgoW6+1A0vxp3zUAzCxm4n+S/wgDr+yqXALo1 XT6g== X-Gm-Message-State: AO0yUKVbKu6cy2TR+CG2UbGRWrV1Dinsoo6VV8VPuA1NLvP56mgRJZmS o/MjsUfO+FNU2FKqd1BfC0NXPU4I4H8= X-Google-Smtp-Source: AK7set87zyOOMcBSLyqEl80/aZ1XUYS1RIM2vAd6jCdzamFj4dsfN2JNFDwMLbZg9gCKCfL5wCo7WA== X-Received: by 2002:a05:600c:350c:b0:3ed:4416:d2ff with SMTP id h12-20020a05600c350c00b003ed4416d2ffmr6535220wmq.28.1679059209850; Fri, 17 Mar 2023 06:20:09 -0700 (PDT) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id x8-20020a5d6508000000b002cea299a575sm1940926wru.101.2023.03.17.06.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Mar 2023 06:20:09 -0700 (PDT) From: Robert Pluim To: Eli Zaretskii Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <83pm97ehpb.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 17 Mar 2023 13:32:48 +0200") References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> <83pm97ehpb.fsf@gnu.org> Date: Fri, 17 Mar 2023 14:20:08 +0100 Message-ID: <87a60btszb.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, larsi@gnus.org, jonas@bernoul.li, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 62207 fixed close 62207 29.1 quit >>>>> On Fri, 17 Mar 2023 13:32:48 +0200, Eli Zaretskii said: >> The former I can do. Stefan seemed to object to the other part. It= =CA=BCs >> also not been tested a great deal =F0=9F=98=80 Eli> OK, then just the emacs-29 part for now. The rest is not urgent Eli> anyway. done Eli> If this part is still controversial, I'm okay with only fixing the= bug Eli> itself. As for REMOVE, let's see what Stefan has to say in defens= e of Eli> his request, and take it from there. ok Closing. Committed as bb3e0ded9eb Robert --=20 From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 17 09:20:28 2023 Received: (at 62207) by debbugs.gnu.org; 17 Mar 2023 13:20:28 +0000 Received: from localhost ([127.0.0.1]:43976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdA0S-0003bI-32 for submit@debbugs.gnu.org; Fri, 17 Mar 2023 09:20:28 -0400 Received: from mail-wm1-f54.google.com ([209.85.128.54]:33428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdA0Q-0003aU-1u for 62207@debbugs.gnu.org; Fri, 17 Mar 2023 09:20:26 -0400 Received: by mail-wm1-f54.google.com with SMTP id g6-20020a05600c4ec600b003ed8826253aso629534wmq.0 for <62207@debbugs.gnu.org>; Fri, 17 Mar 2023 06:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679059225; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=UL39gbkUGlYJeqfQQaxxjtieNMpqAh9ASMVsaXJvPZw=; b=bBunH1+NnkRrI4EVxgwfb9c5oYEDkZR0sSlu0lNg/H7xBUvBJ5EGh9xbljRiaVRJeY eMQhBMrddIhoW27Npok2g4ly9T/p6Kq/OZZHicoT9IXBjik5B8s2D0O/8jN1wB0CQERi OATJvXaGZajK9vdo43yyhiS433nusSsi9cdRZLYMZyXWmtYEkT6rKx9Wn3stXOasys8L fVMsfPvJCXnPCznC9+JDbIuDgTXrfTSyzvQQE4cnNMKW1ILlBXM6Q0+OJjJm/8hmsyf3 J9FQ/NlQ3T69A/lH8HqdjGxfbF8bCkk8C/YF25qUc0HeBQan9tcHcFk3Do6IUWVvAql9 Zmfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679059225; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UL39gbkUGlYJeqfQQaxxjtieNMpqAh9ASMVsaXJvPZw=; b=TFvukv5nuEdoP7ZlsV0hg24glkNmCSiSINt8eGY8Vkw9A6NQWvt5/q2EbhC/wTbV2N JfDhwF0PXz71ZAnMs6KA3ZasZhRUa0M7poesVoJi81BDweY4pE9CicecJIwLhXh+tdfn r0mXL4jAHtBlacYrGMxld2Be4DsFvOqiln8wHFylQEvmMTaMi3SLO/KfD0z/cLTrr6Le g1qDEEyhkGtn4vCBlMIleMoUBi/iNK50WzI/bdDdwXGLIbhFCr0/0Ap1d6aiwMYtLIMN 05pVN0o4QRLaCWptwHpjw+t8aPuHJOp9mnNPrfW45B1ZBV60wKv3/Hn/AOsS1YaX34aR 0kcA== X-Gm-Message-State: AO0yUKV2u8sZQeiFDGss+vyB+RFSOLDV6Qm2+Qf1PjC6PZj5SDteSk16 H8HBiAHrQVZS3epRE6Fohzk= X-Google-Smtp-Source: AK7set+W50FPMOplPqNta8K+dCuc5bE6Dl5AlhHLPpsgigqR/bElrcRWai3f8oBA1Pu29OPE8cL0aQ== X-Received: by 2002:a05:600c:a4c:b0:3ea:d611:e1 with SMTP id c12-20020a05600c0a4c00b003ead61100e1mr25368676wmq.21.1679059225496; Fri, 17 Mar 2023 06:20:25 -0700 (PDT) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id o9-20020a05600c4fc900b003ea57808179sm8529229wmq.38.2023.03.17.06.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Mar 2023 06:20:25 -0700 (PDT) From: Robert Pluim To: Eli Zaretskii Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <83mt4behj1.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 17 Mar 2023 13:36:34 +0200") References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> <87edpnu2gk.fsf@gmail.com> <83mt4behj1.fsf@gnu.org> Date: Fri, 17 Mar 2023 14:20:24 +0100 Message-ID: <875yaztsyv.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, jonas@bernoul.li, larsi@gnus.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Fri, 17 Mar 2023 13:36:34 +0200, Eli Zaretskii said: Eli> LGTM, thanks. Done Robert -- From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 17 16:58:32 2023 Received: (at 62207) by debbugs.gnu.org; 17 Mar 2023 20:58:32 +0000 Received: from localhost ([127.0.0.1]:45755 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdH9j-0006XH-V7 for submit@debbugs.gnu.org; Fri, 17 Mar 2023 16:58:32 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdH9h-0006Wv-N0 for 62207@debbugs.gnu.org; Fri, 17 Mar 2023 16:58:30 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 2F716442662; Fri, 17 Mar 2023 16:51:59 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id CD762442655; Fri, 17 Mar 2023 16:51:57 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1679086317; bh=OGV0cVX2j3/qHQFmuI0HBiKLxsqObMl7USYhBL++L00=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=H+kQo67/cPpPVgmJLuLWTV9PUO8N+fNIkTtkiElZI0RHZDJS6UX2ZHOa2+LEBAipo VdchSX/VUBKkObN6zkncNJoFDJqvqDOET9h5aKyRSPyAdCvKi5JStRSdjO3tc8BOZV CCgEqVVN7g8LJYq1uzMRWbdqwqBVIUc7+h6/mzZDH9j2HdpvnnEsa7+p8Uz7tAeVGv bYda1kQId1XkShjqbblQbRspmP58eMBHUrvaFysOdcTOZKCmaVCJ2mqrZqACldGRNI DPNcVqgsr8CCDI83j00wpDD1sL6j26WtTxfjpEGIZeHaU7gUnX67tyuNjBE6qh7gQh qDyS8Q//zz6AQ== Received: from pastel (unknown [216.154.34.24]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 904F41232CE; Fri, 17 Mar 2023 16:51:57 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <83pm97ehpb.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 17 Mar 2023 13:32:48 +0200") Message-ID: References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> <83pm97ehpb.fsf@gnu.org> Date: Fri, 17 Mar 2023 16:51:56 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.060 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, Robert Pluim , jonas@bernoul.li, larsi@gnus.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > If this part is still controversial, I'm okay with only fixing the bug > itself. As for REMOVE, let's see what Stefan has to say in defense of > his request, and take it from there. I can't remember off-hand all the subtleties that can show up in corner cases, but I'll simply note that the current removal code is already the result of my pointing out several not-so-corner cases that the original coder missed (even though he was not a beginner at the keymap game), and this very bug report illustrates that the code is still buggy. [ Which reminds me that we need a regression test for this. ] I think the removal code is "good enough" for uses in a user's init code, but I'd rather add some recommendation to avoid on it in ELisp packages. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 17 17:09:14 2023 Received: (at 62207) by debbugs.gnu.org; 17 Mar 2023 21:09:14 +0000 Received: from localhost ([127.0.0.1]:45777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdHK5-0006qz-U7 for submit@debbugs.gnu.org; Fri, 17 Mar 2023 17:09:14 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:21569) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdHK4-0006qk-2w for 62207@debbugs.gnu.org; Fri, 17 Mar 2023 17:09:12 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4C3341000DD; Fri, 17 Mar 2023 17:09:06 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 8711B1000C4; Fri, 17 Mar 2023 17:09:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1679087344; bh=ouvSZlFJFIW1Hkeu74ZnR+qHBR8LVMZlSVD10n9l3xs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=DnN3KeE6a1q/9iibQ0983U8csAefYxhtrBc5jL49VAVdA6U69RbBPUj26dPos48MG 4YOlEGb/+1Zu121OeqYJ5Za98yHMcMzQlrH88/wbA5zYF3ydP6b+VCQcGmeVsmkQK1 mD26FouZbjO0rbE+1z3nwrTNU6oJr5Gnl8KAHjYAgIoUCsCx6P/6IlAx4eBv52Ixob 7VnkaX4ihCEqDeS7pJ0H49BZeujIYvbEsCzWxPlJFOpgiPed7LjJpoJyea/X4I4pVo YF4fgKXPDUibtJ9j/zpDjX4gVxNVYWL6uVy6zyrtyv/rvyO1S77yEoyIlLDXHAuRIS U3VdcU3Cn5qqA== Received: from pastel (unknown [216.154.34.24]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3D6F21201E1; Fri, 17 Mar 2023 17:09:04 -0400 (EDT) From: Stefan Monnier To: Jonas Bernoulli Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <87sfe5irbh.fsf@bernoul.li> (Jonas Bernoulli's message of "Wed, 15 Mar 2023 23:26:58 +0100") Message-ID: References: <875yb2gfqp.fsf@bernoul.li> <87v8j2hsa8.fsf@bernoul.li> <871qlpvrwe.fsf@gmail.com> <87sfe5irbh.fsf@bernoul.li> Date: Fri, 17 Mar 2023 17:09:02 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.038 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: Robert Pluim , 62207@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >>> Jonas> As a side-note, it would be nice if it were possible to lookup a >>> Jonas> key in a keymap only, while ignoring bindings in its parent keymap. >> >> Could you explain why you need `keymap-unset-key` > > Directional commands usually involve the keys "b", "p", "n" and "f". > These keys are mnemonic but are also scattered all across the keyboard. > So in my own Emacs I have chosen to use "physically-mnemonic" bindings > instead: "i" > "j" "k" "l" > > [ Maybe that was a stupid decision. But I made it very early in my > readline/Emacs career. There is no way back. ] > > That makes it necessary to edit many keymaps. Using keymap-unser with > non-nil REMOVE makes that much less painful. It's still painful but any > relieve is welcome. > > In magit-section-mode-map, for example, I make these changes > > default custom > "p" replaced by "i" magit-section-backward > "n" replaced by "k" magit-section-forward [ Indeed, Emacs's keymap system doesn't support this very well. For the same reason Evil/god-mode/boon/... need a lot of package-specific tweaks to "patch things up". :-( ] > magit-mode-map has the above keymap as parent. It also binds "i" > to magit-gitignore. I could just override that binding using > > (keymap-set magit-mode-map "i" #'magit-section-backward) > > but it is much clean to > > (keymap-unset magit-mode-map "i" t) Agreed, this is a good use case, thanks. > But they just came in handy. When using keymap-unset to remove a > binding but there isn't actually a binding, then that ends up adding > a binding. This is the bug we're discussing, right? AFAIC it's a plain bug with an easy fix (provided by Robert). > To work around that bug I have to first check if there is a binding. > But it must be a binding in the keymap itself, not a parent keymap. Right, but this need is only brought about by the bug, so once the bug is fixed, this need will disappear. I hoped you had other needs for that functionality. >> I'm curious because the meaning of these can be subtly more complex than >> meets the eye once you consider things like `make-compose-keymap`. > My current implementation seems to treat later keymaps in composed > keymaps like parent keymaps. Maybe that makes sense, maybe a proper > implementation should make a distinctions between parent keymaps and > "tail" keymaps. `map-keymap-internal` stops at both a parent keymap (i.e. a keymap in the `cdr`) and a "subkeymap" (i.e. a keymap in the `car`). > What I care about the most is that the bug is fixed Agreed. > (instead of users being told to not use the REMOVE argument, as you > seem to suggest elsewhere in this thread). I'm mostly worried about people using it in ELisp packages where it's more likely to interact with many more situations. For uses in an init file I think we can make it work well enough. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 18 01:51:43 2023 Received: (at 62207) by debbugs.gnu.org; 18 Mar 2023 05:51:44 +0000 Received: from localhost ([127.0.0.1]:45996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdPTj-0006ht-Gq for submit@debbugs.gnu.org; Sat, 18 Mar 2023 01:51:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48008) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdPTi-0006hf-20 for 62207@debbugs.gnu.org; Sat, 18 Mar 2023 01:51:42 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdPTa-0003A6-CI; Sat, 18 Mar 2023 01:51:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=AGqYYEgx/4QQShdDca71J6ga0GFaIne2thbVgVnJxn0=; b=ImAjjdYsigWd VhoGomdABpZdlYf9QIU8Mm03yIwC8di7AbcTQ/yjaQe4MMNg2t/Vvq01eoZok+5iC1DThvVGtKOj/ tEiqickAN+gg/9DZ1E0VVFjxZUssg9n+yNhXV40Dyx/lR5Lm/7uWFngaQpjy+wMNuBPke2MR4J0A+ /5oIINWVRsHX8DKHD2yXD0TgWHdILQLhf0venF4XbemedqWQgvfZEeA429DRg5BcShnMVjQSmaTsP C+wUDKqnfvkbRdyn8ezIpHnhvX/jeADanscipDsRfjY5gpNGsRD5v1WVcNNQimUq+VP8z/PddS6GH mHqAZaPDJxygYkXYKZVfgQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdPTZ-0006wj-Rk; Sat, 18 Mar 2023 01:51:34 -0400 Date: Sat, 18 Mar 2023 07:51:35 +0200 Message-Id: <83h6uid2u0.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Fri, 17 Mar 2023 16:51:56 -0400) Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> <83pm97ehpb.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, rpluim@gmail.com, jonas@bernoul.li, larsi@gnus.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: Robert Pluim , larsi@gnus.org, jonas@bernoul.li, > 62207@debbugs.gnu.org > Date: Fri, 17 Mar 2023 16:51:56 -0400 > > I think the removal code is "good enough" for uses in a user's init > code, but I'd rather add some recommendation to avoid on it in > ELisp packages. If we want to recommend that, we need to come up with a rationale and a couple of alternative ways of achieving goals that commonly lead to using this option. Can you tell what to say to that effect? From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 18 05:43:36 2023 Received: (at 62207) by debbugs.gnu.org; 18 Mar 2023 09:43:36 +0000 Received: from localhost ([127.0.0.1]:46224 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdT67-0006nc-QO for submit@debbugs.gnu.org; Sat, 18 Mar 2023 05:43:36 -0400 Received: from mail-wr1-f52.google.com ([209.85.221.52]:46732) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdT65-0006nN-BJ for 62207@debbugs.gnu.org; Sat, 18 Mar 2023 05:43:34 -0400 Received: by mail-wr1-f52.google.com with SMTP id r29so6318364wra.13 for <62207@debbugs.gnu.org>; Sat, 18 Mar 2023 02:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679132607; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=O5rMkeaV5DICjvITKUDymWa/XfzL1TLvu2ZSEf2LH68=; b=PDij7yUQJd39UP63BY1H3C1muQ6bmAL3LpegZPt5JtFXl0Zh1t2K9aPrWHztro4C0Q N7OhzBx12mY+b74YE4Mc2JVKJO5h/EXLwAa8hJWZXPMm55tDvhYYgIKVx3BxcOLGvOOl 4zjcnqAGnxONkee/OtR4d1q0ObQJyAGZFWri35SnYYF6YHm6B9Yup0AJodENZmqmxjjM G6uzmaNuMnXx7RVAC1bdzDlLnFdTHYe1Sz3xZhnnZOjAmnhPIct0dlyOo8X1Vwbkf3pT t7y/Pf0EPJglHUhO1aqlWwj2Sgrq4DmksAnaGZ3bqPcLgm7TB4VrsyWgMwSnNOwrTgeJ FjmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679132607; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=O5rMkeaV5DICjvITKUDymWa/XfzL1TLvu2ZSEf2LH68=; b=tPlG+ogfTY0xDvVd4OXSkwMWerjABfR/tXI6nxJUf9AkBR3VNL9o5BB2mTgjs/diRh 3TpiN8TXD8tRpQx8WyONCRumXmXaeAQKq3V+ONbab/bOo2/9nsDrkEcZNnzYwGVcXbsB FS04ipA8uMtSqzLz/RZcmIxHa7eEkLcFwCBAQ6iaKO/7m9Uz/9qsm9pi7iH+ZiwWWHMS xgRUtGpt3NT5WuCGOEqyVdfCEuYt8CBxX1GNVQ8b2WNxZy5cagBQ5uCT5vi1ycQXy74j 57ZvJHd+N0Iio9/J41nfU5o1oWSsdf/ZJcmwr9PKKShk9Mib77o6nCPVDl+a/XJXxTsH DM7w== X-Gm-Message-State: AO0yUKUWAHeTZ+zV9YERRJMj+uUjUW+m0xSOdSNPTERRS8BrGqPHCPpr rf18J0D4Xv/LldCvkm4nNt4= X-Google-Smtp-Source: AK7set+MCvZr8AFwVr4rurhtBk+q+7Y80a3fp1k3UT7qAnpNwMljqP6xeWwjCsfOLiDtM2vDn8a4Gg== X-Received: by 2002:a5d:5508:0:b0:2cf:ef5b:49d4 with SMTP id b8-20020a5d5508000000b002cfef5b49d4mr8999235wrv.48.1679132607235; Sat, 18 Mar 2023 02:43:27 -0700 (PDT) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id v15-20020a5d590f000000b002cfec8b7f89sm3944798wrd.77.2023.03.18.02.43.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 02:43:26 -0700 (PDT) From: Robert Pluim To: Stefan Monnier Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: (Stefan Monnier via's message of "Fri, 17 Mar 2023 16:51:56 -0400") References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> <83pm97ehpb.fsf@gnu.org> Date: Sat, 18 Mar 2023 10:43:26 +0100 Message-ID: <87a60as8ch.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62207 Cc: larsi@gnus.org, Eli Zaretskii , jonas@bernoul.li, 62207@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Fri, 17 Mar 2023 16:51:56 -0400, Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" said: >> If this part is still controversial, I'm okay with only fixing the bug >> itself. As for REMOVE, let's see what Stefan has to say in defense of >> his request, and take it from there. Stefan> I can't remember off-hand all the subtleties that can show up in corner Stefan> cases, but I'll simply note that the current removal code is already the Stefan> result of my pointing out several not-so-corner cases that the original Stefan> coder missed (even though he was not a beginner at the keymap game), and Stefan> this very bug report illustrates that the code is still buggy. Stefan> [ Which reminds me that we need a regression test for this. ] Done. Let me know if there are corner cases I missed. Stefan> I think the removal code is "good enough" for uses in a user's init Stefan> code, but I'd rather add some recommendation to avoid on it in Stefan> ELisp packages. We can put that in the elisp manual, no? Robert -- From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 18 10:05:27 2023 Received: (at 62207) by debbugs.gnu.org; 18 Mar 2023 14:05:27 +0000 Received: from localhost ([127.0.0.1]:48845 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdXBX-0004tm-4p for submit@debbugs.gnu.org; Sat, 18 Mar 2023 10:05:27 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10573) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdXBV-0004tZ-1R for 62207@debbugs.gnu.org; Sat, 18 Mar 2023 10:05:25 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 8B3F6805B7; Sat, 18 Mar 2023 10:05:19 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 0DF56805DE; Sat, 18 Mar 2023 10:05:18 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1679148318; bh=FdBipDsho3TU3WGB7zDhAW1lb3VRzz8mdJ/1E9eM1qg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=pTJBX5/z1A6Y7ZgE1oa9fWZa+W8Qut321p4fYN7a0zQp7mMI1TTyUsg84NutbbBPb IJmPQgWbXvHl5GPVcBth3q3VbibYYGwcVgbA+rFiZBNM2vNeoEoID+NRtGzD6HMKnn cA2FvyqlqHqcLqDCl48mIztd2kQG79hmJECnVgc6E/u/beq6621+KwEAps43fXi5PN Pxr+SKgf0zU6VokzKSMdZORpILAaKiVXu+CkAnu+5vphdJWZha9CYpubGBKAGUv9fH cb6KQC/81MnrqDhvjmbKYK6iBPkux4SLkk+NiDRcW/UvGmz3FfOd/nPNRhirYhtARA JqZ0Z3tnUmxnw== Received: from pastel (unknown [216.154.34.24]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 725BD12325C; Sat, 18 Mar 2023 10:05:17 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <83h6uid2u0.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 18 Mar 2023 07:51:35 +0200") Message-ID: References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> <83pm97ehpb.fsf@gnu.org> <83h6uid2u0.fsf@gnu.org> Date: Sat, 18 Mar 2023 10:05:15 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.034 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, rpluim@gmail.com, jonas@bernoul.li, larsi@gnus.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> I think the removal code is "good enough" for uses in a user's init >> code, but I'd rather add some recommendation to avoid on it in >> ELisp packages. > > If we want to recommend that, we need to come up with a rationale and > a couple of alternative ways of achieving goals that commonly lead to > using this option. Can you tell what to say to that effect? I don't know of "goals that commonly lead to using this option", sorry. AFAIK it's not used commonly (after all, it's brand new in Emacs-30). Most of the requests for it I have seen were either of the "make the API complete" kind of argument, or examples like Jonas' (which are inherently tightly tied to a particular keymap and a particular binding in that map, so the chance of bumping into an odd corner case is significantly reduced). Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 18 10:07:12 2023 Received: (at 62207) by debbugs.gnu.org; 18 Mar 2023 14:07:13 +0000 Received: from localhost ([127.0.0.1]:48850 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdXDE-0004wt-I0 for submit@debbugs.gnu.org; Sat, 18 Mar 2023 10:07:12 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:12878) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdXDD-0004wf-8m for 62207@debbugs.gnu.org; Sat, 18 Mar 2023 10:07:11 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id EE2D01000DC; Sat, 18 Mar 2023 10:07:05 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 93A641000BF; Sat, 18 Mar 2023 10:07:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1679148424; bh=QwUUIHtYmtBlJLLKZncKZMgqIsLlcOI/ywqtcYmsHJ8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=BxSOUGABMznDnxVmlLAsSnIJDjEQLomWJWr64Eu7qqmfGJc8122jrVklb4pmxjbuk g6nrPxTJlho3AqDBux8zaaA4yEnVS/4hKDcS/PThbvT9VLzFjOPSG0WuZhDmOkD46Z Xq6/4iNIihAG5SlCvjkoHyPX8JHrbHxBtY0JcEIHNvaCwO/bkvreVO3YCcGn+h8Py1 6s0Dv2HZtDIcn4tWx/TtmG4KSI6oKTSr6/CkPTBYY/RGkeu3MixjbUM2KBncuDf5mp KmjA5FbZ0Sid0rwcdb9UhjL7lCP9kwdpcJLKbInrhTvWlLeyUFPMuJhglFNbBBrqa1 8pKCkqRQmCJ/g== Received: from pastel (unknown [216.154.34.24]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E7BB71232B2; Sat, 18 Mar 2023 10:07:03 -0400 (EDT) From: Stefan Monnier To: Robert Pluim Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <87a60as8ch.fsf@gmail.com> (Robert Pluim's message of "Sat, 18 Mar 2023 10:43:26 +0100") Message-ID: References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> <83pm97ehpb.fsf@gnu.org> <87a60as8ch.fsf@gmail.com> Date: Sat, 18 Mar 2023 10:07:02 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.037 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: larsi@gnus.org, Eli Zaretskii , jonas@bernoul.li, 62207@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Done. Thanks. > Let me know if there are corner cases I missed. I will if/when I can think of a new one. > Stefan> I think the removal code is "good enough" for uses in a user's init > Stefan> code, but I'd rather add some recommendation to avoid on it in > Stefan> ELisp packages. > We can put that in the elisp manual, no? No objection on my side :-) Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 20 05:09:13 2023 Received: (at 62207) by debbugs.gnu.org; 20 Mar 2023 09:09:13 +0000 Received: from localhost ([127.0.0.1]:53680 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peBVw-0005Op-R5 for submit@debbugs.gnu.org; Mon, 20 Mar 2023 05:09:13 -0400 Received: from mail-wr1-f45.google.com ([209.85.221.45]:46063) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peBVu-0005Oc-RM for 62207@debbugs.gnu.org; Mon, 20 Mar 2023 05:09:11 -0400 Received: by mail-wr1-f45.google.com with SMTP id v25so6109581wra.12 for <62207@debbugs.gnu.org>; Mon, 20 Mar 2023 02:09:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679303344; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=3rf8Mo9tZctKxjPhflF1SNt1ArM1HPEf7I9YKGkT7eI=; b=nJPM+n+iaBjb6VBK3gCXFUCIpsbBbAbsybcbUS8HufJ8S9+CthGVHVRl6i18y5QREP g7cb/zVS+DC2ffDqufxuf6iWNxttr/nYj2zA+78iZv6XTsasINlfaz9Bd8eXRTNGTsZY f0KQJJAMXfgVVw25jT1eeLwhh2rNVvOji0xM1cz5lKvE9DRuzjPL/HJZB0x/3/QHSDn8 8FvrrnIVxQQvoAgUdz7qMdisJfUO1tdHxVxsb3sgqvXBB/PL8XiJ7Msx49x87B+tMwhK 4M/UpqEXkfjQNJrETv01qCGVJipEFMOA5yXdIR8XiZCPH93o+mHqgbZWYOI4cttM2VKj kmOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679303344; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3rf8Mo9tZctKxjPhflF1SNt1ArM1HPEf7I9YKGkT7eI=; b=ho9XfC5IRxX2dyL0A4RX1KRziI+CPlpM67wcMo2+veJLlsuRlXjMNVZdFUmA/r6Ll6 KZUpHE8LfASjj90Q48CpNZmkSbuqC2DRM5wadwM3hB/qbdUpT8SoHIb2zeYCNGMO79yp mYMewDHA4wtmPbpS1vKP7hjbmuQzwxbNJRNH8k+Ec7GA4Tv1X1EmctDAVOfLxVUQqvGW lMbnmKkacZY6o2g2w72jXCrp4epZjnWOiaVbYbImgZF00p+gLlbVTgUFAOIS7yJuBcgj G2Wje8Qi814Mk2nALGcDpg/PdR+8FtsdNtO8BNSZiZs3SKkoxiR434vuECk1xkBJDkrG 3k9A== X-Gm-Message-State: AO0yUKXWaTHUQcm0rXO6/k8+tU206ATob7iCRq3JaICQv8MjtrI928Ta 3djOyFsE/7C0utz7zDL1e5P+u32L4cw= X-Google-Smtp-Source: AK7set8IyafSDSnj+5X/MXni4Dlq5sZJaFmJe2iQFq/hhVH4Ewh9DtMmz41JyPXA0RnzrUchgg55Hg== X-Received: by 2002:a5d:6289:0:b0:2ce:a8d5:4a89 with SMTP id k9-20020a5d6289000000b002cea8d54a89mr12227968wru.37.1679303344434; Mon, 20 Mar 2023 02:09:04 -0700 (PDT) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id f18-20020adff452000000b002c5d3f0f737sm8403244wrp.30.2023.03.20.02.09.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 02:09:04 -0700 (PDT) From: Robert Pluim To: Stefan Monnier Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: (Stefan Monnier via's message of "Sat, 18 Mar 2023 10:07:02 -0400") References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> <83pm97ehpb.fsf@gnu.org> <87a60as8ch.fsf@gmail.com> Date: Mon, 20 Mar 2023 10:09:03 +0100 Message-ID: <87fs9zrdqo.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, larsi@gnus.org, jonas@bernoul.li, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Sat, 18 Mar 2023 10:07:02 -0400, Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" said: >> Done. Bug> Thanks. >> Let me know if there are corner cases I missed. Bug> I will if/when I can think of a new one. Stefan> I think the removal code is "good enough" for uses in a user's init Stefan> code, but I'd rather add some recommendation to avoid on it in Stefan> ELisp packages. >> We can put that in the elisp manual, no? Bug> No objection on my side :-) Something like this? +Note: using @code{keymap-unset} with @var{remove} non-@code{nil} is +intended for users to put in their init file; Emacs packages should +avoid using it if possible, since they have complete control over +their own keymaps anyway, and they should not be altering other +packages' keymaps. + Robert -- From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 20 08:17:52 2023 Received: (at 62207) by debbugs.gnu.org; 20 Mar 2023 12:17:52 +0000 Received: from localhost ([127.0.0.1]:53877 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peESW-0006jP-3d for submit@debbugs.gnu.org; Mon, 20 Mar 2023 08:17:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35098) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peEST-0006jD-GB for 62207@debbugs.gnu.org; Mon, 20 Mar 2023 08:17:49 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peESM-0007Wt-DB; Mon, 20 Mar 2023 08:17:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=qifBtVszfSqm0qQeJUx9sFLIkE6ImUZ3kB+DPRBJekI=; b=E771yqQlvITm RYys+177dyMnFE9+/aSs0QrJG+It6gXhc9nNkI6T8nqg0SLzcxGPHhPoDBUbVjjji46V3YPC+28y9 qMla+atBdkbdXeGC1X4LGAESwxI90iDiH8rBGDGvy8OGU2IwAsPmYkBoz2Zd2hxYFDyXeuqovBqtq XzUbGa6lmc+iAKjoxkAE5JQJ1OzLesmAVWne/Hp2clka2j5kUD1Pc9nK51//R0JsCGceDSG3un5No OcNYF7G6xzhKES4uqX5/KWR+OG1HzDhSYBeELA0nDygr2XFmLxGEH6IL567KE/iHwBy7jWeQjWT4C V5RM42A81ESadXX0bV7Jmw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peESL-00067d-T5; Mon, 20 Mar 2023 08:17:42 -0400 Date: Mon, 20 Mar 2023 14:17:50 +0200 Message-Id: <83ilev8vm9.fsf@gnu.org> From: Eli Zaretskii To: Robert Pluim In-Reply-To: <87fs9zrdqo.fsf@gmail.com> (message from Robert Pluim on Mon, 20 Mar 2023 10:09:03 +0100) Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> <83pm97ehpb.fsf@gnu.org> <87a60as8ch.fsf@gmail.com> <87fs9zrdqo.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, larsi@gnus.org, jonas@bernoul.li, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Robert Pluim > Cc: larsi@gnus.org, Eli Zaretskii , jonas@bernoul.li, > 62207@debbugs.gnu.org > Date: Mon, 20 Mar 2023 10:09:03 +0100 > > +Note: using @code{keymap-unset} with @var{remove} non-@code{nil} is > +intended for users to put in their init file; Emacs packages should > +avoid using it if possible, since they have complete control over > +their own keymaps anyway, and they should not be altering other > +packages' keymaps. Fine by me, but please wait for Stefan to respond. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 20 11:03:51 2023 Received: (at 62207) by debbugs.gnu.org; 20 Mar 2023 15:03:51 +0000 Received: from localhost ([127.0.0.1]:55505 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peH39-00083e-9I for submit@debbugs.gnu.org; Mon, 20 Mar 2023 11:03:51 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:40503) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peH37-00083Q-Ra for 62207@debbugs.gnu.org; Mon, 20 Mar 2023 11:03:50 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 688DD807CB; Mon, 20 Mar 2023 11:03:44 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id D31458056A; Mon, 20 Mar 2023 11:03:42 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1679324622; bh=Ymu5myd5Ro/9ejTRNUZXDtHETR/jYvgmnx+WdRbi7BY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=jRLAxLchceT786LmBPMeSv2awLk3HKrlUynBjR29v9ZZz7My9/PlanUqHJEGUHRZC 6T+B8wRf95uA7RZZ93E0SPkBTwkhsOENmIpnmZj3LzOkNjSQk1aQTp3xo3qbHmwXjT 8K04KZsBtQvGY9J9wWR/qX6yxjuRp567Vb9wxaXV8JGzONdEa5bpFMP4iyCLm6kxSx Vk5fx9fxBlbqEuJwnfV+JOvk2KARKdtKhIGAnth1GbvxIjNvG8YPw42KaI/KtR+E3o utkXRcf+8DZtvWGTKZv/aaYVvG7PItNSbICw9ff2U0RnO97V0ZnGDAS9rTBiTItu3t EvrOBRZZ0D8tA== Received: from pastel (unknown [216.154.34.24]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A00DC120855; Mon, 20 Mar 2023 11:03:42 -0400 (EDT) From: Stefan Monnier To: Robert Pluim Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <87fs9zrdqo.fsf@gmail.com> (Robert Pluim's message of "Mon, 20 Mar 2023 10:09:03 +0100") Message-ID: References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> <83pm97ehpb.fsf@gnu.org> <87a60as8ch.fsf@gmail.com> <87fs9zrdqo.fsf@gmail.com> Date: Mon, 20 Mar 2023 11:03:37 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.028 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, larsi@gnus.org, jonas@bernoul.li, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Something like this? > > +Note: using @code{keymap-unset} with @var{remove} non-@code{nil} is > +intended for users to put in their init file; Emacs packages should > +avoid using it if possible, since they have complete control over > +their own keymaps anyway, and they should not be altering other > +packages' keymaps. Fine by me, thanks, Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 20 11:27:43 2023 Received: (at 62207) by debbugs.gnu.org; 20 Mar 2023 15:27:43 +0000 Received: from localhost ([127.0.0.1]:55529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peHQF-0000Cj-6F for submit@debbugs.gnu.org; Mon, 20 Mar 2023 11:27:43 -0400 Received: from mail-wm1-f45.google.com ([209.85.128.45]:39766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peHQD-0000CX-5j for 62207@debbugs.gnu.org; Mon, 20 Mar 2023 11:27:41 -0400 Received: by mail-wm1-f45.google.com with SMTP id i5-20020a05600c354500b003edd24054e0so2664896wmq.4 for <62207@debbugs.gnu.org>; Mon, 20 Mar 2023 08:27:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679326055; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=1Z/CRlNwgtdo2xesZVO6wYP71vhBzW8YT99vTzX1r7U=; b=prtCmCIwRBJNkay26X5LkYbr+b7923eScQESIsP2PWAIMovHkTcEaKbBuDQ7QyUsgy n3ofpLg6q1kkc4f5qpZ9EXaQBL80+5ZLrBOtRfTBti3rvUeWtk7C6D4Olk+GqbkN2k1+ eg4xndfCTY4rbYdBwA+TsUU30K2criBhryZwZ9SMDNGB0Soahrta29eot3i9jGCR717i 6FbDWHZ4kC9Zb2AHDjaatBIjeS0PRILjRw3/ghyrsLAaWrs5VQTrnjah7N85IYFtB2T0 wWG3OCfcqqQ1NtEFvYsoRVWOFg4hWtH4WGyeyF5/VAupJfIPS/EHDxdSPz00dyIIDyY4 sebg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679326055; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1Z/CRlNwgtdo2xesZVO6wYP71vhBzW8YT99vTzX1r7U=; b=KEmfi5R9Sux36TERKwyuZ4dsE7us6Z+U6a7D6hCQgfxH4YnOqyoN79JFIYYgoU3OEe mZmKP9qXJxe3OBp2RbfGFcEYvOOIm9/Wx9bMPgwixYnFPqbtBIsnucdMn+zK4mUd26v/ O7sCBkef7SLQoCb4/rNAi9gmko5qFGY3TBNnqooq/cWPvuR9uqdIjAH5eRwE+QKEIija QKtWfFtskhspRPwvIW2DqmA7omsn+2jy5E0hwjQCTihjevHob7J5ysSDW2yJ4W4VRqt5 ZxI+UI9Q4BRglqsTSNyvvkgRxImLnXllR4M28hYezeLXVRCFhlu1XSexh0u11nXkTAsF w0IA== X-Gm-Message-State: AO0yUKVK32Y13dlxCAdn5NnoPVytmFcF+HwdrhwvnukFw2T9lHVYMoKf HDY+L44KQyYV8pjwFjD1yss= X-Google-Smtp-Source: AK7set+9gjQn3MskodYQONODWBIjKh486Cd5uI36NL8pbA4+UMj5zVTvlX6rNLRL5qfYOghacY+V3A== X-Received: by 2002:a7b:cb95:0:b0:3ed:a07b:c58f with SMTP id m21-20020a7bcb95000000b003eda07bc58fmr7830935wmi.28.1679326054224; Mon, 20 Mar 2023 08:27:34 -0700 (PDT) Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id y13-20020a1c4b0d000000b003ed551b139csm10814368wma.36.2023.03.20.08.27.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 08:27:33 -0700 (PDT) From: Robert Pluim To: Stefan Monnier Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: (Stefan Monnier via's message of "Mon, 20 Mar 2023 11:03:37 -0400") References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> <83pm97ehpb.fsf@gnu.org> <87a60as8ch.fsf@gmail.com> <87fs9zrdqo.fsf@gmail.com> Date: Mon, 20 Mar 2023 16:27:32 +0100 Message-ID: <87ttyfphnf.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, jonas@bernoul.li, Eli Zaretskii , larsi@gnus.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Mon, 20 Mar 2023 11:03:37 -0400, Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" said: >> Something like this? >> >> +Note: using @code{keymap-unset} with @var{remove} non-@code{nil} is >> +intended for users to put in their init file; Emacs packages should >> +avoid using it if possible, since they have complete control over >> +their own keymaps anyway, and they should not be altering other >> +packages' keymaps. Stefan> Fine by me, thanks, Done Robert -- From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 20 14:14:07 2023 Received: (at 62207) by debbugs.gnu.org; 20 Mar 2023 18:14:07 +0000 Received: from localhost ([127.0.0.1]:56746 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peK1H-0007Ij-Ix for submit@debbugs.gnu.org; Mon, 20 Mar 2023 14:14:07 -0400 Received: from mail.hostpark.net ([212.243.197.30]:37480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peK1F-0007Ia-Sd for 62207@debbugs.gnu.org; Mon, 20 Mar 2023 14:14:06 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id B10391653D; Mon, 20 Mar 2023 19:14:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-transfer-encoding:content-type:content-type:mime-version :message-id:date:date:references:in-reply-to:subject:subject :from:from:received:received; s=sel2011a; t=1679336043; bh=OZKon sr/2zy9/88wWn7UA5eHitOuA/aUnVgQgNPAPoM=; b=VgjMV8htfN6jcQdAedWXB 4VlrgkQXIO2RYhAQOZnr7padXZYQkrvoLUeyTs6U7IlVPymUOY7KLfmXDzgPe2HG oYZwG5uObFHVNKRew+GN1aTSgz+VH+cGbL/3upY8l5J8b6pyV+sRAqTz8KJV7KRc 403D4WgrKXMS/ieRDygCVg= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id Mx9tnBeLlwPw; Mon, 20 Mar 2023 19:14:03 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 7882E1653A; Mon, 20 Mar 2023 19:14:03 +0100 (CET) From: Jonas Bernoulli To: Robert Pluim , Eli Zaretskii Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <87a60btszb.fsf@gmail.com> References: <875yb2gfqp.fsf@bernoul.li> <83pm9aq6of.fsf@gnu.org> <83ttyjeqgm.fsf@gnu.org> <87ilezu5aq.fsf@gmail.com> <83pm97ehpb.fsf@gnu.org> <87a60btszb.fsf@gmail.com> Date: Mon, 20 Mar 2023 19:14:03 +0100 Message-ID: <87pm93qoic.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62207 Cc: 62207@debbugs.gnu.org, larsi@gnus.org, monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Robert Pluim writes: > tags 62207 fixed > close 62207 29.1 > quit > >>>>>> On Fri, 17 Mar 2023 13:32:48 +0200, Eli Zaretskii sai= d: > > >> The former I can do. Stefan seemed to object to the other part. It= =CA=BCs > >> also not been tested a great deal =F0=9F=98=80 > > Eli> OK, then just the emacs-29 part for now. The rest is not urgent > Eli> anyway. > > done Thanks a lot Robert! Jonas From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 20 14:47:02 2023 Received: (at 62207) by debbugs.gnu.org; 20 Mar 2023 18:47:03 +0000 Received: from localhost ([127.0.0.1]:56814 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peKX8-00027C-HE for submit@debbugs.gnu.org; Mon, 20 Mar 2023 14:47:02 -0400 Received: from mail.hostpark.net ([212.243.197.30]:40302) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peKX6-00026m-Ge for 62207@debbugs.gnu.org; Mon, 20 Mar 2023 14:47:01 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 42673162F8; Mon, 20 Mar 2023 19:46:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from:received :received; s=sel2011a; t=1679338017; bh=TyJYpdB43w4OFyPhg0KK52Py fO54dKkDOgka80nI5Vg=; b=C1rLHPEhqaRmGLdwwEslPQILvR4a4d6wQpP5xnrJ mdVH3r4dKge3Q6NSdV4ZC5FeSlLIP4Wwrq1bcsOZtymXffbY+AMbQ2mn2JM/feXl XhuEML7h3lN50vG7K7qIiaBZAfdVedjMTCRK7SJ3YfMeVa+7FDydG4IFG6SM/yhd nVM= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id 2NoEaORV0bOf; Mon, 20 Mar 2023 19:46:57 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id E7F84162A5; Mon, 20 Mar 2023 19:46:56 +0100 (CET) From: Jonas Bernoulli To: Stefan Monnier Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: References: <875yb2gfqp.fsf@bernoul.li> <87v8j2hsa8.fsf@bernoul.li> <871qlpvrwe.fsf@gmail.com> <87sfe5irbh.fsf@bernoul.li> Date: Mon, 20 Mar 2023 19:46:56 +0100 Message-ID: <87lejrqmzj.fsf@bernoul.li> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62207 Cc: Robert Pluim , 62207@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Eli Zaretskii writes: > Then Robert, please install on the emacs-29 branch the part of your > suggested patch which fixes the problem with REMOVE. The other part > should go to master, I think. The other part hasn't landed on master yet. I agree it shouldn't go on emacs-29, but would like to see it in master. Stefan seems to have some objections, which I believe boil down to "nobody has demonstrated a real need yet, beside 'making the api complete'". I don't have an immediate need, but I am fairly sure I would make use of it eventually. I haven't bothered with improving my personal key bindings much lately, but plan to get back into the game eventually. >From the top of my head I can think of the following use-case. The which-key package displays available bindings in some sort of popup buffer, not unlike "C-h m", but more dynamic and less verbose. I would like to (eventually) create a package to display a more curated list of bindings. A minimal viable version of that, for my own personal, use would display the keys I personally reserve for "directional commands", namely [MOD]-{j,i,k,l}, along with the commands they are bound to in the current buffer/mode. When I start using a new mode, I would bring up that bindings buffer, and if it showed me that, for example, "k" was bound to sacrifice-goat, instead of some *-previous, then I would know I had to remove that binding for my own use and possibly make other adjustments. At this point it would be nice if there were some indication in what keymap the default binding, this-mode-map or parent-mode-map. The UI could even allow directly jumping to the definition of the appropriate keymap. Eventually it might even be possible to make the changes directly from the popup buffer. If that is to vague or obscure, I am fine with the ignore-bindings-in-parent feature not being installed on master just yet. But in that case we should probably open a new issue to track it. Cheers, Jonas From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 20 17:25:48 2023 Received: (at 62207) by debbugs.gnu.org; 20 Mar 2023 21:25:48 +0000 Received: from localhost ([127.0.0.1]:56914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peN0l-000684-MV for submit@debbugs.gnu.org; Mon, 20 Mar 2023 17:25:47 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:22501) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peN0j-00067o-2X for 62207@debbugs.gnu.org; Mon, 20 Mar 2023 17:25:45 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id F26AF80AD5; Mon, 20 Mar 2023 17:25:38 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 90A92800A8; Mon, 20 Mar 2023 17:25:37 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1679347537; bh=Pv8RR3zz3QRDpZ0T7jSqhhuZpwkrPwjYZNR2FlnDTY8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ayr6DsN/l9BJBc1vfygdISu+49GRh5E6Tsyh3U6iCXSbg3gIpeStF49MhQqPGPpGW 12sua7LyAlm1JBgihW/i/3j+KC/8sLHF0aL1u6BdA9xLBapvj72h3okpv2AsDrn9SF ENTSuKRSz5dR3+S9rji2a4z8q0LAo8VKT/kK/B0nOnnqoihRZDgXkB/tNKf/Bjj2Ah wTVvVP/Uul+z3RiyaMiOVFbrjLSd6dzQKKzhl3At+8qWr3wml3VbStj8GKYLLV6lf5 bRrrrTyUCR4g+GmtnkcsbmrcpjLUXZHgkG7tsWBCqbWWpRbyXmYBMRK6jEOphKTil1 RarFuSb2JaqcA== Received: from pastel (unknown [216.154.34.24]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6CF2A1232EB; Mon, 20 Mar 2023 17:25:37 -0400 (EDT) From: Stefan Monnier To: Jonas Bernoulli Subject: Re: bug#62207: 29.0.60; Trying to remove non-existent key binding instead adds a binding In-Reply-To: <87lejrqmzj.fsf@bernoul.li> (Jonas Bernoulli's message of "Mon, 20 Mar 2023 19:46:56 +0100") Message-ID: References: <875yb2gfqp.fsf@bernoul.li> <87v8j2hsa8.fsf@bernoul.li> <871qlpvrwe.fsf@gmail.com> <87sfe5irbh.fsf@bernoul.li> <87lejrqmzj.fsf@bernoul.li> Date: Mon, 20 Mar 2023 17:25:35 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.027 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62207 Cc: Robert Pluim , 62207@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > The other part hasn't landed on master yet. I agree it shouldn't go on > emacs-29, but would like to see it in master. Stefan seems to have some > objections, which I believe boil down to "nobody has demonstrated a real > need yet, beside 'making the api complete'". I can't remember exactly what "the other part" entails, but w.r.t providing an optional arg that makes lookup-key ignores parents, I don't think it would make the API complete (I can still see needs for yet more optional arguments, most importantly one that doesn't look inside `menu-item`s). So I'd prefer to have a new lower-level function which does "the minimum" but returns enough info that we can build something like `lookup-key` on top of it. I guess it would return 2 pieces of info: the binding that was found (if any, potentially annotated with whether it was a default binding or not), and the rest of the keymap. Or maybe return the binding together with the `cons` cell where that binding was found (i.e. along the lines of what `member/memq` do). > At this point it would be nice if there were some indication in what > keymap the default binding, this-mode-map or parent-mode-map. The UI > could even allow directly jumping to the definition of the appropriate > keymap. Eventually it might even be possible to make the changes > directly from the popup buffer. `C-h k` tries to identify the keymap, but indeed it doesn't distinguish between the keymap and its parent(s). Patch welcome to improve this. Stefan From unknown Fri Jun 20 18:17:56 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 18 Apr 2023 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator