How to find a bug in “.emacs” or “init.el”?

后端 未结 5 1633
小蘑菇
小蘑菇 2020-12-12 18:38

Sometimes when I open Emacs, Emacs initialization fail.
That is because .emacs or init.el files have a bug. (My bugs often come from just misty

5条回答
  •  北海茫月
    2020-12-12 18:55

    You can debug your .emacs file like this: Debugging a customization file

    Start Emacs with the ‘-debug-init’ command-line option. This enables the Emacs Lisp debugger before evaluating your .emacs file, and places you in the debugger if something goes wrong. The top line in the trace-back buffer will be the error message, and the second or third line of that buffer will display the Lisp code from your .emacs file that caused the problem.

    You can also evaluate an individual function or argument to a function in your .emacs file by moving the cursor to the end of the function or argument and typing C-x C-e (M-x eval-last-sexp).

    Use C-h v (M-x describe-variable) to check the value of variables which you are trying to set or use.

提交回复
热议问题