ardumont / markdown-toc

Generate a TOC in markdown file
GNU General Public License v3.0
127 stars 102 forks source link

generating toc for a big file requires jumping to the end (markdown-toc-generate-toc: Wrong type argument: consp, 148688) #40

Closed mwasilew2 closed 6 years ago

mwasilew2 commented 7 years ago

bug

M-x markdown-toc-bug-report

System information:
- system-type: gnu/linux
- locale-coding-system: utf-8-unix
- emacs-version: GNU Emacs 25.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.22.19)
 of 2017-09-15
- markdown-toc version: 0.1.2
- markdown-toc path: /home/michal/.emacs.d/elpa/markdown-toc-20170711.1249/markdown-toc.el

installed markdown-toc using melpa

Expected behavior

I was working on a version controlled (not sure if it matters) file that is >6000 lines long and has >200k characters. When running:

markdown-toc-generate-toc (but also markdown-toc-refresh-toc)

I get the following error message (with the number at the end being sometimes different):

markdown-toc-generate-toc: Wrong type argument: consp, 148688

I was expecting the toc to be generated.

This is the minimal repro scenario that I managed to narrow it down to. Originally I hit this when trying to make a change at the top of the file and then updating toc. Both functions work fine if I jumped above 148688 character before running them. In other words, the workaround is: open the file, jump to the end of it and then make the desired changes (e.g. at the beginning of the file) and regenerate toc.

Actual behavior

got an error message and no toc

Steps to reproduce the behavior

Improvments?

What do you want?

I shouldn't need to go to the end of file to generate/refresh toc

not sure if the problem is with markdown-toc or emacs. Maybe emacs is not making the entire file available to markdown-toc? or markdown-toc is asking for the loaded part only? maybe it's a matter of changing some emacs config, e.g. how much of the buffer should be loaded to memory?

mwasilew2 commented 6 years ago

I can no longer reproduce this, not sure what fixed it, might be a matter of version of emacs or some minor mode. Anyways, can be closed for now as far as I'm concerned

System information:
- system-type: gnu/linux
- locale-coding-system: utf-8-unix
- emacs-version: GNU Emacs 25.3.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2017-09-12
- markdown-toc version: 0.1.2
- markdown-toc path: /home/michal/.emacs.d/elpa/markdown-toc-20170711.1249/markdown-toc.el
ardumont commented 6 years ago

Hello,

Thanks for the update.

Cheers,