alpha-catharsis · 2022-11-14 20:15
Hello,
I have created a library to manage property trees in Emacs. It started as a package to support some personal elisp projects but then I thought that it could be useful also to somebody else, so I have written an hopefully decent piece of documentation for it.
You can find it on [Melpa](https://melpa.org/#/ptree) and on [Github](https://github.com/alpha-catharsis/ptree).
Any feedback would be appreciated.
Thanks,
Alpha
dyereh · 2022-11-14 20:24
Is the github link broken? (I can access thru the melpa link though)
itistheblurstoftimes · 2022-11-14 20:47
Delete the last /tree in the url
github-alphapapa · 2022-11-15 02:24
An interesting idea. My feedback would be that you become more familiar with existing Elisp libraries before implementing a large library like this, because you've reinvented some wheels. For example, see `map-nested-elt`, `pcase`, `cl-defstruct`, etc.
Ideally a library like this would be a thin wrapper around some `map` functions. As well, if `map-nested-elt` had support for generalized variables, it would likely subsume most of, if not all of, the `ptree` library; for example, built-in forms like `(setf (map-nested-elt pt '(desktop background-color)) "black")` would do the job of `(ptree-write-properties-at-path pt 'desktop '(background-color . "black"))`, in a more concise and idiomatic way. `map` also supports alists, plists, and hash-tables, so it would gain that flexibility for free.
alpha-catharsis · 2022-11-15 18:07
Thank you both. I have fixed it.
alpha-catharsis · 2022-11-15 18:23
Thank you very much for the insight. I am quite a neophyte in elisp and didn't really consider \`map\` functions as a possibile solution. I will study them (I had a quick look and they seems pretty interesting).
It is a pity that very little information is available on the web on this subject. Searching for "map-nested-elt" on Google returns just 53 results.
oantolin · 2022-11-16 05:57
Emacs comes with extensive documentation, you should get into the habit of consulting it before googling. With some practice it's actually more convenient to have the documentation right there inside Emacs than switching over to a browser.
github-alphapapa · 2022-11-18 21:45
You're welcome. You seem like a talented programmer, and I look forward to more contributions from you.
> It is a pity that very little information is available on the web on this subject. Searching for "map-nested-elt" on Google returns just 53 results.
Emacs is known as the "self-documenting editor" for a reason. It's usually best to "ask Emacs first" and then turn to the Web if you can't find what you need.