all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Easy traversal of customize groups
@ 2017-06-23 17:31 Etienne Prud’homme
  2017-06-23 20:34 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Etienne Prud’homme @ 2017-06-23 17:31 UTC (permalink / raw
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-24  0:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-23 17:31 Easy traversal of customize groups Etienne Prud’homme
2017-06-23 20:34 ` Stefan Monnier
2017-06-23 22:56   ` Etienne Prud’homme
2017-06-24  0:06     ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.