Malabarba / elisp-bug-hunter

Hunt down errors in elisp files.
275 stars 15 forks source link

Bisect custom-set-variables #13

Open asmeurer opened 8 years ago

asmeurer commented 8 years ago

I, and I imagine many others, have a rather large custom-set-variables at the end of my .emacs. When bug-hunter finds that the issue is in that, I still have to go in and figure out which one of those causes the problem, either by doing a manual bisection or by splitting it into several custom-set-variable calls and running bug-hunter again, either of which is annoying (maybe there's some paredit magic that makes this trivial, I don't know).

Given that this is common and it's pretty likely to be the source of init file bugs, and that you know in advance that these things are generally independent of one another, it seems reasonable that bug-hunter-init-file should split custom-set-variables automatically.

Malabarba commented 8 years ago

Indeed. This is a good idea and shouldn't be too hard. I'll try implementing when I have some time.

dabrahams commented 3 years ago

I think a slight generalization could make this even more broadly useful. I have the same problem with doom modules, which are one big sexp in a file called packages.el. A coarse-grained bisection would try disabling batches of packages.

Doom's case is a bit gnarly in that they insert these section keywords, e.g. :input, :completion, ... (see https://github.com/hlissner/doom-emacs/blob/develop/init.example.el). Seems to me that an alist that maps forms that are eligible for internal bisection, such as custom-set-variables, into functions that describe how they can be carved up into removable units, might make it possible for all kinds of things to become bisectable.