From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: Specifying plist requirements in defcustom? Date: Sun, 12 Oct 2008 18:31:12 -0700 Message-ID: <001401c92cd3$60c71070$0200a8c0@us.oracle.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1223861540 2135 80.91.229.12 (13 Oct 2008 01:32:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 13 Oct 2008 01:32:20 +0000 (UTC) To: "'jrwats'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 13 03:33:18 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KpCJC-0007P2-A4 for geh-help-gnu-emacs@m.gmane.org; Mon, 13 Oct 2008 03:33:18 +0200 Original-Received: from localhost ([127.0.0.1]:46556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KpCI7-0006p2-VR for geh-help-gnu-emacs@m.gmane.org; Sun, 12 Oct 2008 21:32:11 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KpCHr-0006ox-Lz for help-gnu-emacs@gnu.org; Sun, 12 Oct 2008 21:31:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KpCHq-0006ol-6x for help-gnu-emacs@gnu.org; Sun, 12 Oct 2008 21:31:55 -0400 Original-Received: from [199.232.76.173] (port=49254 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KpCHq-0006oi-0S for help-gnu-emacs@gnu.org; Sun, 12 Oct 2008 21:31:54 -0400 Original-Received: from rgminet01.oracle.com ([148.87.113.118]:61667) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KpCHq-0001gE-7c for help-gnu-emacs@gnu.org; Sun, 12 Oct 2008 21:31:54 -0400 Original-Received: from agmgw2.us.oracle.com (agmgw2.us.oracle.com [152.68.180.213]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id m9D1Uud8019269; Sun, 12 Oct 2008 19:30:56 -0600 Original-Received: from acsmt702.oracle.com (acsmt702.oracle.com [141.146.40.80]) by agmgw2.us.oracle.com (Switch-3.2.0/Switch-3.2.0) with ESMTP id m9D1UtEr020696; Sun, 12 Oct 2008 19:30:55 -0600 Original-Received: from dradamslap1 (/24.23.165.218) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 13 Oct 2008 01:30:55 +0000 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: thread-index: AckssygUjaIVGOUPRPCAxUBVePGnCwAHb70g X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:58713 Archived-At: > I want to have a customization type that is a list of symbols, and I > want those symbols to have certain plist requirements fulfilled. Is > there a way to specify this kind of requirement like > (defcustom :type ) > > I know you can have a plist type, but the true type of the customized > variable is '(repeat (symbol)). And I want a certain plist for these > symbols. For what it's worth, my plist is (branch drive string> path ). As an example, here's how I set the > variable: > > ;; I'd like this to be defcustom > (defvar corext-enlistments nil > "list of enlistments where each enlistment has a property list of: > branch, drive, and directory") IIUYC, you want a repetition of symbols, each of which must have non-nil properties `branch', `drive', and `path'. If so, something like this should do the job (untested): (defcustom corext-enlistments nil "..." :type '(repeat (restricted-sexp :match-alternatives ((lambda (x) (and (symbolp x) (let ((pl (symbol-plist x))) (and (plist-get pl 'branch) (plist-get pl 'drive) (plist-get pl 'path))))))))) If nil property values are OK, then use plist-member instead of plist-get.