News for hackers. Stuff that matters.
Re:Emacs Lisp book revived: Marcin Borkowski by TeMPOraL on Saturday May 01, 2021 @05:35PM (#27010079)
> take away this introduction of toes-dipped-in-the-water with quick transition to jumping in altogether, and then further hide the code from you. And if you ever do find the code, it's often directory trees with a dozen different "professional-looking" bureaucracy files in the top, and the source code buried somewhere else.

Here's a bunch of tricks one should know if one wants to learn Elisp:

1. You can use describe-function (C-h f) or describe-variable (C-h v), as well as various apropos functions (starting with apropos, C-h a), you can find documentation about pretty much everything in Emacs, down to every single internal function or variable of any bit of Elisp code.

2. When you do that, you get a help buffer that almost always starts with something like "foo is a variable defined in `foo.el`". That "foo.el" bit is a link. You can click on it (or move your point to it and press Enter), and it'll land you straight at the definition of that function/variable. This is your shortcut to jumping straight into relevant source code of everything. Including C code, if you dig yourself into Emacs internals.

3. You can navigate to the help buffer in 2 from plenty of places, including e.g. the list of current modes, or description of a mode.

4. When you're playing around with Elisp code, xref-find-definitions (M-.) will take you straight to definition of a function under point.

Emacs is thoroughly documented and cross-referenced. Your own installation is its own single, living codebase - and you can navigate through it as such.

Re:Emacs Lisp book revived: Marcin Borkowski by neilv on Saturday May 01, 2021 @06:18PM (#27010389)
Thanks, that's what I meant by "see how to navigate between code and docs and keys", but was too lazy to type. :)

One important thing people should keep in mind, if they're starting only with Emacs navigation features for code and docs, is that they're missing crucial information that's in the manuals. One of the manuals is like a combination of the "API docs" you'll find in the docstrings, plus all the narrative around those, which you won't find in the docstrings. If a newbie is told only to browse docstrings and code, they're doing it on hard-mode.

And if a person makes sure they have the manuals installed (sadly, the Emacs Lisp manual(s) don't come installed by default in distros I've seen, which I think is a tragic mistake for uptake), and learns how load the manual in Emacs Info browser, and learns keys the Info keys like `i`, `s`, `[`, `]`, and `u`, I think they'll be glad they didn't try working from manuals in the Web browser.

Also, I wanted to start with making the code files more accessible and concrete, and generally tell people to try thinking differently about this. The reason is that I've suspected that a systemic barrier to accessible Emacs hacking was being created in the bureaucratic and obscuring direction things were going. (And it sounded like maybe this person was a victim of that suspected problem, since, when I started, it was much easier to get into, in the ways I described.)

(FWIW, I was able to write some Emacs extensions by starting with the approach I've suggested, including: https://www.neilvandyke.org/emacs/ )

Re:Emacs Lisp book revived: Marcin Borkowski by optimali2 on Saturday May 01, 2021 @07:23PM (#27010869)
This is good advice. I'm an elisp novice but I've found setting breakpoints using edebug (edebug-set-breakpoint) and then evaluating and traversing the code (edebug-eval-expression) to be very helpful in making the code more tangible (and obviously in debugging :)).
Re:Emacs Lisp book revived: Marcin Borkowski by nanna on Sunday May 02, 2021 @06:01AM (#27013808)
Good call! Will play around with this.