From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs,gmane.emacs.pretest.bugs Subject: bug#3811: 23.0.96; custom-group-members Date: Wed, 15 Jul 2009 10:13:32 -0700 Message-ID: <3603C9F0E5E94699A8CA397ED1986DB1@us.oracle.com> References: <5CA3346CC20B4ED3957C67730027CF19@us.oracle.com> Reply-To: Drew Adams , 3811@emacsbugs.donarmstrong.com 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 1247679476 4677 80.91.229.12 (15 Jul 2009 17:37:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Jul 2009 17:37:56 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org, 3811@emacsbugs.donarmstrong.com To: "'Stefan Monnier'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 15 19:37:49 2009 Return-path: Envelope-to: geb-bug-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 1MR8QM-0002Of-F1 for geb-bug-gnu-emacs@m.gmane.org; Wed, 15 Jul 2009 19:37:46 +0200 Original-Received: from localhost ([127.0.0.1]:54644 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MR8QL-0002b9-Sx for geb-bug-gnu-emacs@m.gmane.org; Wed, 15 Jul 2009 13:37:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MR8QD-0002Z1-Uc for bug-gnu-emacs@gnu.org; Wed, 15 Jul 2009 13:37:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MR8Q8-0002Qg-AJ for bug-gnu-emacs@gnu.org; Wed, 15 Jul 2009 13:37:37 -0400 Original-Received: from [199.232.76.173] (port=41770 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MR8Q8-0002QL-07 for bug-gnu-emacs@gnu.org; Wed, 15 Jul 2009 13:37:32 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:40908) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MR8Q7-0007Ed-7q for bug-gnu-emacs@gnu.org; Wed, 15 Jul 2009 13:37:31 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n6FHbSo3031155; Wed, 15 Jul 2009 10:37:29 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n6FHKCFC028190; Wed, 15 Jul 2009 10:20:12 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: "Drew Adams" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 15 Jul 2009 17:20:12 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 3811 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 3811-submit@emacsbugs.donarmstrong.com id=B3811.124767802627068 (code B ref 3811); Wed, 15 Jul 2009 17:20:12 +0000 Original-Received: (at 3811) by emacsbugs.donarmstrong.com; 15 Jul 2009 17:13:46 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from acsinet11.oracle.com (acsinet11.oracle.com [141.146.126.233]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n6FHDgpu027062 for <3811@emacsbugs.donarmstrong.com>; Wed, 15 Jul 2009 10:13:43 -0700 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by acsinet11.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n6FHDfFk014881 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 15 Jul 2009 17:13:42 GMT Original-Received: from abhmt003.oracle.com (abhmt003.oracle.com [141.146.116.12]) by acsinet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n6FHFU6C005618; Wed, 15 Jul 2009 17:15:30 GMT Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 15 Jul 2009 10:13:31 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AcoFWxQMA+i1rTyKQfaXxW/YumwD7gAAi68wAADUZ1A= X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: abhmt003.oracle.com [141.146.116.12] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090209.4A5E0E3D.01C6:SCFSTAT5015188,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Wed, 15 Jul 2009 13:37:36 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:29444 gmane.emacs.pretest.bugs:24801 Archived-At: > It might be useful to have another function (or perhaps > another optional arg to this function), which would act > recursively to give you all members, indirect or direct, that > belong to the group - IOW, anything that belongs to the group > or to one of its subgroups (recursively). To be clear what I meant, something like this: (defun custom-group-members (symbol groups-only &optional recursivep) "Return members of the custom group for SYMBOL. If GROUPS-ONLY is non-nil, return only those direct members that are groups. If RECURSIVEP is non-nil and GROUPS-ONLY is nil, return non-group direct and indirect members." (let ((members ())) (cond (groups-only (dolist (entry (get symbol 'custom-group)) (when (eq (cadr entry) 'custom-group) (push entry members))) (nreverse members)) (recursivep (let ((direct-members (custom-group-members symbol nil))) (dolist (dm direct-members) (if (eq (cadr dm) 'custom-group) (setq members (nconc (custom-group-members (car dm) nil t) members)) (push dm members))) (nreverse members))) (t (get symbol 'custom-group))))) It would be even better to combine args GROUPS-ONLY and RECURSIVEP, but that might mean problems for backward incompatibility. But perhaps something like this would be OK? (defun custom-group-members (symbol arg) "Return members of the custom group for SYMBOL. ARG nil means return all direct group members: groups and non-groups. ARG `nongroups' means return all nongroup members, recursively. ARG anything else means return all direct group members." (let ((members ())) (case arg ((nil) (get symbol 'custom-group)) (nongroups (let ((direct-members (custom-group-members symbol nil))) (dolist (dm direct-members) (if (eq (cadr dm) 'custom-group) (setq members (nconc (custom-group-members (car dm) 'nongroups) members)) (push dm members))) (nreverse members))) (t (dolist (entry (get symbol 'custom-group)) (when (eq (cadr entry) 'custom-group) (push entry members))) (nreverse members))))) That would still work for any existing code that used a value other than `nongroups' as the second arg, which probably means there would be no problems in practice. We might also consider making this a command. Users could use it to print out a list of the options and faces for a group. Note that one use of the proposed recursive behavior is for a user to create a custom group that represents a collection of personal settings (across other custom groups), and then to share those settings with others. (See the emacs-devel discussion of "skins" as custom groups.) A user Jane could, for example, use `custom-add-to-group' with group `jane', and then she could publish the `jane' settings for others, retrieving them using `custom-group-members'. The only other piece missing would then be a way for non-Lisp users to do the equivalent of `custom-add-to-group' using only the Customize UI. That is, we would provide easy ways to specify that certain options and faces should be added to group `jane'.