* Add a widget for command functions?
@ 2009-10-12 1:17 Lennart Borgman
2009-10-12 20:32 ` Juri Linkov
0 siblings, 1 reply; 3+ messages in thread
From: Lennart Borgman @ 2009-10-12 1:17 UTC (permalink / raw)
To: Emacs-Devel devel
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")
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Add a widget for command functions?
2009-10-12 1:17 Add a widget for command functions? Lennart Borgman
@ 2009-10-12 20:32 ` Juri Linkov
2009-10-12 20:52 ` Lennart Borgman
0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2009-10-12 20:32 UTC (permalink / raw)
To: Lennart Borgman; +Cc: Emacs-Devel devel
> 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:
http://thread.gmane.org/gmane.emacs.devel/8116
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-12 20:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-12 1:17 Add a widget for command functions? Lennart Borgman
2009-10-12 20:32 ` Juri Linkov
2009-10-12 20:52 ` Lennart Borgman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.