Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Emacs comes with everything you need to learn emacs-lisp. Take some time to familiarize yourself with the help facilities* and then jump over to info, start with "Emacs Lisp Intro" and eventually continue with "Emacs" and "Emacs Lisp".

* At the very least, familiarize yourself with "C-h f (describe-function)", "C-h v (describe-variable)" and how to read info pages. To view what other help facilities emacs provides glance over "C-h ? (help-for-help)".



As someone who's very comfortable writing Elisp and reading the Emacs documentation, I must disagree. Emacs documentation is comprehensive and it is very clearly written, some of the best I've seen -- but as reference documentation.

It is still somewhat short on examples/practical how-tos. You need to be comfortable with the system and have some idea what you're looking for. A great example is [`display-buffer-alist` actions][0]. Thoroughly described, with appropriate cross-linking, but still kinda [hard to really grok without resort to existing code][1].

[0]:https://www.gnu.org/software/emacs/manual/html_node/elisp/Bu... [1]:https://www.reddit.com/r/emacs/comments/cpdr6m/any_additiona...


Hmm, window management is just one of those corners of emacs I have not gotten around to grokking yet. Yes, I am annoyed by it, but I usually keep things sane by just having upto 3 windows at a time and just manually fix things (usually just winner-undo) when emacs functions do whatever with the windows they like to do.

In my opinion, usually the manual contains sufficient examples and motivations to explain the topic, apart from the detailed reference documentation.

Even for your example, there is this page, which seems to give an overview of the topic. (Granted I haven't really delved in these parts of Emacs, so it is not possible for me to know whether the page does a good enough job.)

https://www.gnu.org/software/emacs/manual/html_node/elisp/Th...

>hard to really grok without resort to existing code

But the code also ships with emacs, so technically...


I've been able to get by so far with the inbuilt doc and reading the code for installed packages, etc. I can read other people's config and reasonably copy needed chunks, debug issues (I've submitted PRs to magit, org mode, and Doom to fix various issues).

The problem is that the last little bit to get to a fluent understanding has been elusive, e.g. how some of the macro-heavy features work (e.g. the common lisp stuff), or how to handle async code (e.g. how magit runs a command, and then refreshes the buffer after it completes). I have this fluency to some degree for the languages I'm paid to produce code in (e.g. C++, to some extent; Stroustrip himself said his knowledge of C++ was "7 out of 10 on a good day" or something like that), but these last few advanced features have been a tough nut to crack in elisp.


The good thing is that the source is always right there and you can read it or set breakpoints and step through it to see how things work.

> how to handle async code (e.g. how magit runs a command, and then refreshes the buffer after it completes)

Emacs's primary mechanism for async code is: spawning an asynchronous process and interacting with them using a process filter/sentinel. This allows you to do things like detect when that process has emitted a certain output or signal and run some code based on that.

For example, magit user the process-sentinel for a pull/fetch command to call (magit-refresh) to refresh the buffer. (How to fish: I guessed that magit-refresh was probably the function refreshing the buffers, set a breakpoint in it, and voila now I have the entire stackframe.)

Relevant pages from info: "(elisp) Filter Functions", "(elisp) Sentinels".




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: