[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..)
From: |
Per Abrahamsen |
Subject: |
Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..) |
Date: |
Wed, 04 Sep 2002 12:00:46 +0200 |
User-agent: |
Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.1 (sparc-sun-solaris2.8) |
Alex Schroeder <address@hidden> writes:
> Per, do you know the answer? I am too tired right now to keep at it.
I forgot to define :match for the 'key-sequence' widget. I have
included it below, together with a :validate for 'key-sequence-field'.
But first some other comments:
1. We are modifying symbols, not a keymaps. Unfortunately, keymaps
are mostly used directly, as values, rather than indirectly through
symbols. I.e.
If you do
(use-local-map my-keymap)
(setq my-keymap (make-sparse-keymap))
(define-key my-keymap [foo] 'bar)
[foo] will not be bound on the current local keymap, but on the newly
created keymap. I believe the easiest way to solve this is by
changing Emacs to allow
(use-local-map 'my-keymap)
rather than changing cus-key.el to work on keymaps instead of
variables.
2. You avoid the use of an extra keymap variable by instead storing
the receipe for creating the keymap in a symbol property, thus making
Stefan happy. However, it means all changes made from Lisp is lost
whenever it is changed from customize. I think that is a poor
trade-off, and would prefer an explicit variable for use from Lisp.
(define-widget 'key-sequence 'group
"Widget for entering key bindings."
:tag "Read key sequence"
:match 'key-sequence-match
:value ""
:value-create 'key-sequence-value-create
:value-delete 'widget-children-value-delete
:value-get 'widget-choice-value-get)
(defun key-sequence-match (widget value)
(stringp value))
(define-widget 'key-sequence-field 'string
"Field for entering key bindings."
:tag "Key sequence"
:error "Not a well-formed key sequence"
:validate 'key-sequence-field-validate
:keymap key-sequence-widget-map)
(defun key-sequence-widget-validate (widget value)
(let ((value (widget-apply widget :value-get)))
(condition-case (read-kbd-macro value)
nil
(error widget))))
- Re: [CVS] f7, f8 bound.., (continued)
- Re: [CVS] f7, f8 bound.., Richard Stallman, 2002/09/02
- Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Per Abrahamsen, 2002/09/02
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Alex Schroeder, 2002/09/02
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Per Abrahamsen, 2002/09/03
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Alex Schroeder, 2002/09/03
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Alex Schroeder, 2002/09/03
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Alex Schroeder, 2002/09/03
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..),
Per Abrahamsen <=
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Richard Stallman, 2002/09/04
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Per Abrahamsen, 2002/09/05
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Richard Stallman, 2002/09/06
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Per Abrahamsen, 2002/09/06
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Stefan Monnier, 2002/09/04
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Per Abrahamsen, 2002/09/05
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Richard Stallman, 2002/09/06
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Kim F. Storm, 2002/09/06
- Re: Customizing key bindings, Alex Schroeder, 2002/09/07
- Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..), Richard Stallman, 2002/09/05