Endless Parentheses

Ramblings on productivity and technical subjects.

profile for Malabarba on Stack Exchange

Nameless, less is more

Nameless is an Emacs package for hiding namespace prefixes in elisp code. It is a short and simple minor-mode that changes the display, without changing the contents of the buffer. Using it is as simple as turning it on, there’s no need to change your package in any way.

nameless-on.png

Nine months ago I introduced Names, a package that allows you to write elisp code inside a namespace. Since then, I’ve used it on two of my packages without issues (as have several other Emacs hackers) and it’s been delightful. I’ve been hacking elisp for several years now, but stripping away all those namespace prefixes really makes it more pleasurable to write and read code.

Still, there’s no denying that it’s a bit heavy-handed. It’s quite a large library that your package has to depend on, and it changes the way you write the file itself, which means it messes with anything from grep to find-function. Nameless, on the other hand, hooks onto font-lock-mode and changes the way symbols are displayed. This means it doesn’t interfere with any other tools you might use for code management or navigation. At the end of the day, it tries a lot less and therefore does a lot more.

Nameless is available from GNU Elpa. To give it a try, just M-x package-install it, and turn on the minor-mode wherever you want.

(add-hook 'emacs-lisp-mode-hook
          #'nameless-mode-from-hook)
(setq nameless-global-aliases
      '(("fl" . "font-lock")
        ("s" . "seq")
        ("me" . "macroexp")
        ("c" . "cider")
        ("q" . "queue")))

See the Readme for more information.

comments powered by Disqus