emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Add a widget for command functions?


From: Lennart Borgman
Subject: Add a widget for command functions?
Date: Mon, 12 Oct 2009 03:17:18 +0200

Could a widget for command functions perhaps be added to Emacs?

(defvar widget-command-prompt-value-history nil
  "History of input to `widget-function-prompt-value'.")

(define-widget 'command 'restricted-sexp
  "A command function."
  :complete-function (lambda ()
                       (interactive)
                       (lisp-complete-symbol 'commandp))
  :prompt-value 'widget-field-prompt-value
  :prompt-internal 'widget-symbol-prompt-internal
  :prompt-match 'commandp
  :prompt-history 'widget-command-prompt-value-history
  :action 'widget-field-action
  :match-alternatives '(commandp)
  :validate (lambda (widget)
              (unless (commandp (widget-value widget))
                (widget-put widget :error (format "Invalid command: %S"
                                                  (widget-value widget)))
                widget))
  :value 'ignore
  :tag "Command")




reply via email to

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