summaryrefslogtreecommitdiff
path: root/lisp/wid-edit.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2005-11-03 21:46:16 +0000
committerRichard M. Stallman <rms@gnu.org>2005-11-03 21:46:16 +0000
commitdd1dbd129bf7273b7deb7037f8dbba755490e3ef (patch)
treedb72606755065f62893c5072ab30aaa0d504464a /lisp/wid-edit.el
parentc1d423e1b54e1b7f75f79c0dc68a6152bcefdf6f (diff)
downloademacs-dd1dbd129bf7273b7deb7037f8dbba755490e3ef.tar.gz
(key-sequence): New widget type.
Diffstat (limited to 'lisp/wid-edit.el')
-rw-r--r--lisp/wid-edit.el25
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."
(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 @@ It will read a directory name from the minibuffer when invoked."
(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"