meain/blog

Mar 12, 2023 . 1 min

Releasing scopeline.el

Hey, this is a quick announcement about my new Emacs plugin, scopeline.el. You can find it here.

What is does is something pretty simple, but IMO pretty useful. It shows you what every closing delimiter is actually closing. When you have a large file and you are the end of a function, you might have a lot of closing brackets, one for the function, one for a loop, one for that conditional you started and one for that switch statement. Also, which function is this closing bracket for again? Answers for all of these question is provided by scopeline.el. It uses tree-sitter under the hood to parse the code and figure out what we are looking at and makes use of overlays to display it. It works with elisp-tree-sitter as well as builtin treesit package.

In the below screenshot you can see that we get information about the function nesting that is going on and of that for loop. While it might seem kinda unnecessary in this image, imagine this information when you are not able to see that start of the function. This also comes in really handy for yaml files.

Screenshot of Emacs frame with scopeline.el enabled

You can enable it like blow:

(use-package scopeline
:enable t
:after tree-sitter
:config (add-hook 'tree-sitter-mode-hook #'scopeline-mode)) ; or use :hook

This will set it up, and enable for all modes that tree-sitter is enabled for.

There are few customizations that you can do. Details about that can be found at in the README file.

← Home