11

I'm trying to get familiar with Emacs Lisp, its syntax, data structures etc, so I was wondering what are some built-in packages whose source could help me better understand how to use the language and learn its idioms?

closed as primarily opinion-based by Fanael, T. Verron, terdon, nicael, Gilles Sep 26 '14 at 0:09

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Be aware that the built-in packages are full of legacy code and therefore less suitable for learning idioms. Have you considered using external packages and libraries instead? – wasamasa Sep 24 '14 at 9:27
  • 1
    Have you considered using the emacs tutorial (available as info file ? Some built-in functions are explained and detailed. – kiddouk Sep 24 '14 at 9:48
  • @wasamasa I see, I will look at more recent packages. – caisah Sep 24 '14 at 11:14
  • @kiddouk Yes I did but I can't cope with the writing/explaining style. – caisah Sep 24 '14 at 11:15
12

I can recommend Ruby Mode in ruby-mode.el and Python Mode in python.el, for some aspects of their implementation. The former is a particularly great source for advanced indentation and navigation code based on the new SMIE engine. However, neither uses data structures in any particularly clever or advanced way.

I would also recommend some parts of Org Mode 8, for its design. Notably the exporter framework of Org 8 shows how to create an generic, extensible, object-like framework in plain Emacs Lisp. However, I'd recommend against most other parts of Org, for reasons already stated in comments: It's old, and full of legacy and harmful practices (e.g. find-file-noselect to read files non-interactively).

Gnus is also said to have good code, but again I'd be careful to determine how well-maintained the particular piece of code is that you are looking at.

Since Emacs itself is very old, and only superficially maintained in many places, the average quality of its code is actually rather low by modern standards. There's many legacy stuff in there. For instance, even in core parts such as the byte compiler you'll find “TODO”s and “DUNNO”s dating back years, if not decades. Also, since Emacs is very slow to take code and developers from the “outside” community due to the restrictive policies established by the FSF, the overall quality increases only slowly.

All in all, you are more likely to find good code in popular 3rd party packages maintained by high-profile community members, e.g. Magit, Projectile, etc.

  • 2
    Oh I see, they changed it for the latest trunk. – shosti Sep 24 '14 at 15:38
  • 3
    Those planning on taking a dive into gnus' code: Please do take care. Those are deep waters and we wouldn't want to loose anyone. – Malabarba Sep 25 '14 at 13:27
  • 2
    If you look at Magit then I recommend looking at its next branch. – tarsius Sep 25 '14 at 13:38
  • 2
    Do you have anything to backup your last claim? I would strongly expect the opposite... – rasmus Nov 19 '14 at 23:32
  • 1
    What I had in mind was: "[...] Emacs is [...] superficially maintained in many places, the average quality of its code is actually rather low" versus "you are more likely to find good code in popular 3rd party packages". But "Emacs is very slow to take code and developers from the “outside”" also seems like nonsense IMO (do you read the debbugs?)... – rasmus Nov 20 '14 at 0:42
1

For basic idioms look into simple.el

Not the answer you're looking for? Browse other questions tagged or ask your own question.