[Top][All Lists]

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

Re: Add a widget for command functions?

From: Juri Linkov
Subject: Re: Add a widget for command functions?
Date: Mon, 12 Oct 2009 23:32:19 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu)

> 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")

I think the original implementation (where the widget `command'
inherited from `function') was much better.  But I know no reason
why it is not in wid-edit.el now :(  You can find it here:

Juri Linkov

reply via email to

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