From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: 29.0.60; keymap-local-set and keymap-global-set became less strict Date: Tue, 31 Jan 2023 09:30:04 -0500 Message-ID: References: <5876987d-2479-f512-5767-218c8c16a909@daniel-mendler.de> <875ycngyji.fsf@gnus.org> <87zg9zvzuc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37955"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Lars Ingebrigtsen , Daniel Mendler , emacs-devel@gnu.org, Eli Zaretskii To: Robert Pluim Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jan 31 16:01:40 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pMs8i-0009hs-AZ for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Jan 2023 16:01:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pMreL-0004V8-J2; Tue, 31 Jan 2023 09:30:17 -0500 Original-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 1pMreJ-0004Ux-Qp for emacs-devel@gnu.org; Tue, 31 Jan 2023 09:30:15 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMreI-0000SE-Bq; Tue, 31 Jan 2023 09:30:15 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 55FC61000CC; Tue, 31 Jan 2023 09:30:11 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 1643010000D; Tue, 31 Jan 2023 09:30:09 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1675175409; bh=O6JwlGz00iC/ZnfqGVUoSEqKUJDBJVFLoOqbuSzQxt0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=lALhLstbdUjt2cKddGrPlMEc6lOcSKcqYntLNu2X+cqeDmltbWP7BkuvGjT6rM/UG MMQ9NDLcPWGmqp+fj3ggDO5SiRX1Dn/6lL8aHHV+h/E/q3P2uynx4uIAUcUoeFltS3 sIeOVmwXzOoYiK+P1INE5riox8JhOgcH62dvmwV6kBAzNO1fJKpWJxuKJ/0lVBhIPs uFJIfVdeSkYEhB7BMIo//PT37yJf1JfOSPKlvfKtcByh63kmHkarWOI3/jRVKKHGzL WyKMmLSdj7n4L9dVK4lXGqwSvEtm1hsm+ok4mv80ikuPwbeAPXOZ9XwHVqYZ2996y0 VxPyf5mfmHCIg== Original-Received: from pastel (unknown [45.72.238.67]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id DA7BF120D21; Tue, 31 Jan 2023 09:30:08 -0500 (EST) In-Reply-To: <87zg9zvzuc.fsf@gmail.com> (Robert Pluim's message of "Tue, 31 Jan 2023 10:05:15 +0100") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:302832 Archived-At: > --- i/lisp/keymap.el > +++ w/lisp/keymap.el > @@ -76,9 +76,14 @@ keymap-global-set > that local binding will continue to shadow any global binding > that you make with this function." > (declare (compiler-macro (lambda (form) (keymap--compile-check key) form))) > - (interactive "KSet key globally:\nCSet key %s globally to command: ") > - (unless (stringp key) > - (setq key (key-description key))) > + (interactive > + (let* ((menu-prompting nil) > + (cursor-in-echo-area t) > + (key (key-description (read-key-sequence-vector "Set key globally:" nil t)))) > + (list key > + (let ((cursor-in-echo-area nil)) > + (read-command (format "Set key %s to command: " > + key)))))) > (keymap-set (current-global-map) key command)) > > (defun keymap-local-set (key command) > @@ -91,12 +96,17 @@ keymap-local-set > The binding goes in the current buffer's local map, which in most > cases is shared with all other buffers in the same major mode." > (declare (compiler-macro (lambda (form) (keymap--compile-check key) form))) > - (interactive "KSet key locally:\nCSet key %s locally to command: ") > + (interactive > + (let* ((menu-prompting nil) > + (cursor-in-echo-area t) > + (key (key-description (read-key-sequence-vector "Set key locally:" nil t)))) > + (list key > + (let ((cursor-in-echo-area nil)) > + (read-command (format "Set key %s to command: " > + key)))))) Please put that code in a separate function so as to avoid this duplication. Stefan