From: "Etienne Prud’homme" <e.e.f.prudhomme@gmail.com>
To: emacs-devel@gnu.org
Subject: Easy traversal of customize groups
Date: Fri, 23 Jun 2017 13:31:20 -0400 [thread overview]
Message-ID: <87mv8yipav.fsf@x230.lts> (raw)
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 “Custom-mode”, 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 “Custom-mode”, 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’s 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’s parent. E.g.
If I’m in group ‘info’, I must map over all known symbols to guess its
parents.
So now, here’s 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
next reply other threads:[~2017-06-23 17:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-23 17:31 Etienne Prud’homme [this message]
2017-06-23 20:34 ` Easy traversal of customize groups Stefan Monnier
2017-06-23 22:56 ` Etienne Prud’homme
2017-06-24 0:06 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mv8yipav.fsf@x230.lts \
--to=e.e.f.prudhomme@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).