From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: predicate group-p to see if a group exists? Date: Fri, 01 Feb 2008 07:40:42 +0100 Message-ID: <47A2BEEA.2010702@gmx.at> References: <002801c8645d$6fb86230$9eb22382@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1201848436 18264 80.91.229.12 (1 Feb 2008 06:47:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 Feb 2008 06:47:16 +0000 (UTC) Cc: Emacs-Devel To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 01 07:47:37 2008 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 1JKpgX-00072I-Hu for ged-emacs-devel@m.gmane.org; Fri, 01 Feb 2008 07:47:37 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKpg6-0007hM-5M for ged-emacs-devel@m.gmane.org; Fri, 01 Feb 2008 01:47:10 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKpg1-0007gm-Uk for emacs-devel@gnu.org; Fri, 01 Feb 2008 01:47:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKpfz-0007gJ-0k for emacs-devel@gnu.org; Fri, 01 Feb 2008 01:47:05 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKpfy-0007gG-Rj for emacs-devel@gnu.org; Fri, 01 Feb 2008 01:47:02 -0500 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JKpfy-0007cr-FF for emacs-devel@gnu.org; Fri, 01 Feb 2008 01:47:02 -0500 Original-Received: (qmail invoked by alias); 01 Feb 2008 06:47:00 -0000 Original-Received: from N750P012.adsl.highway.telekom.at (EHLO [62.47.37.172]) [62.47.37.172] by mail.gmx.net (mp026) with SMTP; 01 Feb 2008 07:47:00 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18zhyIEk54zw9U+p9V70WwhHmFyfOLLkN3XL3ukJd ELr4WIwb1CsNUB User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: <002801c8645d$6fb86230$9eb22382@us.oracle.com> X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. 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:87913 Archived-At: > There seems to be no predicate to test whether a particular group is > defined. Should there be one? (group-p 'foo) > > For example, consider a library that could be used with different Emacs > versions. Suppose that a group `foo' exists in one Emacs version but not in > another (Buffer-menu is an example - doesn't exist in Emacs 20). > > Suppose I want to define a new group `my-foo'. I want it to have group `foo' > as parent, if group `foo' exists'. If not, I want it to have whatever > parent(s) `foo' has in the Emacs versions where `foo' is defined. > > For that, I could do this, if predicate `group-p' existed: > > (defgroup my-foo nil "jjjj" > :group (if (group-p 'foo) 'foo 'bar)) > > Yes, I could just do this: > > (defgroup my-foo nil "jjjj" > :group 'foo :group 'bar) > > But in the later Emacs versions, `my-foo' will also have `bar' as parent, > not just `foo', which is a bit less tidy. You could write (defgroup my-foo nil "jjjj" :group (if (get 'foo 'custom-group) 'foo 'bar)) because it's unlikely that a custom group doesn't have any members (except for the case when you're just specifying it - like my-foo).