From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Uberti Newsgroups: gmane.emacs.devel Subject: Re: New define-key syntax with custom keymap Date: Tue, 19 Oct 2021 16:19:51 +0200 Message-ID: References: <87k0i9dsup.fsf@gnus.org> <67e1333f-a339-2fc1-271b-40a860bf3edd@inventati.org> <87bl3ldru0.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8042"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 19 16:58:28 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcqZQ-0001wo-5J for ged-emacs-devel@m.gmane-mx.org; Tue, 19 Oct 2021 16:58:28 +0200 Original-Received: from localhost ([::1]:40108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqZO-0000uZ-NQ for ged-emacs-devel@m.gmane-mx.org; Tue, 19 Oct 2021 10:58:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpy9-0007hy-G8 for emacs-devel@gnu.org; Tue, 19 Oct 2021 10:19:57 -0400 Original-Received: from confino.investici.org ([212.103.72.250]:65425) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpy7-0007e8-80 for emacs-devel@gnu.org; Tue, 19 Oct 2021 10:19:56 -0400 Original-Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4HYbVJ00Dqz10wF; Tue, 19 Oct 2021 14:19:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inventati.org; s=stigmate; t=1634653191; bh=OhNyTr/XJS0LcXNQejUU2PTTrvaLmS/K11Km8uE5EYU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Ubw8k9pcolx8EoLNJ7nghLhZqfMwr+9BoihovBk2131JOxcJKLCmDvnkfgvgpY495 J5rDBIIoZSOiPtaU69fyk9dNNnZpqwHjuREyP41S8VxoxSb/3eoWboNSTxyRVqXEEx xA66QiQN81TW0psuMlksxXxMJqaFxa37Nnue8Q2E= Original-Received: from [212.103.72.250] (mx1.investici.org [212.103.72.250]) (Authenticated sender: manuel.uberti@inventati.org) by localhost (Postfix) with ESMTPSA id 4HYbVH6Fqhz10ss; Tue, 19 Oct 2021 14:19:51 +0000 (UTC) In-Reply-To: <87bl3ldru0.fsf@gnus.org> Content-Language: en-GB Received-SPF: pass client-ip=212.103.72.250; envelope-from=manuel.uberti@inventati.org; helo=confino.investici.org X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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, NICE_REPLY_A=-2.074, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:277377 Archived-At: On 19/10/21 16:14, Lars Ingebrigtsen wrote: > I'm not sure I understand what you mean. `define-key' only works in the > current session -- what it does isn't saved anywhere (no matter what > syntax you use for the key binding). What I mean is that I have this in my init.el: (define-key mu-keys-mode-map "\C-c\C-n" #'mu-cleanup-buffer) And I'd like to change it to this: (define-key mu-keys-mode-map ["C-c C-n"] #'mu-cleanup-buffer) But, with the first syntax every time I start/restart Emacs, C-c C-n is bound to mu-cleanup-buffer. Whereas with the second approach, on start/restart mu-cleanup-buffer is not bound to anything until I explicitly evaluate that second define-key statement above. -- Manuel Uberti www.manueluberti.eu