
* Awesome Elisp
[[https://github.com/sindresorhus/awesome][https://cdn.jsdelivr.net/gh/sindresorhus/awesome@d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg]]
[[https://unlicense.org][https://upload.wikimedia.org/wikipedia/commons/e/ee/Unlicense_Blue_Badge.svg]]
#+HTML:
Welcome to /Awesome Elisp/, a list of resources linked to Emacs Lisp (Elisp) development.
Its aim is to not be a simple index but a /compendium/: resources are not only listed but also commented.
It tries to be as exhaustive as possible.
For a more general index related to all-things Emacs, use [[https://github.com/emacs-tw/awesome-emacs][Awesome Emacs]].
* Table of Contents :TOC_5:QUOTE:
#+BEGIN_QUOTE
- [[#what-is-elisp][What is Elisp?]]
- [[#iconography][Iconography]]
- [[#resources][Resources]]
- [[#entry-level][Entry-level]]
- [[#advanced][Advanced]]
- [[#cookbooks][Cookbooks]]
- [[#on-package-authoring][On Package Authoring]]
- [[#contributing-to-emacs][Contributing to Emacs]]
- [[#development-tools][Development Tools]]
- [[#interactive-development--debugging][Interactive Development & Debugging]]
- [[#documentation--introspection][Documentation & Introspection]]
- [[#code-editing][Code Editing]]
- [[#jump-to-definition][Jump to definition]]
- [[#search--replace][Search & Replace]]
- [[#editing][Editing]]
- [[#editing-s-exps][Editing S-exps]]
- [[#refactoring][Refactoring]]
- [[#formatting][Formatting]]
- [[#testing][Testing]]
- [[#profiling][Profiling]]
- [[#validation][Validation]]
- [[#building][Building]]
- [[#syntax-highlighting--visual-enhancements][Syntax Highlighting & Visual Enhancements]]
- [[#pretty-printing][Pretty Printing]]
- [[#libraries][Libraries]]
- [[#core--general-purpose][Core / General Purpose]]
- [[#data-structures][Data Structures]]
- [[#strings][Strings]]
- [[#sequences][Sequences]]
- [[#maps][Maps]]
- [[#custom-types--oop][Custom Types & OOP]]
- [[#date--time][Date & Time]]
- [[#tables][Tables]]
- [[#queues][Queues]]
- [[#rings][Rings]]
- [[#trees][Trees]]
- [[#parsers--parse-trees][Parsers & Parse Trees]]
- [[#xmlhtml][XML/HTML]]
- [[#org-mode-outlines][Org-mode outlines]]
- [[#color-codes][Color Codes]]
- [[#concurrency--asynchronicity][Concurrency / Asynchronicity]]
- [[#timers][Timers]]
- [[#promises--delays][Promises & Delays]]
- [[#async-elisp-function-calls][Async Elisp function calls]]
- [[#async-sub-processes][Async sub-processes]]
- [[#async-interpreter-commands][Async interpreter commands]]
- [[#buffer-manipulation][Buffer Manipulation]]
- [[#filesystem-interactions][Filesystem Interactions]]
- [[#networking][Networking]]
- [[#http-client][HTTP client]]
- [[#http-server][HTTP server]]
- [[#rpc-server][RPC server]]
- [[#d-bus][D-Bus]]
- [[#database-access][Database Access]]
- [[#gui][GUI]]
- [[#popups][Popups]]
- [[#overlays][Overlays]]
- [[#charts--diagrams][Charts & diagrams]]
- [[#heroes][Heroes]]
- [[#contributing][Contributing]]
- [[#license--acknowledgments][License & Acknowledgments]]
#+END_QUOTE
* What is Elisp?
Elisp is short for /Emacs Lisp/, a dialect of [[https://en.wikipedia.org/wiki/Lisp_programming_language][Lisp]] specific to Emacs.
If you're a fresh Emacs user, you've certainly practiced it a bit by editing your =init.el= (i.e. configuration).
You may also have spotted that most /packages/ (i.e. plugins) available to Emacs are written in pure Elisp.
In fact, Elisp is not limited to extending Emacs functionalities: a good chunk (and [[https://archive.fosdem.org/2020/schedule/event/emacsthoughts/][admittedly not enough]]) of Emacs is written in it.
This means that any user can browse, extend or even override core Emacs functionalities at runtime.
As such, in essence, Emacs is [[http://web.archive.org/web/20230712071615/https://www.eigenbahn.com/2020/01/12/emacs-is-no-editor][not an editor]] but more a platform allowing users to write text-based apps.
Being an editor is not its intrinsic nature but merely a feature.
Learning Elisp will up your Emacs game tremendously, unlocking its full potential by writing functionalities either for your personal needs or to share with the world.
As an added bonus, it's great fun.
* Iconography
| [[./rsc/icon/standard.png]] | /standard/ (bundled with every Emacs install) |
| [[./rsc/icon/informal-standard.png]] | /informal standard/ (not bundled with Emacs, but used in many major packages) |
* Resources
** Entry-level
*** An Introduction to Programming in Emacs Lisp
[[https://www.gnu.org/software/emacs/manual/html_node/eintr/index.html][read online]]
Also comes bundled with Emacs.
Just =C-h i= (or =M-x info=) and open =Emacs Lisp Intro=.
A bit scholarly. Not the easiest read.
*** Emacs In A Box - Elisp Programming
[[http://caiorss.github.io/Emacs-Elisp-Programming/Elisp_Programming.html][read online]], [[https://github.com/caiorss/Emacs-Elisp-Programming/blob/master/Elisp_Programming.org][source]]
Very complete and gentle introduction.
Written by [[#caio-rordrigues-caiorss][Caio Rordrigues (@caiorss)]].
*** (Almost) All You Need to Know About Variables
[[https://opensource.com/article/20/3/variables-emacs][read online]]
A must read!
*** elisp-guide
[[https://github.com/chrisdone/elisp-guide][read online]]
Focused on introducing general concepts and terminology.
*** Emergency Elisp
[[http://steve-yegge.blogspot.com/2008/01/emergency-elisp.html][read online]]
Focused around data structures.
More like a cheat sheet.
*** xahlee.info - Practical Emacs Lisp
[[http://xahlee.info/emacs/emacs/elisp.html][read online]], accompagnying [[https://www.youtube.com/@XahLee/streams][youtube live streams]]
One of the first resources on the web introducing Elisp in a concise and comprehensible way.
The website used to be called *ergoemacs*.
Still updated regularly.
Please note that a few more complex examples follow an older coding style: big monolithic functions instead of multiple small functional ones.
*** ElispCheatSheet
[[https://alhassy.github.io/ElispCheatSheet/][read online]], [[https://github.com/alhassy/ElispCheatSheet][source]]
Focused around data structures.
Author's Common Lisp background can be felt.
** Advanced
*** Emacs Lisp Reference Manual
[[https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html][read online]]
Also comes bundled with Emacs.
Just =C-h i= (or =M-x info=) and open =Elisp=.
Comprehensive guide of core Elisp APIs.
Generally well written but needs you to understand its logic and be familiar with Emacs terminology.
*** The Emacs Lisp Style Guide
[[https://github.com/bbatsov/emacs-lisp-style-guide][read online]]
Provides solid guidelines on the dos and don'ts for quality Elisp code.
*** The Emacs Package Developer’s Handbook
[[https://alphapapa.github.io/emacs-package-dev-handbook/][read online]], [[https://github.com/alphapapa/emacs-package-dev-handbook][source]]
[[#alphapapa][@alphapapa]]'s organized notes about Elisp development.
List bunch of tools and libraries for helping package developers.
Also provides various snippets and best practices.
Lots of good insights.
*** nullprogram.com
[[#chris-wellons-skeeto][Chris Wellons (@skeeto)]]'s blog, especially the posts tagged [[https://nullprogram.com/tags/elisp/][#elisp]].
A few highlights:
- [[https://nullprogram.com/blog/2018/02/14/][Options for Structured Data in Emacs Lisp]]
- [[https://nullprogram.com/blog/2010/07/26/][Elisp Memoize]]
- [[https://nullprogram.com/blog/2017/10/27/][Make Flet Great Again]]
- [[https://nullprogram.com/blog/2013/01/22/][The Limits of Emacs Advice]]
- [[https://nullprogram.com/blog/2017/01/30/][How to Write Fast(er) Emacs Lisp]]
*** Emacs Lisp Programming Thoughts
[[https://www.nongnu.org/emacs-tiny-tools/elisp-coding/][read online]]
Pretty old but has very good insights, guidelines and real-world examples.
Byte compiler section is outdated but general coding style recommendations and sections about macros and profiling are still relevant to this day.
** Cookbooks
*** elisp-demos
[[https://github.com/xuchunyang/elisp-demos/blob/master/elisp-demos.org][read online]], [[https://github.com/xuchunyang/elisp-demos][source]]
Very good and beginner-friendly.
Almost complete list of single-liner examples of standard function.
Also packs examples for =dash= and =s=.
*** Emacs In A Box - Elisp Snippets
[[http://caiorss.github.io/Emacs-Elisp-Programming/Elisp_Snippets.html][read online]], [[https://github.com/caiorss/Emacs-Elisp-Programming/blob/master/Elisp_Snippets.org][source]]
Really nice selection of snippets with real-world use-cases.
*** EmacsWiki's Cookbook
[[https://www.emacswiki.org/emacs/ElispCookbook][read online]]
Community-driven snippets, beginner-friendly.
*** @alphapapa's unpackaged.el
[[https://alphapapa.github.io/unpackaged.el/][read online]], [[https://github.com/alphapapa/unpackaged.el][source]]
Real-world selection of snippets, not beginner-friendly.
** On Package Authoring
[[#the-emacs-lisp-styleguide][The Emacs Lisp Style Guide]] applies all the more in this context.
*** Article: Take Your Emacs to the Next Level by Writing Custom Packages
[[https://spin.atomicobject.com/2016/05/27/write-emacs-package/][read online]]
Real world experience of a user writing and submitting his first package.
*** MELPA recommandations
[[https://github.com/melpa/melpa/blob/master/CONTRIBUTING.org#making-your-package-ready-for-inclusion][read online]]
There's a high chance that you'll be uploading your package on [[https://melpa.org/][MELPA]].
They have clear recommandations.
Don't worry, for your first submissions, they will be very comprehensive and will help you fixing what's wrong.
** Contributing to Emacs
The [[https://www.gnu.org/software/emacs/CONTRIBUTE][CONTRIBUTE]] file is the official document describing the process.
Additional development tips and coding conventions can be found in the [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Tips.html#Tips][Elisp Manual]].
=M-x view-emacs-todo= shows a lists of TODO items you might want to work on.
You can also browse the bug archive using =M-x debbugs-gnu= using the [[https://elpa.gnu.org/packages/debbugs.html][debbugs]] package.
[[https://archive.casouri.cat/note/2020/contributing-to-emacs/][Contributing to Emacs]] gives some helpful background information and overview about the contribution workflow for newcomers.
* Development Tools
By default, Emacs is already pretty well set up for Elisp development.
But some features can be hard to learn and some stuff can be improved with additinal packages.
See also those talks [[https://github.com/p3r7/awesome-elisp#john-wiegley-jwiegley][John Wiegley]] gave about his setup for Elisp development:
- [[https://www.youtube.com/watch?v=QFClYrhV1z4][Emacs Lisp Development - @ Emacs Conference 2013]]
- [[https://sachachua.com/blog/2015/04/2015-04-08-emacs-lisp-development-tips-with-john-wiegley/][Emacs Lisp Development Tips - Sacha Chua Emacs Chat 2015-04-08]]
** Interactive Development & Debugging
Emacs is built with interactive development in mind.
You could spend days developing Elisp code without ever having to restart Emacs.
Standard /commands/ used are:
- =eval-last-sexp= (=C-x C-e=)
- =eval-defun= (=C-M-x=)
- =eval-buffer=
- =eval-region=
The =*scratch*= buffer also provides a temporary zone to try and test ideas.
In it can be used =eval-print-last-sexp= (=C-j=) which acts like =eval-last-sexp= but also prints the result after the /s-exp/ in the buffer.
=eval-expression= (=M-:=) allows quickly evaluating a /s-exp/ from anywhere by entering it in the /minibuffer/.
For logging, function =(message "