Emacs Prelude Gets a User Manual

This is going to be a really short post.

For ages I’ve planned to create a user manual for Emacs Prelude, but I never got to doing so. Writing a good manual is a huge amount of work and I was wary (and lazy) to commit to doing it. Today I realized that probably having some manual (even if it’s not good) beats having no manual, so I quickly sliced and diced the old huge README of the project, and compiled it together into this proto-manual.

I’ll try to find some time to improve it, but I can make no promises. You can certainly help me out by working on the manual yourselves, though. Prelude is pretty simple, so I assume that everyone, who has spent a bit of time using it, is more than qualified to work on improving its documentation. By the way, the manual features a dedicated section for working on the manual! Coincidence? I don’t think so.

Keep hacking!

The Emacs Year in Review

This post is a brief summary of the past year for Emacs from my perspective.

Emacs 26.1

Probably the biggest news of the year was the release of Emacs 26.1. The highlights of the release were:

  • Limited form of concurrency with Lisp threads
  • Support for optional display of line numbers in the buffer
  • Emacs now uses double buffering to reduce flicker on the X Window System
  • Flymake has been completely redesigned
  • TRAMP has a new connection method for Google Drive
  • New single-line horizontal scrolling mode
  • A systemd user unit file is provided
  • Support for 24-bit colors on capable text terminals

Frankly, for me that release was a bit underwhelming as I won’t see much improvement in my day-to-day use of Emacs. I’m on macOS, I don’t use Flymake, I don’t use TRAMP, I don’t like seeing line numbers and I don’t use Emacs in terminal mode. What a bummer, right?

I’m excited that we finally got some limited form of concurrency, though. Probably this is going to become important in a few years, as Emacs packages start adopting it. There are also plenty of other small and very useful improvements in this release. Mickey (from “Mastering Emacs”) goes over the release notes here in greater detail. Maybe I’ll do something similar in the future if I ever find the time for it.

My Emacs Packages

It was a super busy year at work for me, but still I got to release new versions of most of my Emacs Packages. I’m really proud of releasing several big CIDER updates, and of Projectile making it to version 1.0 (and recently 2.0)! By the way - this was the first of my bigger projects that made it to 1.0!

Things were quieter on the Prelude front, but I think it’s pretty good, useful and stable in its current form. With everyone these days trying to pile every possible feature and package in an Emacs distribution, one has to appreciate the tenets of Prelude’s philosophy:

  • simple
  • easy to understand and extend
  • a foundation for you to build upon, as opposed to some end-user product

Probably I should expand on this down the road as well…

Overall, I’ve gotten to a point where I don’t have time to properly maintain all of my projects and it seems that I’ll have to focus on fewer of them in the future and solicit help from other people for the packages I can’t find enough time for.

Emacs Redux

I didn’t write much here last year, but at least I managed to overhaul the blog’s visuals and simplify its setup. Moving from Octopress to Jekyll really simplified things and I hope this will result in more articles down the road.

I’ve also started a new personal blog - Meta Redux. You’re more than welcome to check it out!

Emacs Packages

I don’t recall many new Emacs packages that made the news in 2018. I think I was most excited about ELSA - a brand new Emacs Lisp Static Analyzer. I’ve also noticed that many people were excited about LSP in Emacs and the older lsp-mode got some competition in the face of eglot. As all of the programming I do these days is in Emacs Lisp or Clojure, I don’t really need LSP (generally LSP makes little sense for REPL-driven programming), but it’s great that things are making headway there.

Many of the great Emacs packages became even greater this year - e.g. Magit, company-mode, avy, ivy, etc.

I didn’t pick up many new (for me) packages this year. I can think only of:

  • After many years of using ido I migrated to ivy and I’m super happy with it
  • I’d dropped my custom comment annotations highlighting code in favour of hl-todo
  • I’ve rediscovered easy-kill
  • I’ve discovered how awesome AsciiDoc is (so much better than Markdown for writing technical documentation!!!) and I’ve started using adoc-mode. Unfortunately it’s somewhat buggy and incomplete, and it hasn’t seen a commit in 3 years. It’d be great if we had a better AsciiDoc mode for Emacs!

I’ll also add a shoutout here for Buttercup - the best testing library Emacs has to offer today! It’s so much better and easier to use than ERT, that I’m shocked so few people have discovered it yet. It definitely deserves a blog post or two!

As usual the packages I relied on the most this year were my own Projectile and crux.

My color theme is forever Zenburn. I’ve used it for over a decade and I still can’t find an alternative so appealing that it would make me switch!

MELPA

MELPA really crushed it this year and solidified its position as the only package.el repo that really matters. At this point it’s like homebrew for macOS - it has alternatives, but pretty relatively few people are using them. I’m happy about the consolidation of the package repo scene, but I’m a bit worried that still most people are installing snapshots instead of stable package releases.

Of course, that’s on MELPA - it’s on package maintainers who have adopt a more disciplined approach to releases.

Misc

I really loved reading “The Evolution of Emacs Lisp” paper by Emacs’s former head maintainer Stefan Monnier and Michael Sperber. I’ve been using Emacs for 15 year now and I still learned a lot of new things about the history of the language and the rationale behind certain design decisions. It was also a bit depressing to see how long certain features were being developed without ever making it to a stable Emacs release, but it is what it is…

As usual, throughout the year my best source of Emacs news and updates was Emacs News by Sacha Chua. I can’t recommend it highly enough!

Looking Forward

Frankly, there’s nothing big I’m looking forward to in 2019. I’d love for Emacs to finally start better supporting operating systems like Windows and macOS, but I know that’s a pipe dream at this point. Still, the need for something like an Emacs Mac Port to exist makes me sad. Users of all operating systems should get a great user experience, regardless of whether their OS is free or proprietary.

I do hope that more of the packages bundled with Emacs today would be moved to GNU ELPA, so they can be released separately and more frequently. Emacs’s core should become smaller IMO and the big focus of the Core Team should be improving the basic editing experience, UI and the core API libraries. And, of course, Emacs Lisp itself. I really don’t think that Emacs will ever replace Emacs Lisp with Common Lisp or Scheme (Guile), so we’d better develop a better version of Emacs Lisp instead.

By the way, I think it might be nice if the Emacs Team started running some annual “State of Emacs” survey similar in spirit to say to the “State of Clojure” survey. The results of such a survey can help the Emacs Team decide where to focus their efforts. They’d also be a great gauge of the progress Emacs is making towards solving the problems its users are facing and providing the functionality they need.

On a personal note I hope that I’ll write a few more articles here in 2019 and that I’ll manage to get CIDER to the coveted 1.0 release and Projectile to the next level. I’m also planning to work a bit on project.el, so it’d play nicer with Projectile and provide a better foundation for tools like Projectile.

I also have some vary vague plans to work on improving erlang-mode, take a stab at creating a new asciidoc-mode and maybe play a bit with Haskell-related packages (if I finally manage to learn Haskell that is). Time will tell whether any of this is going to happen.

I’m try to be more active here, but I’m not making any promises. The last couple of years really drained me and as much I’d love to work on many things it would probably be best for me not to work on anything at all.

Closing Thoughts

So, that was Emacs’s 2018 from my perspective. What about yours?

I’d really love to hear what were the Emacs highlights of the year from your perspective. Please, share in the comments what were you most excited about in 2018 and what are you looking forward to in the future.

Emacs had another great year and it’s all because of you - the great community around it! In M-x we trust!

Convert a Keyword to a Symbol

Recently I needed to convert keywords into symbols in Emacs Lisp and I noticed there was no built-in function for this, so I’ve decided to build one myself. Here’s my approach:

(defun keyword-to-symbol (keyword)
  "Convert KEYWORD to symbol."
  (intern (substring (symbol-name keyword) 1)))

(keyword-to-symbol :foo) ; => 'foo

It’s extremely simple really - using the fact that keywords in Emacs Lisp are actually symbols we can convert them to a string with symbol-name, drop their leading : and then convert them back to symbols.

For me the most interesting thing here was learning that keywords are symbols:

(symbolp :foo) ; => t

This was certainly a surprise the first time I saw it, although it does make sense. That prompted me to check how are keywords differentiated from symbols and I found the answer in the documentation of keywordp:

keywordp is a built-in function in ‘C source code’.

(keywordp OBJECT)

Return t if OBJECT is a keyword.
This means that it is a symbol with a print name beginning with ‘:’
interned in the initial obarray.

While I doubt that you’ll often (ever?) have to deal with keyword to symbol conversion I hope you’ve learned something fun and useful today! Keep hacking!

The Perfect Domain for Emacs Projects

Recently I’ve been working on documentation sites for a couple of my more prominent Emacs packages - CIDER and Projectile. When I got to the point where I needed to register some domains for the sites I realized that picking the right domain is just as hard as naming things.1

Most open-source projects typically have .org domains and you’d see here and there the use of .net or (more recently) .io. Those are all great domain options, but they have one slight problem - because they’re super popular there aren’t that many free names to choose from if you decide to use them. That would have forced me to go with domains like emacscider.org or emacsprojectile.org, which are OK, but nothing more. I don’t know about you, but I really hate prefixing domain names!

After struggling with this for a while an unexpected solution presented itself to me. I was on a short business trip to Mexico and I noticed that the country’s top-level domain is .mx. .mx just like in M-x, Emacs’s most iconic keybinding!2 Needless to say I immediately registered cider.mx and projectile.mx. Such a perfect fit!

I think that every Emacs projects deserves a Meta-X domain, so get one for your project right away, while there are still plenty of free names to choose from!

  1. OK, nothing is quite as hard as naming, but that’s pretty close. 

  2. One can also argue that M-x sounds a lot like Emacs. I’m reasonably sure the choice of M-x was not accidental. 

Eldoc Goes Global

I recently noticed that Emacs 25.1 had added a global variant of the popular eldoc-mode, called global-eldoc-mode. What’s more - unlike eldoc-mode, global-eldoc-mode is enabled by default!

This means that you can get rid of all the code in your Emacs config that was wiring up eldoc-mode for major modes that support it:

;; That code is now redundant
(add-hook 'emacs-lisp-mode-hook #'eldoc-mode)
(add-hook 'ielm-mode-hook #'eldoc-mode)
(add-hook 'cider-mode-hook #'eldoc-mode)
(add-hook 'cider-repl-mode-hook #'eldoc-mode)

There are some reports that global-eldoc-mode is causing performance issues in modes that don’t support it. I’ve never experienced this myself, but if you want to disable it you can simply do so like this:

(global-eldoc-mode -1)

Now it’s time to clean up my config! Deleting code always feels so good!