unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 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

* Re: Add a widget for command functions?
  2009-10-12 20:32 ` Juri Linkov
@ 2009-10-12 20:52   ` Lennart Borgman
  0 siblings, 0 replies; 3+ messages in thread
From: Lennart Borgman @ 2009-10-12 20:52 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Emacs-Devel devel

On Mon, Oct 12, 2009 at 10:32 PM, Juri Linkov <juri@jurta.org> wrote:
>> Could a widget for command functions perhaps be added to Emacs?
>>
>> (define-widget 'command 'restricted-sexp
>>   "A command function."

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

Ok ;-)

Anyone of them would do. Should I send my widget for major modes now, or?




^ 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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).