Development Tips Using Emacs

Isa Mert Gurbuz has an interesting post on some of the editing workflow he’s developed over the years for working with Emacs. The bulk of the post demonstrates some of the glue code he’s developed for working with various packages.

He starts with executing code in a buffer. You might want to execute the last s-expression, a defun that the cursor is in, a region, or even an entire buffer. You can do all that but each of them has a separate command. Gurbuz’s solution is to write a DWIM function that does the right thing depending on context. Nothing too unusual about that but he’s applied a bit of abstraction. The context remains the same for many languages other than Elisp but the particular functions vary. His idea is that his DWIM function doesn’t call any of these functions but returns a function that does. That way, he can supply the appropriate functions to call to his DWIM metafunction and get the actual function to call in return. He binds that directly to a key shortcuts so there’s no reason to even name the resulting function.

Next he considers eros as a way of showing an enhanced view of an expression, again in a DWIM way depending on context. He uses the same trick and metafunction as above to get a function appropriate to the language he’s using.

After that, he considers some functions from other languages like redshank from Common Lisp and clojure-thread-* from clojure-mode. Finally he considers various other supplementary functions and how he integrates them into his workflow to handle things like indentation and formatting. It’s a nice post with some good ideas. Definitely worth a few minutes to read.

This entry was posted in General and tagged . Bookmark the permalink.