One of the things I like most in CIDER is how evaluation results are displayed
by inline overlays. And yet, for some reason, it’s taken me almost a year to
transfer that to Elisp.
It’s the tiniest of changes — you’re just taking something that would be
displayed in the minibuffer and moving it up a dozen or so lines — but the
difference is palpable. By displaying the result inline, you display it where
the user is looking, instead of forcing them to shift focus. The quick-feedback
loop we all love in our lisps becomes even faster (something I would’ve thought
impossible one year ago).
Assuming you already have CIDER installed, porting this feature to Elisp is
almost trivial. We just define a small wrapper around the function that creates
the overlay, and then advise the relevant elisp commands to call it.
If I like this enough, I might implement it more properly and propose its
addition to Emacs core. For now the advices are more than enough.
If you don’t want to install CIDER, you can just copy that function to your
configs (you’ll also have to copy the functions above it in the same file, and
the when-let definition from cider-compat.el).
Eval-result-overlays in Emacs-lisp
29 Mar 2016, by Artur Malabarba.One of the things I like most in CIDER is how evaluation results are displayed by inline overlays. And yet, for some reason, it’s taken me almost a year to transfer that to Elisp.
It’s the tiniest of changes — you’re just taking something that would be displayed in the minibuffer and moving it up a dozen or so lines — but the difference is palpable. By displaying the result inline, you display it where the user is looking, instead of forcing them to shift focus. The quick-feedback loop we all love in our lisps becomes even faster (something I would’ve thought impossible one year ago).
Assuming you already have CIDER installed, porting this feature to Elisp is almost trivial. We just define a small wrapper around the function that creates the overlay, and then advise the relevant elisp commands to call it.
If I like this enough, I might implement it more properly and propose its addition to Emacs core. For now the advices are more than enough.
If you don’t want to install CIDER, you can just copy that function to your configs (you’ll also have to copy the functions above it in the same file, and the
when-let
definition fromcider-compat.el
).Tags: lisp, programming, init.el, emacs,
Running Emacs on Android »
« Leave the cursor at start of match after isearch
Related Posts
Turbo up your Ruby console in Emacs in programming
A few paredit keys that take over the world in programming
Restarting the compilation buffer in comint-mode in programming
Content © 2019, All rights reserved. Icons under CC3.0.