From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Sparse key maps garbage? Date: Mon, 01 Sep 2008 09:34:29 +0200 Message-ID: <48BB9B05.1000500@gmail.com> 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=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1220254854 12748 80.91.229.12 (1 Sep 2008 07:40:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Sep 2008 07:40:54 +0000 (UTC) Cc: Emacs Devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 01 09:41:48 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 1Ka42j-00075n-Af for ged-emacs-devel@m.gmane.org; Mon, 01 Sep 2008 09:41:45 +0200 Original-Received: from localhost ([127.0.0.1]:51259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ka41k-0005dG-3L for ged-emacs-devel@m.gmane.org; Mon, 01 Sep 2008 03:40:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ka3vm-0003Sc-Pg for emacs-devel@gnu.org; Mon, 01 Sep 2008 03:34:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ka3vm-0003SM-Cb for emacs-devel@gnu.org; Mon, 01 Sep 2008 03:34:34 -0400 Original-Received: from [199.232.76.173] (port=42231 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ka3vm-0003SH-1S for emacs-devel@gnu.org; Mon, 01 Sep 2008 03:34:34 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:10054) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ka3vl-0003PG-Up for emacs-devel@gnu.org; Mon, 01 Sep 2008 03:34:34 -0400 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ka3vk-0008LD-LW for emacs-devel@gnu.org; Mon, 01 Sep 2008 03:34:32 -0400 Original-Received: from c83-254-151-87.bredband.comhem.se ([83.254.151.87]:65267 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1Ka3vj-0004dS-7A; Mon, 01 Sep 2008 09:34:31 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 In-Reply-To: X-Enigmail-Version: 0.95.7 X-Antivirus: avast! (VPS 080831-0, 2008-08-31), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.151.87 X-ACL-Warn: Too high rate of unknown addresses received from you X-Scan-Result: No virus found in message 1Ka3vj-0004dS-7A. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1Ka3vj-0004dS-7A 1a081b57bd22f63211e337aebdee0018 X-detected-kernel: by mx20.gnu.org: Linux 2.6? (barebone, rare!) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:103362 Archived-At: Stefan Monnier wrote: >>>>> 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) What Xah wanted was to remove some (define-key map [remap ...] ...) bindings in an existing map. (Some map in cua-mode.) This can not be done as above since you do not know for sure where that keymap variable is used. You have to use your knowledge of the data structures for sparse keymaps. >> 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'.