emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: predicate group-p to see if a group exists?


From: martin rudalics
Subject: Re: predicate group-p to see if a group exists?
Date: Fri, 01 Feb 2008 07:40:42 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

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).






reply via email to

[Prev in Thread] Current Thread [Next in Thread]