Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong type argument: consp, nil #51

Open
rotdrop opened this issue Dec 4, 2021 · 6 comments
Open

Wrong type argument: consp, nil #51

rotdrop opened this issue Dec 4, 2021 · 6 comments

Comments

@rotdrop
Copy link

rotdrop commented Dec 4, 2021

Hello,

Please, provide the following information and remove the useless parts.
Thanks in advance.

bug -> yes, I suppose

M-x markdown-toc-bug-report

markdown-toc - Please:
- Describe your problem with clarity and conciceness (cf. https://www.gnu.org/software/emacs/manual/html_node/emacs/Understanding-Bug-Reporting.html)
- Explicit your installation choice (melpa, marmalade, el-get, tarball, git clone...).
- Report the following message trace inside your issue.

System information:
- system-type: gnu/linux
- locale-coding-system: utf-8-unix
- emacs-version: GNU Emacs 28.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.29, cairo version 1.16.0)
 of 2021-11-30
- markdown-mode path: /home/claus/.emacs.d/elpa/markdown-mode-20211022.55/markdown-mode.el
- markdown-toc version: 0.1.5
- markdown-toc path: /home/claus/.emacs.d/elpa/markdown-toc-20210905.738/markdown-toc.el

Expected behavior

What command did you use and what were you expecting?

markdown-toc-generate-toc, markdown-toc-refresh-toc, markdown-toc-generate-or-refresh-toc

Actual behavior

When running the command markdown-toc-generate-toc I get the error Wrong type argument: consp, nil with the following test-file:

PROJECT
========

# Heading #

## Sub-Heading ##

Blah blah.

# Another Heading #

Blah blah.

When I remove the second-level heading the toc is generated successfully.

PROJECT
========

# Heading #

Blah blah.

# Another Heading #

Blah blah.

Steps to reproduce the behavior

How can we try and reproduce?

See above, simple example mark-down code.

Thanks for sharing!

Cheers,

@rafauke
Copy link

rafauke commented Mar 22, 2022

@rotdrop I had the same issue. Please try playing with markdown-nested-imenu-heading-index variable. In my case, explicitly setting it to t has fixed the issue for me

@rafauke
Copy link

rafauke commented Apr 19, 2022

Looks like I have a regression and the issue is back. If you need my help for debugging @sochotnicky, I would be happy to help :)

@louisdecharson
Copy link

Hello @rafauke, @rotdrop
I have the same issue, have you found a solution ?

psibi added a commit to psibi/markdown-mode that referenced this issue Jul 22, 2022
This change specifically fixes this bug for me:
ardumont/markdown-toc#51

IIUC, `#` is used to inform the byte-compiler that the expression can
be byte-compiled. But in this case there is nothing to compile since
it's a symbol.
@psibi
Copy link

psibi commented Jul 22, 2022

The PR here fixes it for me: jrblevin/markdown-mode#721

Can you give it a try to see if it fixes for you too ?

@rotdrop
Copy link
Author

rotdrop commented Nov 9, 2022

The PR here fixes it for me: jrblevin/markdown-mode#721

Can you give it a try to see if it fixes for you too ?

Difficult to tell. The bug was still there as of today. Then I manually applied your changes and the bug went away. But I had also removed the eln-cache in between. Now I have removed the eln-cache again and restored the original markdown-mode.el and the bug is -- still not there. So I do not known whether this is a crazy interaction with the native compilation mode.

@webdevelopers-eu
Copy link

webdevelopers-eu commented Feb 1, 2023

I get the same bug with latest GIT and ELPA version as well.

# Test
## Features
### Javascript
## Syntax

If I have a simple file like this it fails to generate TOC.

toggle-debug-on-error shows this:

Debugger entered--Lisp error: (wrong-type-argument consp nil)
  markdown-imenu-create-nested-index()
  funcall(markdown-imenu-create-nested-index)
  (markdown-toc--compute-toc-structure (funcall imenu-create-index-function))
  (funcall markdown-toc-user-toc-structure-manipulation-fn (markdown-toc--compute-toc-structure (funcall imenu-create-index-function)))
  (markdown-toc--generate-toc (funcall markdown-toc-user-toc-structure-manipulation-fn (markdown-toc--compute-toc-structure (funcall imenu-create-index-function))))
  (insert (markdown-toc--generate-toc (funcall markdown-toc-user-toc-structure-manipulation-fn (markdown-toc--compute-toc-structure (funcall imenu-create-index-function)))))
  (save-excursion (if (markdown-toc--toc-already-present-p) (progn (markdown-toc--delete-toc t))) (insert (markdown-toc--generate-toc (funcall markdown-toc-user-toc-structure-manipulation-fn (markdown-toc--compute-toc-structure (funcall imenu-create-index-function))))))
  markdown-toc-generate-toc(t)
  markdown-toc-generate-or-refresh-toc()
  funcall-interactively(markdown-toc-generate-or-refresh-toc)
  command-execute(markdown-toc-generate-or-refresh-toc record)
  execute-extended-command(nil "markdown-toc-generate-or-refresh-toc" nil)
  funcall-interactively(execute-extended-command nil "markdown-toc-generate-or-refresh-toc" nil)
  command-execute(execute-extended-command)

GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0) of 2023-01-30, modified by Debian

This fixed it for me: jrblevin/markdown-mode#578 (comment)

Not sure if my post is any helpful since I don't know lisp. If it is something already known, ignore it.

yoshimoto added a commit to yoshimoto/markdown-toc that referenced this issue Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants