emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..)


From: Alex Schroeder
Subject: Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..)
Date: Mon, 09 Sep 2002 23:09:13 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2.90 (i686-pc-linux-gnu)

Richard Stallman <address@hidden> 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]