One spring evening, after being out of the house for a long time, I stumbled upon the fact that Emacs Lisp programs run like scripts, not just for writing configuration files or plug-ins for the text editor Emacs. This discovery made me feel as if I had stumbled upon a wonderful treasure.
There are a lot of serious books and articles about Lisp’s history and its relationship with Emacs that I don’t need to prove here… No one pays, so there’s no need to add up. Here’s a quick summary of why I think Emacs Lisp programs that run like scripts contain a treasure trove:
- Emacs Lisp has all the elements a general-purpose programming language should have for writing programs that are interpreted to run on a computer.
- Emacs Lisp is a dialect of Lisp that inherits some important features of Lisp, such as Functional Progarmming, which enables syntax extensions based on macros. The difference between Emacs Lisp and the better Lisp dialects 1 doesn’t matter, because knowing Emacs Lisp and learning other better Lisp dialects requires only a few new concepts. Hygienic macros, continuations, etc.
- Programs written in Emacs Lisp are cross-platform. Emacs runs on GNU/Linux, Windows, Mac OS, and FreeBSD, so programs written in Emacs Lisp can usually run on these systems without any problems.
- Emacs Lisp programs can call function 2 in the C library, so their performance bottlenecks can be remedied based on C programs.
- Emacs Lisp has some features that other programming languages may not have, features that come not from the language, but from Emacs itself. Emacs is still by far the best text editor in the world, and it has a long history of text processing wisdom that has been accumulated into a large Emacs Lisp code base. Does this mean that when I write a program in Emacs Lisp that handles text in a particular format, I have a near-infinite supply of code available?
Admittedly, Emacs Lisp has some inherent shortcomings 3. For text-processing tasks, however, Emacs itself is enough to prove that these inherent deficiencies are secondary paradoxes. Emacs Lisp programs that I say run like scripts contain a treasure trove, primarily for writing text processors.
With this in mind, I have made the following small attempts to consume this treasure:
- Hello world!
- Text parsing
- variable
- The iteration
- Text matching
- Buffer transformation
- Command line programming interface
- Text cross – line extraction
- library
- The macro
- Dynamic module
- The rabbit hole
I’m not an Emacs expert, and I’m not a Lisp expert, just someone who wants Emacs Lisp to play some role in life. In this attempt, I, like many others, shortened Emacs Lisp to Elisp to ease the strain on my knuckles a little.
- https://www.emacswiki.org/ema…
- Emacs has supported the loading of dynamic libraries written in C since version 25. ↩
- https://www.emacswiki.org/ema…