From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?utf-8?Q?Etienne_Prud=E2=80=99homme?= Newsgroups: gmane.emacs.devel Subject: Easy traversal of customize groups Date: Fri, 23 Jun 2017 13:31:20 -0400 Message-ID: <87mv8yipav.fsf@x230.lts> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1498239658 5967 195.159.176.226 (23 Jun 2017 17:40:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 23 Jun 2017 17:40:58 +0000 (UTC) User-Agent: Emacs/25.2 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 23 19:40:53 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dOSZg-0001Jv-8e for ged-emacs-devel@m.gmane.org; Fri, 23 Jun 2017 19:40:52 +0200 Original-Received: from localhost ([::1]:36707 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOSZl-0000IV-F7 for ged-emacs-devel@m.gmane.org; Fri, 23 Jun 2017 13:40:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOSQa-0000kF-76 for emacs-devel@gnu.org; Fri, 23 Jun 2017 13:31:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dOSQX-00068l-3M for emacs-devel@gnu.org; Fri, 23 Jun 2017 13:31:28 -0400 Original-Received: from mail-qk0-x236.google.com ([2607:f8b0:400d:c09::236]:34973) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dOSQW-00068U-Vb for emacs-devel@gnu.org; Fri, 23 Jun 2017 13:31:25 -0400 Original-Received: by mail-qk0-x236.google.com with SMTP id 16so40996515qkg.2 for ; Fri, 23 Jun 2017 10:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=xSXFgcAfJgVudmfIN/rmkN0w22VdM1bbvM9vq2akTOw=; b=SvWZ6K8SQNORrap7m7fdhEUhv89oMCGCJ1JSHlP7JOQqU0qnfUih69pat0CuJOrehx U1kSFj5ki6HkM+TmYbcY8/882dzUVMjIyAmEGtQ/55EgvQ52r5MS6gnUSnhjjRkvFxck bpPf46s8ndhNOcMdddDiaYNgeP5DIfZZs6hozkLhF/xXSor70/bJtmpst5wFDbdy6RDB MYYV/8mkioVR692qI0q/Ib+hvOs9AzBu+rB9T+RXSqdHbVoUmA9Tk5PLhlOKa87EOBMr lfJXUhqO3iYkaunCfRfE7k6iAlGXbKTYEAhOolLZqQJ3x9SgkEgHcUCjNSLa7KZXTSJP KYQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=xSXFgcAfJgVudmfIN/rmkN0w22VdM1bbvM9vq2akTOw=; b=ZQkXJ1fma6NXtFxKUeKROqFkMgtekbO/43+/SIfNNaFKND6WUYBMcsb6r+a8Ugnk+D EPnwRhlkNkXXSuwQonPvF0aGXj/InbjZqAongEhQwgARAEMLV4pi3AtU3H+Z44eT6xxu Cr8ANJ6/CA+9zaebPQOMW1wkEEgWC5sDezZ8bo0k7jtguVncoWTzEbhl43NpzoR8cAZk oeX+SXESg/H5fOoAVIDwtImdsXlAF9dpHpi5Tc47xhvWrFVKLclNe/PeOQFXGcYEf7PR KdGKBCQGaayt6avppfjnlHzDB7XHQx6ypJTC5guKLUq7C0gFuCfzO0ob1ixRGaD1m7MV 7L+Q== X-Gm-Message-State: AKS2vOy7MEMyUhd2HmOodYY16fDMm4NV7YwJTBxnOtLvZVkgZRwDHwYV JSUe2xZGNixhkxqGdbs= X-Received: by 10.55.103.9 with SMTP id b9mr3478511qkc.130.1498239082162; Fri, 23 Jun 2017 10:31:22 -0700 (PDT) Original-Received: from localhost (modemcable232.49-20-96.mc.videotron.ca. [96.20.49.232]) by smtp.gmail.com with ESMTPSA id 51sm3994927qtq.20.2017.06.23.10.31.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Jun 2017 10:31:21 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:215909 Archived-At: The Emacs customization system allows to group custom options. We use something called a group that will contain all its customization members (including other groups). Thus this makes a tree structure. While customize groups are mostly used by =E2=80=9CCustom-mode=E2=80=9D, I = find them really convenient for splitting my init files. I use them so often that I made a small hack library that shows the paths of a group (a group can have multiple parents). However, I noticed that figuring out the paths for a group can be quite hungry. It may not be noticeable when using =E2=80=9CCustom-mode=E2=80=9D,= but to find the parents of a group, we actually use `mapatoms' to iterate over all known symbols. The symbol has a corresponding plist (list of properties). In order to make a group parent of another group, the parent group symbol property list must include a property in the form of: ([children-group] custom-group) That=E2=80=99s more or less the same way members of the group are stored. Storing a reference to group members like that is not a problem when traversing a tree from the root. However, it can become really inefficient when trying to resolve the group=E2=80=99s parent. E.g. If I=E2=80=99m in group =E2=80=98info=E2=80=99, I must map over all known s= ymbols to guess its parents. So now, here=E2=80=99s my proposal: adding a property to link parents in the child group property list. This would allow efficient traversal of customization groups and why not printing a tree of the current customization option. The drawback would be increased memory usage, but I find it negligible when we see the performance improvement. -- Etienne