Will there be another Emacs?
If you had spoken with me at least once, chances are that you would’ve heard of an ‘Emacs’.1
On surface it looks like a text editor, but beneath it is a full layer of an Lisp Interpreter. It may not appear impressive until you realise what it actually means:
You are given the freedom to modify the very environment that you currently use. This means that you could inspect and override every single function and modify the core behaviour at runtime, without the need to ‘restart’ or compile it again.
And Lisp (not to be confused with LISP) languages are very intuitive that anyone can start hacking on it. That was the case for me too, when I was 14. It was the best way for me to get into programming and the enthusiasm I had back then still lives on.
My .emacs.d directory has now exceeded over 10k SLOC:
~
❯ sloc --format=summary ~/.emacs.d/*.el ~/.emacs.d/lisp/*.el ~/.emacs.d/site-lisp/chizu/*.el
│ Language │ Files │ % │ Code │ % │ Comment │ % │
├─────────────┼───────┼───────┼───────┼──────┼─────────┼──────┤
│ EmacsLisp │ 46 │ 98.2 │ 10122 │ 60.6 │ 2051 │ 12.3 │
│ Markdown │ 1 │ 1.8 │ 0 │ 0.0 │ 128 │ 35.8 │
├─────────────┼───────┼───────┼───────┼──────┼─────────┼──────┤
│ Sum │ 47 │ 100.0 │ 10122 │ 59.3 │ 2179 │ 12.8 │
└─────────────┴───────┴───────┴───────┴──────┴─────────┴──────┘
This is excluding the hundreds of community packages I’ve installed, almost all of which comes from other users like me. So many useful packages that you couldn’t have imagined yourself: magit, yasnippet, and much more.
It may not be impressive in the era of fancy IDEs and LLMs that do the job for you, but that totally misses the point: it is not about what it does, more about how it does things that would’ve otherwise been tedious and frustruating.
This blog used to be ran on a handwritten static-site generator before I switched to Jekyll later. I was so impressed that the program even worked, given how inexperienced in programming I was back then. That didn’t matter however, as long as it just worked:
(defun add-entries-to-archive ()
(with-current-buffer (find-file-noselect "/home/vetrivln/Downloads/public_html/archives.html")
(goto-char (point-min))
(search-forward-regexp "<ul>")
(delete-region (point) (- (search-forward-regexp "</ul>") 6))
(goto-char (- (point) 6))
(dolist (file (reverse (directory-files "~/Downloads/public_html/articles/" t "^[^_].*.org$" nil)))
(let ((date (substring file 42 52))
(file-name (substring file 42 -4))
(title (progn
(with-current-buffer (find-file-noselect file)
(goto-char (point-min))
(buffer-substring-no-properties 10 (line-end-position))))))
(insert (format "\n<li><div class=\"date\">%s  </div><a href=\"articles/%s.html\"><div class=\"title\">%s</div></a></li>\n" date file-name title))
(search-forward-regexp "</ul>")
(goto-char (- (point) 6))
(save-buffer)))))
In hindsight this was not the best way to do it, but that does not matter.
Here’s another function that I wrote for an EPUB reading mode, to select one from the many words displayed, query the internet for its meaning and return only the definition from the page retrieved:
(defun find-dict-meaning (word)
"Query Merriam Webster for the definition of WORD."
(interactive
(list
(cond ((use-region-p)
(buffer-substring-no-properties (region-beginning) (region-end)))
(current-prefix-arg
(or (thing-at-point 'word t) ;(read-string "word: " (thing-at-point 'word t)))
(error "No word to query"))
((save-window-excursion
(call-interactively #'avy-goto-word-1)
(thing-at-point 'symbol t))))))
(url-retrieve
(concat "https://www.merriam-webster.com/dictionary/"
(url-hexify-string word))
(lambda (status)
(unwind-protect nil
(progn
(when-let (err (plist-get status :error))
(user-error "Failed to query Merriam Webster: %S %s" err word))
(goto-char (point-min))
(forward-paragraph) ;skip the HTTP header
(let* ((dom (libxml-parse-html-region (point) (point-max)))
(text (dom-strings (dom-by-class dom "dtText"))))
(setq text (mapconcat #'(lambda (text) (propertize text 'face 'italic))
(nbutlast (cl-remove-duplicates (append text '(": ")) :test 'string=))
" or "))
(message "%s: %s" word (string-clean-whitespace text))))
(kill-buffer)))))
My .emacs.d directory is a graveyard of hundred other procedures, that once
served a purpose and strangely reminds me of a time, when I did not have
possesion of the many tools that are now available at my disposal, but had a
curiousity and enthusiasm of a much stronger magnitude that what I currently
possess.
It feels wrong to be nostalgic about something as living as Emacs: surely there should be an active community right now as there was back then. There’s no way I’d know that right now, especially when I haven’t logged in on IRC for years now.