# HG changeset patch # User Richard M. Stallman # Date 1131054376 0 # Node ID a4d43f085476a70497015589816cf2bd86f118ef # Parent 9c71dbde648a61598dc4b172079652924f66b776 (key-sequence): New widget type. diff -r 9c71dbde648a -r a4d43f085476 lisp/wid-edit.el --- a/lisp/wid-edit.el Thu Nov 03 21:44:12 2005 +0000 +++ b/lisp/wid-edit.el Thu Nov 03 21:46:16 2005 +0000 @@ -3116,7 +3116,7 @@ (interactive) (lisp-complete-symbol 'boundp)) :tag "Variable") - + (defvar widget-coding-system-prompt-value-history nil "History of input to `widget-coding-system-prompt-value'.") @@ -3159,6 +3159,29 @@ (widget-apply widget :notify widget event) (widget-setup))) +(defvar widget-key-sequence-prompt-value-history nil + "History of input to `widget-key-sequence-prompt-value'.") + +;; This mostly works, but I am pretty sure it needs more change +;; to be 100% correct. I don't know what the change should be -- rms. + +(define-widget 'key-sequence 'restricted-sexp + "A Lisp function." + :prompt-value 'widget-field-prompt-value + :prompt-internal 'widget-symbol-prompt-internal + :prompt-match 'fboundp + :prompt-history 'widget-key-sequence-prompt-value-history + :action 'widget-field-action + :match-alternatives '(stringp vectorp) + :validate (lambda (widget) + (unless (or (stringp (widget-value widget)) + (vectorp (widget-value widget))) + (widget-put widget :error (format "Invalid key sequence: %S" + (widget-value widget))) + widget)) + :value 'ignore + :tag "Key sequence") + (define-widget 'sexp 'editable-field "An arbitrary Lisp expression." :tag "Lisp expression"