From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Sparse key maps garbage? Date: Sun, 31 Aug 2008 23:00:20 -0400 Message-ID: References: <48B9DB4A.5010203@gmail.com> <48BA8BE1.7010006@gmail.com> <48BA9700.9080401@gmail.com> <48BAFA92.5040201@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1220238064 9972 80.91.229.12 (1 Sep 2008 03:01:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Sep 2008 03:01:04 +0000 (UTC) Cc: Emacs Devel To: "Lennart Borgman \(gmail\)" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 01 05:01:59 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KZzfb-00069U-Kj for ged-emacs-devel@m.gmane.org; Mon, 01 Sep 2008 05:01:35 +0200 Original-Received: from localhost ([127.0.0.1]:52786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KZzec-0000LC-Lk for ged-emacs-devel@m.gmane.org; Sun, 31 Aug 2008 23:00:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KZzeX-0000L7-VJ for emacs-devel@gnu.org; Sun, 31 Aug 2008 23:00:30 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KZzeW-0000Jk-3u for emacs-devel@gnu.org; Sun, 31 Aug 2008 23:00:29 -0400 Original-Received: from [199.232.76.173] (port=52309 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KZzeW-0000Ja-1F for emacs-devel@gnu.org; Sun, 31 Aug 2008 23:00:28 -0400 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]:23485 helo=ironport2-out.teksavvy.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KZzeV-0000nJ-5s for emacs-devel@gnu.org; Sun, 31 Aug 2008 23:00:27 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuYEAI/3ukhFxJrH/2dsb2JhbACBZbVFgWmBBw X-IronPort-AV: E=Sophos;i="4.32,304,1217822400"; d="scan'208";a="26179400" Original-Received: from 69-196-154-199.dsl.teksavvy.com (HELO ceviche.home) ([69.196.154.199]) by ironport2-out.teksavvy.com with ESMTP; 31 Aug 2008 23:00:21 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 0CD6AB41E9; Sun, 31 Aug 2008 23:00:20 -0400 (EDT) In-Reply-To: <48BAFA92.5040201@gmail.com> (Lennart Borgman's message of "Sun, 31 Aug 2008 22:09:54 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:103349 Archived-At: >>>> Depends how you define "un define a key". Binding it to nil is such >>>> a way. Binding it to `undefined' is another. Removing the binding from >>>> the keymap is yet another (one that does not come with a ready-to-use >>>> function for it). >> >>> I am thinking of the last case. Shouldn't there be one for this case? >>> Using exactly the same parameters as define-key (minus the binding)? >> >> What do you need it for? > I have no need for it now. Thought so. That's the reason why it doesn't exist. > It just came to my mind because Xah asked how > to undow a (define-key map [remap ...] ...) binding. The answer is: (define-key map [remap ...] nil). If you're worried that this will not quite undo it (i.e. in the case that map's parent already had a [remap ...] binding), then you need to do something like: (setq orig-map map) (setq map (make-sparse-keymap)) (set-keymap-parent map orig-map) (define-key map [remap ...] ...)) so that you can undo the binding(s) with (setq map orig-map) > You can do that of course, but having an undefine-key make the data > abstraction (is it called so?) better. `undo' is not the same as `undefine-key'. Stefan