snosov1 / toc-org

toc-org is an Emacs utility to have an up-to-date table of contents in the org files without exporting (useful primarily for readme files on GitHub)
GNU General Public License v3.0
287 stars 29 forks source link

Respect the file-local value of org-list-indent-offset. #75

Closed Alexander-Miller closed 3 years ago

Alexander-Miller commented 3 years ago

Currently org-toc uses the global value of org-list-indent-offset, which always leads to unnecessary changes in the toc when 2 people with different offsets edit the same file (quite inconvenient with PRs).

With this change the buffer-local value will be used.

snosov1 commented 3 years ago

Hey, @Alexander-Miller !

Thanks for the PR - overall, I'm in for the change. Though, I'm not sure I 100% understand how it works. So, you've moved the access to org-list-indent-offset out of toc-org-hrefify-toc - but how does it affect the global/local access? (is it because the access is moved out of with-temp-buffer?)

Alexander-Miller commented 3 years ago

is it because the access is moved out of with-temp-buffer?

Pretty much, yes. with-temp-buffer moves us out of the original org buffer where the save hook is running, so the buffer-local value is lost in this new context and needs to be passed in explicitly.

snosov1 commented 3 years ago

Ok, got'ya! Let's mUrge!

snosov1 commented 3 years ago

Oh, heck, the tests were broken, I've reverted the change.

https://travis-ci.org/github/snosov1/toc-org/builds/767837629

Can you,please, fix them?

Alexander-Miller commented 3 years ago

I can do it later today.