diff options
| author | Richard M. Stallman | 2005-11-03 21:46:16 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-11-03 21:46:16 +0000 |
| commit | 987cee972836fa81ef31d19736fe64b927f8f080 (patch) | |
| tree | c5eadecde3a599181bcb2f7efcdbe9a26408bdc5 | |
| parent | f6b8e4e7b695e9aaf29b26f1b38841f682ce092b (diff) | |
| download | emacs-987cee972836fa81ef31d19736fe64b927f8f080.tar.gz emacs-987cee972836fa81ef31d19736fe64b927f8f080.zip | |
(key-sequence): New widget type.
| -rw-r--r-- | lisp/wid-edit.el | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 064725c8bfe..5f5d3479547 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el | |||
| @@ -3116,7 +3116,7 @@ It will read a directory name from the minibuffer when invoked." | |||
| 3116 | (interactive) | 3116 | (interactive) |
| 3117 | (lisp-complete-symbol 'boundp)) | 3117 | (lisp-complete-symbol 'boundp)) |
| 3118 | :tag "Variable") | 3118 | :tag "Variable") |
| 3119 | 3119 | ||
| 3120 | (defvar widget-coding-system-prompt-value-history nil | 3120 | (defvar widget-coding-system-prompt-value-history nil |
| 3121 | "History of input to `widget-coding-system-prompt-value'.") | 3121 | "History of input to `widget-coding-system-prompt-value'.") |
| 3122 | 3122 | ||
| @@ -3159,6 +3159,29 @@ It will read a directory name from the minibuffer when invoked." | |||
| 3159 | (widget-apply widget :notify widget event) | 3159 | (widget-apply widget :notify widget event) |
| 3160 | (widget-setup))) | 3160 | (widget-setup))) |
| 3161 | 3161 | ||
| 3162 | (defvar widget-key-sequence-prompt-value-history nil | ||
| 3163 | "History of input to `widget-key-sequence-prompt-value'.") | ||
| 3164 | |||
| 3165 | ;; This mostly works, but I am pretty sure it needs more change | ||
| 3166 | ;; to be 100% correct. I don't know what the change should be -- rms. | ||
| 3167 | |||
| 3168 | (define-widget 'key-sequence 'restricted-sexp | ||
| 3169 | "A Lisp function." | ||
| 3170 | :prompt-value 'widget-field-prompt-value | ||
| 3171 | :prompt-internal 'widget-symbol-prompt-internal | ||
| 3172 | :prompt-match 'fboundp | ||
| 3173 | :prompt-history 'widget-key-sequence-prompt-value-history | ||
| 3174 | :action 'widget-field-action | ||
| 3175 | :match-alternatives '(stringp vectorp) | ||
| 3176 | :validate (lambda (widget) | ||
| 3177 | (unless (or (stringp (widget-value widget)) | ||
| 3178 | (vectorp (widget-value widget))) | ||
| 3179 | (widget-put widget :error (format "Invalid key sequence: %S" | ||
| 3180 | (widget-value widget))) | ||
| 3181 | widget)) | ||
| 3182 | :value 'ignore | ||
| 3183 | :tag "Key sequence") | ||
| 3184 | |||
| 3162 | (define-widget 'sexp 'editable-field | 3185 | (define-widget 'sexp 'editable-field |
| 3163 | "An arbitrary Lisp expression." | 3186 | "An arbitrary Lisp expression." |
| 3164 | :tag "Lisp expression" | 3187 | :tag "Lisp expression" |