Tree-sitter is a general programming language parser that efficiently builds and updates Abstract Syntax Trees (AST) for your code. Basically, it can read programming languages and understand the structure and meaning of code without having to execute it. Among many amazing things, one of its best and simplest features to take advantage of is richer syntax highlighting, which is what I use it for in Emacs. Today I'll show you how to set up emacs-tree-sitter in Doom Emacs1 so you can quickly get prettier code with next to no effort.
Today I'm sharing an interactive function I wrote as an exercise to extract just the inner text content of an Org-mode subtree, excluding the heading itself and any subheadings or their contents. The function adds it to the kill-ring (a.k.a. copies it to the clipboard) and returns it, but can easily be modified to do anything to the contents.
Do you often yourself referring to something in Emacs over and over again, but actually doing work somewhere else? For instance: referring to API code while writing front-end code, or referring to a file while entering commands into a shell? Let's go through the ways I would normally handle this and why I think the
tear-off-window command can help.
I rely on flycheck a lot for giving me hints on type errors when I'm writing TypeScript, but in Doom Emacs the flycheck commands are still bound to
C-c !. Since I don't have flycheck configured to run 'live' on every code change (for performance reasons) I found myself pressing
C-c ! c manually all the time, which became physically painful. But I think I've found a good rebinding that stays in line with the Doom way of doing things.
Array.prototype.reduce(). Today, I'll show you some creative ways to use it that may just inspire you.
It's been more than 5 years since I started writing my UI code in a reactive fashion with ReactiveX. I've used RxJava for Android development, ReactiveUI for Xamarin development, and now I'm using RxJS for Angular development. I stuck with it not because it was easy—it definitely wasn't—but because something about it just felt so right. For the longest time I couldn't explain it, and I'm not even sure I can explain it succinctly now. But today I want to use an example to at least try to illustrate just a touch of the mystery and allure that drew me into Reactive1 Programming in the first place. Let's dive in.
It can be confusing as a new Emacs user. The tutorials that you read online often throw a bunch of obscure command names or long chains of key sequences at you without explaining the why and the how behind the what.
Today I'll outline what I think are the fundamentals for exploring Emacs features. These techniques can be used if you're just messing around in Emacs on your own, but they can even help you understand other Emacs tutorials better. You might consider this a tutorial for how to follow other Emacs tutorials.
One thing sorely lacking in native Emacs is the ability to edit with multiple cursors like VS Code. Fortunately for Doom Emacs or Evil users, there's evil-mc. But even with that installed, all it gives you is a bunch of commands—you still have to decide how to bind them yourself or rely on Doom's suggested bindings that map everything to the
g z prefix for every command.
But I think we can do better. Today, I'm sharing an Emacs hydra that I've been using to power up my evil-mc usage. Just put this anywhere in your
Let's say you're writing a recipe but you want to scale the ingredients down by one third. The recipe calls for 280g of flour. And you want to round to the nearest 10g.
I applaud you if you can easily do that in your head—because I certainly can't. Also yes, it would be easy just to run your system's calculator app to get the answer, but why leave Emacs if you can help it? Doing it this way also saves you a bunch of manual copying and pasting.
Simple HTML and CSS is all you need for a basic signal indicator icon. CSS flexbox makes it easy to space the bars evenly apart from each other and sink them to the bottom. After that, some
strong classes and creative use of the
:nth-child() selector lets us tweak the size and emphasis of the signal bars. Take a look!
Earlier this week I went looking for "how to search and replace in a whole project" in Emacs. I knew had Doom Emacs set up with evil turned on by default, and I knew to use
SPC s p to launch Ivy's counsel-rg for searching the project. What was next…?
You may have heard that there are fonts1 designed specifically for programming work, especially ones that use programming ligatures. If you haven't heard—and you cut code—then you're in for a treat today! And if you're already in the loop, maybe you'll find a new favorite font to spruce up your code. Today, I'll explain why I chose JetBrains Mono for my own programming needs, and along the way I'll outline all the programming fonts I've come across so far.
A cute little map marker happens to be one of the things you can easily create with pure CSS without too much sorcery. All it takes is a div with 3 rounded corners, some
transform rotation, and (optionally) a matching pair of
:after CSS pseudo-elements to dress it up.
I use Emacs under WSL2 to take advantage of better performance compared to running it natively on Windows, but out of the box the browser integration doesn't work well. By default Emacs will try to open the browser installed within WSL, and since most people won't have one, Emacs will throw its hands in the air and give up.
I'm sharing a simple function to copy/kill/yank the URL of an Org-mode link at the cursor/point within Emacs. It handles plain URLs too: ones that don't have the square bracket delimiters or a description.
Allegedly a botched Windows update resets the dynamic TCP port range in some cases. When this happens, Hyper-V ends up aggressively reserving it for its own Windows Container Host Networking Service (HNS). The end result for me? I've occasionally been unable to connect to my Angular app running on port 4200 within WSL2.