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: Per Abrahamsen
Subject: Re: Customizing key bindings (was: Re: [CVS] f7, f8 bound..)
Date: Sat, 07 Sep 2002 14:11:18 +0200
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.1 (sparc-sun-solaris2.8)

Alex Schroeder <address@hidden> writes:

> Per, something about this validate stuff is not right.  

No, an extra argument.  And it wasn't called.  Here is a fix:

(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-field-validate (widget)
  (let ((value (widget-apply widget :value-get)))
    (condition-case nil
        (progn 
          (read-kbd-macro value)
          nil)
      (error widget))))

(define-widget 'key-sequence 'default
  "Widget for entering key bindings."
  :tag "Read key sequence"
  :match 'key-sequence-match
  :format "%v"
  :value ""
  :value-create 'key-sequence-value-create
  :value-delete 'widget-children-value-delete
  :value-get 'widget-choice-value-get
  :validate 'widget-children-validate
  :notify 'key-sequence-notify)





reply via email to

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