From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Add a widget for command functions? Date: Mon, 12 Oct 2009 23:32:19 +0300 Organization: JURTA Message-ID: <87r5t8ts8c.fsf@mail.jurta.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1255379891 13780 80.91.229.12 (12 Oct 2009 20:38:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 Oct 2009 20:38:11 +0000 (UTC) Cc: Emacs-Devel devel To: Lennart Borgman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 12 22:38:01 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MxReb-0002m3-3a for ged-emacs-devel@m.gmane.org; Mon, 12 Oct 2009 22:38:01 +0200 Original-Received: from localhost ([127.0.0.1]:38705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MxRea-0002pl-CM for ged-emacs-devel@m.gmane.org; Mon, 12 Oct 2009 16:38:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MxRdg-0002CD-Nk for emacs-devel@gnu.org; Mon, 12 Oct 2009 16:37:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MxRda-00029C-SI for emacs-devel@gnu.org; Mon, 12 Oct 2009 16:37:03 -0400 Original-Received: from [199.232.76.173] (port=59634 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MxRda-00028p-Io for emacs-devel@gnu.org; Mon, 12 Oct 2009 16:36:58 -0400 Original-Received: from smtp-out2.starman.ee ([85.253.0.4]:55677 helo=mx2.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MxRda-0000gg-3N for emacs-devel@gnu.org; Mon, 12 Oct 2009 16:36:58 -0400 X-Virus-Scanned: by Amavisd-New at mx2.starman.ee Original-Received: from mail.starman.ee (82.131.68.196.cable.starman.ee [82.131.68.196]) by mx2.starman.ee (Postfix) with ESMTP id CA2483F4104; Mon, 12 Oct 2009 23:36:51 +0300 (EEST) In-Reply-To: (Lennart Borgman's message of "Mon, 12 Oct 2009 03:17:18 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:116104 Archived-At: > 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/