From: "Drew Adams" <drew.adams@oracle.com>
To: "'jrwats'" <jrwats@gmail.com>, <help-gnu-emacs@gnu.org>
Subject: RE: Specifying plist requirements in defcustom?
Date: Sun, 12 Oct 2008 18:31:12 -0700 [thread overview]
Message-ID: <001401c92cd3$60c71070$0200a8c0@us.oracle.com> (raw)
In-Reply-To: <b3c6ed71-c113-41cd-9530-a18758d44754@v39g2000pro.googlegroups.com>
> 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 <complicated requirement goes here>)
>
> 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 <a string> drive <a
> string> path <a string>). 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.
next prev parent reply other threads:[~2008-10-13 1:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-12 20:46 Specifying plist requirements in defcustom? jrwats
2008-10-12 23:18 ` Lennart Borgman (gmail)
2008-10-13 1:31 ` Drew Adams [this message]
[not found] ` <mailman.901.1223861517.25473.help-gnu-emacs@gnu.org>
2008-10-15 14:32 ` jrwats
2008-10-15 14:50 ` Drew Adams
2008-10-15 14:54 ` Lennart Borgman (gmail)
2008-10-15 15:41 ` Drew Adams
[not found] ` <mailman.1123.1224085332.25473.help-gnu-emacs@gnu.org>
2008-10-15 16:27 ` jrwats
2008-10-15 16:33 ` jrwats
2008-10-15 16:48 ` jrwats
2008-10-15 16:58 ` Drew Adams
[not found] ` <mailman.1126.1224089933.25473.help-gnu-emacs@gnu.org>
2008-10-15 17:43 ` jrwats
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001401c92cd3$60c71070$0200a8c0@us.oracle.com' \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=jrwats@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).