emacs-devel
[Top][All Lists]
Advanced

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

Easy traversal of customize groups


From: Etienne Prud’homme
Subject: Easy traversal of customize groups
Date: Fri, 23 Jun 2017 13:31:20 -0400
User-agent: Emacs/25.2 (gnu/linux)

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



reply via email to

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