Subject: Debugging elisp files

From: goncholden <[email-masked]>
Date: Thu, 24 Mar 2022 18:19:13 +0000

I am debugging a large file because of the following error,

Warning (initialization): An error occurred while loading ‘/home/goncho/.emacs’:
Invalid read syntax: )

This means that I have a trailing parenthesis. To ensure normal operation, I have to investigate and remove the cause of the error in my initialization file. But I am finding
the task problematic, because using the `--debug-init` option to view a complete error backtrace, has not properly located the problem. It is unfortunate that with just one mark makes the file impossible to parse from start to end. Can emacs be made to handle these things better rather than reject all the file?

The best way to find the problem is to use a binary space partitioning scheme. This means to divide the file in half (comment out one part) or put half in another file. Then check if the error occurs in the code that has not been commented out or resides in the other file. If it does, one has to divide again that part in half and repeat the process until one narrows down to the source of the problem. The process is very tedious.

In texinfo, there exists the "@ignore" and "@end ignore" tags that comment out sections of texinfo code. This makes it much easier to debug texinfo files, because one does not have to constantly comment every line, and with the advantage that one can leave the file almost intact.

I would be grateful if emacs could improve on the user debugging part, so debugging can be made more convenient for users in order to reduce downtime. Am not sure if the manual can describe the procedures to debug in a quicker and easier manner, both for new users of elisp programming and experienced ones who would benefit from fixing problem quite rapidly.