dalanicolai / doc-tools-toc

Create, cleanup, add and manage Table Of Contents (TOC) of pdf and djvu documents with Emacs
GNU General Public License v3.0
21 stars 2 forks source link

TOC-cleanup does not handle tabs correctly #3

Closed hackerb9 closed 1 year ago

hackerb9 commented 1 year ago

Currently tab characters confuse doc-toc--create-tablist-buffer, which is what C-c C-c runs from TOC-cleanup mode. The resulting TOC-tabular buffer has the incorrect levels for any entry that used tabs for whitespace.

Running (untabify) before creating the tablist buffer seems like the most reasonable solution. Another idea be to try (setq indent-tabs-mode nil) when toc-cleanup-mode first starts so that the user won't create tabs by mistake. Doing both wouldn't hurt.

dalanicolai commented 1 year ago

Thank you for creating the issue. Untabify sounds like a wise thing to do indeed before creating the tablist (even though, technically, the manual speaks only of spaces). I have added it. Thanks again, also for the suggested fixes!