From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: custom type tests Date: Fri, 30 Nov 2007 19:48:50 -0800 Message-ID: References: <4750BFA3.9070708@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1196481024 32187 80.91.229.12 (1 Dec 2007 03:50:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Dec 2007 03:50:24 +0000 (UTC) Cc: Emacs-Devel To: "Lennart Borgman \(gmail\)" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 01 04:50:33 2007 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 1IyJNB-0000ur-E4 for ged-emacs-devel@m.gmane.org; Sat, 01 Dec 2007 04:50:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IyJMv-0007cy-Ba for ged-emacs-devel@m.gmane.org; Fri, 30 Nov 2007 22:50:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IyJMr-0007c6-2m for emacs-devel@gnu.org; Fri, 30 Nov 2007 22:50:13 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IyJMq-0007aw-7b for emacs-devel@gnu.org; Fri, 30 Nov 2007 22:50:12 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IyJMq-0007al-2P for emacs-devel@gnu.org; Fri, 30 Nov 2007 22:50:12 -0500 Original-Received: from agminet01.oracle.com ([141.146.126.228]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IyJMp-0005zl-LY for emacs-devel@gnu.org; Fri, 30 Nov 2007 22:50:11 -0500 Original-Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.186.111]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id lB13o7Vk004591; Fri, 30 Nov 2007 21:50:08 -0600 Original-Received: from acsmt350.oracle.com (acsmt350.oracle.com [141.146.40.150]) by rgmgw2.us.oracle.com (Switch-3.2.4/Switch-3.2.4) with ESMTP id lB13o6eu012361; Fri, 30 Nov 2007 20:50:06 -0700 Original-Received: from dhcp-amer-csvpn-gw1-141-144-64-73.vpn.oracle.com by acsmt351.oracle.com with ESMTP id 3399396101196480918; Fri, 30 Nov 2007 19:48:38 -0800 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <4750BFA3.9070708@gmail.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 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:84405 Archived-At: > >> Does anyone know of code that deals with custom types > >> in such a way that you could test whether the type of > >> a user option is compatible with a given type? > >> > >> For instance, if a variable `foo' is of type `regexp' > >> and `bar' is of type `color', I would want a test for > >> compatibility with type `string' to return non-nil for > >> each, since a regexp and a color are strings. > >> > >> As another example, if `foo' is of type `string', I > >> would want a test for compatibility with type (choice > >> (const nil) string) to return non-nil, since a string > >> is in the union of all strings and {nil}. > >> > >> Any existing code that deals with subtypes this way? > >> Any code that deals with custom type tests, other than > >> just `custom-variable-type' and (get __ 'custom-type)? > >> > >> I'm looking for code that would allow flexible type > >> tests - subtyping, if possible (see above), but also > >> not differentiating between types such as (choice > >> (const :tag "toto" nil) string) and (choice > >> (const nil) string) or between (choice (choice (const > >> nil) string) and (choice string (const nil)). > >> > >> Any pointers to pertinent code or doc are appreciated. > >> Think of it this way: Given a custom type, how can I > >> find all user options that have that type (or a > >> compatible type, such as a subtype)? > > > > I do not know exactly, but the :match property of a > > widget has the function you need. Look in cus-edit.el > > and wid-edit.el how this function is built. It does > > not look very easy to find out however. > > Thinking about it again, the code is in set-variable. > Look for :match there. Thanks for checking and replying. No, I don't see that, however. That code is about checking that a given value is of the right type. I want to compare two types themselves, to see if they are compatible (one is <= the other). I don't want to check the type of a value. I want to know if the custom types defined for two variables are compatible: whether the type defined for var1 is compatible with the type defined for var2. If the type of var1 is `regexp' and the type of var2 is `string', for example, then the types are compatible (var1's type <= var2's type) - regardless of the current values. Testing current values is not sufficient. It's really what I said before: > >> Given a custom type, how can I find all user options that > >> have that type (or a compatible type, such as a subtype)? By "have that type", I meant "are defined with that type", not "have values of that type".