-
Notifications
You must be signed in to change notification settings - Fork 157
Home
Alexander-Miller edited this page Apr 3, 2019
·
3 revisions
A couple of general tips if you want to modify treemacs beyond its builtin configuration options.
- If you want to get a feel for the codebase look to the functions
treemacs
andtreemacs--push-button
, they're general entry points for a large part of treemacs' functionality. - Treemacs expects paths to be formatted the way f.el formats path - without the final slash. The only exception
is the value of
default-directory
in the treemacs buffer so the correct directory is selected when creating files through treemacs. - Each line in treemacs is a button (as produced by the button.el library), each button has a set of useful properties.
-
path
the absolute path if the button is a file -
depth
number indicating how deeply nested the button is, used for indentation -
parent
the button's parent button, if any -
index
the button's part of the tags index, if it's a tags section -
state
indicates the type of the button. Will assume values like: dir-node-open, dir-node-closed, file-node-open, file-node-closed, tag-node-open, tag-node-closed, tag-node
-
- Reading button properties can be dangerous, since it only works when the call to
button-get
or a similar function only works when called from inside the same buffer the button is positioned in. In this case use eithertreemacs--safe-button-get
ortreemacs--with-button-buffer
.