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: Wed, 04 Sep 2002 00:35:56 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2.90 (i686-pc-linux-gnu)

Cool.  Thanks for writing this widget stuff.  I really should look
more into this; I am sort of "there", but do not grok it enoug to
write new real widgets.  All I do is write wizards and defcustoms.  :)

I think this looks really useful.  If we merged this with the
diff-list stuff, we could write something interesting that would look
more or less like this:

(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))

(defun custom-declare-keymap (symbol map doc &rest args)
  "Like `defkeymap', but SYMBOL and MAP are evaluated as normal arguments.
MAP should be an expression to evaluate to compute the default value,
not the default value itself.  The DOC string will be expanded with
some standard instructions for customization."
  ;; Keymaps are variables.  The only difference is that we know lots
  ;; of defcustom properties already.
  (setq doc (concat (get symbol 'variable-documentation)
                    "\n
While entering the name of a key, you can either type keys yourself
just as they appear in the manual, as in C-c a.  You must use angle
brackets for function keys, as in <f7>.  You can also hit C-q and type
the key.  C-q will insert the correct string representation for you.
For longer sequences, you can also invoke the [Key sequence] button, 
and type the entire key sequence directly.

While entering the name of the command, you can use M-TAB to complete
it."))
  (apply 'custom-declare-variable symbol map doc 
         :type '(repeat (group key-sequence command))
         :get (some diff-list stuff)
         :set (some mix of diff-list and the code you wrote)))

I will see wether I can dig out the diff-list stuff from the mailing
list archives, I must have lost it somewhere along the way...

Alex.




reply via email to

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