From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: 29.0.60; keymap-local-set and keymap-global-set became less strict Date: Wed, 01 Feb 2023 13:52:19 +0100 Message-ID: <87bkmdo8e4.fsf@gmail.com> References: <5876987d-2479-f512-5767-218c8c16a909@daniel-mendler.de> <875ycngyji.fsf@gnus.org> <87zg9zvzuc.fsf@gmail.com> <831qna3frm.fsf@gnu.org> <87mt5yogct.fsf@gmail.com> <83y1pi1wz4.fsf@gnu.org> <87ilgmodk4.fsf@gmail.com> <83mt5y1r5u.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7842"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, mail@daniel-mendler.de, emacs-devel@gnu.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Feb 01 13:53:06 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 1pNCbq-0001su-3A for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Feb 2023 13:53:06 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNCbC-0000VN-RT; Wed, 01 Feb 2023 07:52:26 -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 1pNCbB-0000VF-I4 for emacs-devel@gnu.org; Wed, 01 Feb 2023 07:52:25 -0500 Original-Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNCbA-0004Wq-0E; Wed, 01 Feb 2023 07:52:25 -0500 Original-Received: by mail-wr1-x42d.google.com with SMTP id a3so10515587wrt.6; Wed, 01 Feb 2023 04:52:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date :gmane-reply-to-list:references:in-reply-to:subject:cc:to:from:from :to:cc:subject:date:message-id:reply-to; bh=K6WHGtWP7DdbFdWBkyZJlos4MyqRpb4wnsfeDUOr1vo=; b=RuqQ/XKYQY5RWtvDQRPOk/Kqkku6Z8C3L40icSpLsdQgcQJPWtZvk6YDfQ0SoAHrTD H5He8t61rOd3Wc7JLdrkIceD59Jf5sbA+PWhHQGqeArQa6s5n2gN/XT2zIAUJuUnmv4n DyMqtw2+TNKJ9oehWaBmqH4XUnzhyl0zwzclVB4Zcmd9u79upNZa8DGLMkM9JTJpVklB mqblAh4LKtBuBxFqQrSdckJhVy2XaBEbHW8nu2qfrkhOplenTHZ9VQr4SorZ/Vk+N96C D49cA0S+d5wk34Dw17gYaxy034HQMAYeGQzL9bPPTswmS0ARzC5HEWXLjcK/OhF/VGnd ks4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date :gmane-reply-to-list:references:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=K6WHGtWP7DdbFdWBkyZJlos4MyqRpb4wnsfeDUOr1vo=; b=SELarRb0DxpuMJr7NlwYmrZbjJTsH0Ccgb6HdkdegkO6xSl2s+bRRg6oI/p4FpyVyP 0unQdy3HhyrOLSWhXFLcaTv512VPuQWoJRELE3PHu4Zf1dsAQZJgZ11X2GnkJVoUlF9W j07OgrlLEvdllDROmpkv5393xMRsNnP78vrQexeAVG9cTdoa72IHIfgk94wLs0jD4QVG vhOVk0971Qx3SlUw7Sv9FmV5AXQvlZAp2PvG/WV0fY+hSURRRZ3NdCJxtzcXGg9s+HVJ OeO1+DBu/pvX59O5tNnj3Z58xECKaJLZPHBYYJTgiqvru57bf8rIJt7fZ6JQ6MngQl/S 9Fmg== X-Gm-Message-State: AO0yUKU/T9YSoG8ASayfoluaISOlOohpf3FPKrcETRk06b/2bArrO8ER qSuw8xBQYpxDrp6k6KI/vWM= X-Google-Smtp-Source: AK7set9PIG2t+RHY1W82F3q6HYj2/TMVeix+v1G2H6EOTt/1mx6A/vjlwzqbbP/OXVPLL1zE7GHVGg== X-Received: by 2002:adf:e187:0:b0:2bf:c05d:60bd with SMTP id az7-20020adfe187000000b002bfc05d60bdmr6240585wrb.55.1675255941464; Wed, 01 Feb 2023 04:52:21 -0800 (PST) Original-Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id z4-20020a5d44c4000000b002bfcc9d9607sm16267850wrr.68.2023.02.01.04.52.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 04:52:20 -0800 (PST) In-Reply-To: <83mt5y1r5u.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 31 Jan 2023 20:43:09 +0200") Gmane-Reply-To-List: yes Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=rpluim@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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:302857 Archived-At: >>>>> On Tue, 31 Jan 2023 20:43:09 +0200, Eli Zaretskii said: Eli> What's wrong with the first method described in the node "Distingu= ish Eli> Interactive" in the ELisp reference? You mean like this? It=CA=BCs definitely a smaller change. diff --git i/lisp/keymap.el w/lisp/keymap.el index de90b03ba64..5897418c7ab 100644 --- i/lisp/keymap.el +++ w/lisp/keymap.el @@ -65,7 +65,7 @@ keymap-set (setq definition (key-parse definition))) (define-key keymap (key-parse key) definition)) =20 -(defun keymap-global-set (key command) +(defun keymap-global-set (key command &optional interactive) "Give KEY a global binding as COMMAND. COMMAND is the command definition to use; usually it is a symbol naming an interactively-callable function. @@ -76,12 +76,12 @@ 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) + (interactive "KSet key globally:\nCSet key %s globally to command: \np") + (when interactive (setq key (key-description key))) (keymap-set (current-global-map) key command)) =20 -(defun keymap-local-set (key command) +(defun keymap-local-set (key command &optional interactive) "Give KEY a local binding as COMMAND. COMMAND is the command definition to use; usually it is a symbol naming an interactively-callable function. @@ -91,11 +91,11 @@ 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 "KSet key locally:\nCSet key %s locally to command: \np") (let ((map (current-local-map))) (unless map (use-local-map (setq map (make-sparse-keymap)))) - (unless (stringp key) + (when interactive (setq key (key-description key))) (keymap-set map key command))) Robert --=20