RSSAmplifier

Blog

Andrey Listopadov

Posts from the 'emacs' category by Andrey Listopadov

andreyor.stRSS feed ↗28 posts

Latest posts

Dynamic font-lock for Fennel

I’ve been working on adding a dynamic font-locking for fennel-mode for a while now. The first attempt started years ago, in July 2022, and were quite crude. It consisted of sending a special code to the REPL that would return me a list of macro names, and then I created a regular expression that matched all these names for syntax highlighting. This had several problems. First, this meant…

Extending Emacs with Fennel

After watching this year’s EmacsConf and seeing Guile Emacs being resurrected I thought to myself - why limit ourselves to Guile? Sure, Guile isn’t just a Scheme implementation, thanks to its compiler-tower-based design. Other languages exist for Guile VM, such as Emacs Lisp, and Guile manual lists the following languages with various stages of completeness: ECMAScript Brainfuck Lua…

Accepting your own solutions to your own problems

There was a weird thought going over and over in my head, regarding my Emacs configuration, and it extends to the other projects I do both at home and at work. You see, my configuration is riddled with custom code, and up until recently I had mixed feelings about that. For example, I have a custom piece of code to automatically switch themes, based on the dark mode setting in my desktop…

Overcolorization

Tree-sitter became more widespread and Emacs took notice and included a bunch of <lang>-ts-mode as alternatives to <lang>-mode into the core. This is good news and a welcome change, but I have some concerns about the approach. When I first saw the Tree-sitter talk by Max Brunsfeld I was concerned that the language highlighting &ldquo;fix&rdquo; they&rsquo;re talking about is too much. Here are the…

You don&#39;t need a terminal emulator

…if you&rsquo;re an Emacs user, that is. You know, it&rsquo;s funny, because people have opinions on why you don&rsquo;t need a terminal on entirely different ends of a spectrum. It&rsquo;s like that IQ chart meme: Figure 1: *That&rsquo;s Visual Studio on the left, not VS Code And yes, I know, there are many people who will disagree with me, probably on everything that I&rsquo;m going to say next.…

Compiling Clojure projects in Emacs - Jumping into dependencies

In the previous post on the subject I&rsquo;ve described how one can create a custom compilation mode for any language. In the Dynamically extracting filenames from compiler output section I&rsquo;m talking about various issues with how Clojure reports problem locations. The main problem is when the problem is inside of a dependency, and be it your own library, or a third-party one it&rsquo;s…

Why Kakoune

Recently I&rsquo;ve stumbled upon a video about Kakoune, a code editor: Idiot user tries to use Kakoune (for notes? Also Helix?) . Funnily enough, I was mentioned in this video, which was a surprise, and made me laugh for quite a while: Let&rsquo;s go back to the official plugins page. This guy has made a bunch of plugins. Who is he? How is he able to make such good use of Kakoune? Oh, he&rsquo;s…

Migrating from LSP-Mode to Eglot

Recently, I decided to try the now inbuilt LSP client called Eglot . I&rsquo;ve been using the lsp-mode package for some years and while I don&rsquo;t have any problems with it, I decided to try the in-house solution. Though, I already tried Eglot in the past, and it didn&rsquo;t work for me, due to some complications with the language I&rsquo;ve tried to use it with. At the time it didn&rsquo;t…

Emacs GUI library

Lately, my Magit buffer broke once again because of something weird going on with major mode, and I couldn&rsquo;t stash or commit hunks unless the point was at the beginning of the line. That once again reminded me that Emacs UI is not really a UI, all of it is mere text with a bunch of properties slapped on top. It&rsquo;s easy to forget about it, and use such things like Treemacs, Customize,…

The key point of Emacs

Lately, I&rsquo;ve been reflecting on why I&rsquo;ve settled with Emacs of all other text editors. You may remember my old post where I go into lots of different code editors, and I list Emacs among them too. That post itself was written in Emacs, like everything else in this blog, but I can&rsquo;t say that I understood the main point of Emacs back then. Err, I don&rsquo;t think I do now, hence…

New Fennel Proto REPL and call for testing

In the previous post I&rsquo;ve described how to define a simple protocol, upgrade the stock Fennel REPL with it, and create a simple client that works with this setup. And at the end, I mentioned that I was working on a proper client implementation and a more robust protocol as part of the fennel-mode package. So today I&rsquo;m presenting the new fennel-proto-repl module! It&rsquo;s an…

Implementing a protocol-based Fennel REPL and Emacs client

Recently I read a post by @nikitonsky about writing a custom REPL for Clojure and Sublime Text . What got my attention was a way of implementing a protocol over a plain Clojure REPL. In the post, Nikita describes a way to &ldquo;upgrade&rdquo; the connection by sending code that basically implements a new REPL to the main REPL process. I liked the idea and decided that two can play this game, and…

Ad-hoc async in emacs-lisp via generators

TIL that Emacs Lisp has had generators since 2016, and generators are a cool feature in any language in my opinion! In short, Emacs has the generator.el package as it&rsquo;s part since version 25.1. The generators are implemented via transforming code and act like iterators, even most of the functions are called iter-something . Thus we can&rsquo;t cross iterator boundaries without creating…

Region bindings and common lisp modes

I&rsquo;ve published two new packages for Emacs: - region-bindings.el and common-lisp-modes.el . Both are quite small and were a part of my configuration for a long time, but after small refactoring of my init.el I&rsquo;ve decided to extract them. The first one, region-bindings is a from-scratch re-implementation of region-bindings-mode . This project had not seen development since 2014, and I…

Compiling Clojure projects in Emacs

Another post in the not-so-series about Emacs configuration. Today I will describe my configuration for managing the compilation-error-regexp-alist variable in a way that is meaningful for the current project I&rsquo;m working on. Some time ago I faced a problem that the compilation-error-regexp-alist variable contains far too many entries for different languages by default. Since then, I&rsquo;ve…

Emacs Lisp shorthands as namespacing system

In Emacs version 28 Emacs developers introduced so-called read symbol shorthands. If you&rsquo;re interested in the rationale, feel free to search the Emacs developer mailing list for the discussion. However, it does seem that not everyone likes the idea of shorthands as a substitution for namespaces (or packages, if you&rsquo;re coming from Common Lisp). Neither did I. And recently, a branch was…

My blogging setup with Emacs and Org Mode

Or &ldquo;when you don&rsquo;t have topics to write about, write about how you do your writing&rdquo;. Ahem. I like my blog workflow, it makes me want to return to writing more often, and because of this, I capture way more thoughts than I would usually do if I didn&rsquo;t have a blog. However, there are a lot of ways to set up a blog, and when I was starting I was overwhelmed with options. There…

Reproducible Research with Org Mode, Fennel, and LÖVE

Today I would like to talk about three separate tools, and how we can combine them with the power of Emacs. Our tools for today are: Fennel - a Lisp-like surface syntax for Lua that makes programming in Lua fun and more robust. Org Mode - a markup language and an application inside Emacs, which allows its users to create documents that include interactive pieces of code. LÖVE - a game engine that…

Limiting Horizontal Scroll In Emacs

I use Emacs mainly for programming, but I also write a lot of non-code in it, either for this blog, documentation for my projects, or just when I take notes. And I do it with a git-friendly style of formatting with a single sentence per line. And because of that, I enable line truncation, to avoid wrapping text, because when the text is written this way, the wrapped version looks like a mess, in…

Project.el enhancements

After publishing the last post I thought why won&rsquo;t I post such things here occasionally? I have a few pieces of Emacs Lisp in my configuration that I wrote for myself some time ago to fix some annoyances or improve a certain workflow. Previously I&rsquo;ve used a literate approach for my Emacs configuration which listed all these notes, but it was tedious to maintain, so I&rsquo;ve opted out…

Automatic refreshing of package archives for Emacs

I was going through my git commit history in my public dotfiles repository and noticed that prior to using straight.el I&rsquo;ve, like many, used an inbuilt solution for managing packages, called package.el . However, there was one thing that bothered me, and one of the reasons that made me think about switching to straight was the fact, that a lot of times when I wanted to update or install…

What if structural editing was a mistake?

Not so long ago I&rsquo;ve written about Paredit and its quirks . I&rsquo;ve been happily using Smartparens ever since that post, but something still bugged me. I was constantly thinking about the fact that Smartparens has numerous quirks in various languages and some known bugs that are unlikely to be fixed in the foreseeable future, given that the main maintainer doesn&rsquo;t have a lot of…

Why is Paredit is so un-Emacsy?

Here&rsquo;s a quick rant, kinda. I&rsquo;ve become a huge fan of structural editing recently. My structural editing journey was maybe a bit unusual, but I&rsquo;ve finally settled on Smartparens for quite some time. Originally I was introduced to structural editing by Parinfer mode which had some Paredit functionality, so it got me interested. Then I have been using Parinfer-rust for some time,…

Programming ligatures in Emacs

For a long time, I was a fan of Hack font . It has really nice language support, great readability at a size of 9pt, and zero with a dot. I love it when zero comes with a dot . Many fonts use zero with a line, to differentiate it from capital O , but on small sizes, it is not great, however, a dot looks fine when both small and big. But one thing was lacking from Hack, and it is ligature support.…

Using a single Emacs instance to edit files

Modern text editors usually operate in one instance. When I select some advanced text editor as my preferred editor in the system, I expect this to happen: I click on some files in the file manager; If there&rsquo;s no editor instance opened, a new instance opens with the file ready to edit; If there is an instance of an editor opened somewhere, a file is being opened in it, and the editor is…

Making Emacs tabs look like in Atom

This is yet another follow-up post in the Emacs configuration series, which is also about Tabs. The previous post was about how tabs behave when you close them, and how I think the algorithm can be improved. This post is more about visuals and horizontal space management. By default tabs in Emacs are named after their respective buffers. This is how tabs look with my configurations and default…

Making Emacs tabs work like in Atom

Another little piece from my Emacs config that I&rsquo;ve decided to turn into a small post, following up on previous one . This time, we&rsquo;re going to make tabs work as in most graphical editors. Tabs were added with global-tab-line-mode in Emacs 27, and are pretty simple tabs, that are being displayed on the top of a window, and by default, their semantics are not very useful in my opinion.…

Dynamic title for Treemacs workspace

Thought that I can share snippets of my Emacs config from time to time here, just like @clemera does on with-emacs.com . I highly recommend you to check it out, there are many great recipes and articles. A while ago I&rsquo;ve added static Treemacs title to Treemacs buffer for aesthetic purposes - it adds good alignment with tabs in other windows. But recently I&rsquo;ve thought that it could also…