From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alex Schroeder Newsgroups: gmane.emacs.devel Subject: Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..) Date: Mon, 09 Sep 2002 23:09:13 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: <87n0qq6fba.fsf@emacswiki.org> References: <200208271621.g7RGLNm30516@rum.cs.yale.edu> <5xhehfe3aj.fsf@kfs2.cua.dk> <874rdfaytt.fsf@pot.cnuce.cnr.it> <5xvg5sh06u.fsf@kfs2.cua.dk> <20020830235528.GA13207@gnu.org> <87ofbji88u.fsf@emacswiki.org> <87sn0scb0b.fsf@emacswiki.org> <87bs7ama8g.fsf@emacswiki.org> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1031605677 17261 127.0.0.1 (9 Sep 2002 21:07:57 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 9 Sep 2002 21:07:57 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17oVlE-0004UG-00 for ; Mon, 09 Sep 2002 23:07:56 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17oWLK-0005MZ-00 for ; Mon, 09 Sep 2002 23:45:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17oVlH-00031K-00; Mon, 09 Sep 2002 17:07:59 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17oVkB-0002tx-00 for emacs-devel@gnu.org; Mon, 09 Sep 2002 17:06:51 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17oVk8-0002tk-00 for emacs-devel@gnu.org; Mon, 09 Sep 2002 17:06:50 -0400 Original-Received: from relay01.cablecom.net ([62.2.33.101]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17oVk6-0002tE-00; Mon, 09 Sep 2002 17:06:46 -0400 Original-Received: from smtp.swissonline.ch (mail-4.swissonline.ch [62.2.32.85]) by relay01.cablecom.net (8.12.5/8.12.5/SOL/AWF/MXRELAY/20020820) with ESMTP id g89L6j20017727; Mon, 9 Sep 2002 23:06:45 +0200 (CEST) (envelope-from alex@emacswiki.org) Original-Received: from confusibombus (dclient217-162-239-98.hispeed.ch [217.162.239.98]) by smtp.swissonline.ch (8.11.6/8.11.6/SMTPSOL/AWF/2002040101) with ESMTP id g89L6jF26191; Mon, 9 Sep 2002 23:06:45 +0200 (MEST) Original-Received: from alex by confusibombus with local (Exim 3.35 #1 (Debian)) id 17oVmT-00005f-00; Mon, 09 Sep 2002 23:09:13 +0200 Original-To: rms@gnu.org X-Face: ^BC$`[IcggstLPyen&dqF+b2'zyK#r.mU*'Nms}@&4zw%SJ#5!/7SMVjBS7'lb;QK)|IPU5U'o1'522W4TyzB3Ab*IBo^iw]l4|kUbdZuUDO6=Um-.4IzhNiV'B"@K#jy_(wW|Zbk[34flKY^|PrQ?$u2\fKg^]AY>wOX#H32i In-Reply-To: (Richard Stallman's message of "Sun, 08 Sep 2002 08:54:33 -0400") Original-Lines: 43 User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2.90 (i686-pc-linux-gnu) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:7766 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:7766 Richard Stallman writes: > (defmacro defkeymap (symbol map doc &rest args) > "Define SYMBOL to be a keymap with value MAP. > DOC is the keymap documentation." > ;; It is better not to use backquote in this file, > ;; because that makes a bootstrapping problem > ;; if you need to recompile all the Lisp files using interpreted code. > (nconc (list 'custom-declare-keymap > (list 'quote symbol) > (list 'quote map) > doc) > args)) > > It would be better to generate a defvar plus whatever other stuff > you need. Why? The current custom code also has a macro deffoo that expands into a call to custom-declare-foo. > ;; remove all keys no longer in bindings > (mapc (lambda (bind) > (unless (assoc (car bind) bindings) > (custom-remove-key sym (read-kbd-macro (car bind))))) > old-bindings) > > I think that comment doesn't match the code. The code removes all the > bindings in the previous list of customizations. I do not understand. The code takes all entries in the alist OLD-BINDINGS, and for each entry BIND, it checks wether the key (the car of BIND) is already a member of the alist BINDINGS. Only if it is not, does the code do anything. To me that translates: "remove all keys from the map which are in old-bindings and not in bindings", and the general idea is to undefine (call define-key with a DEF of nil) all bindings that used to be in bindings (now called old-bindings) and are no longer there. Anyway, since the comment confuses, I will remove it altogether. :) Since I moved some of the code into custom-remove-key, it is much easier on the eyes, anyway. Alex.