← Back to context

Comment by Karrot_Kream

1 day ago

Emacs also has a lot of inbuit tools to help you understand what's going on under the hood.

- `info` lets you read the emacs manual

- `apropos` lets you search for various elisp symbols in the editor, so if you're looking for something vaguer than a direct function or command you can search via apropos.

- The in-built `describe` (though I use a fantastic package called `helpful`) lets you figure out what the definition of a given variable, function, or command is. You can even look at what command a given key binding calls.

- Claude does a great job at teaching details of the editing/programming model of emacs which helps if you'd rather not read through the entire emacs manual

Things like this make emacs a joy to hack on (until you're trying to debug some slightly annoying behavior or crufty event loop thing ;)

> (until you're trying to debug some slightly annoying behavior or crufty event loop thing ;)

What do you mean by this? One can look at Emacs itself as a crusty event loop with some slightly annoying behavior. But seriously, I am curious what you mean.

You may already know (and others may not):

- `M-x toggle-debug-on-error` throws you into the debugger on any error (note this isn't "visual" the edebugger!). Use C-h m to see the navigation commands/keys

- Use (debug) to set a breakpoint in Lisp code

- depending on the circumstances, the edebugger may be more helpful. I always instrument the function to debug with `C-u C-M-x` from within the function's form and use `C-M-x` to interpret it (sorry, I forget the underlying commands)

Of course, there's great documentation for both the debugger and edebugger.