I was recently asked what was the best way to sum up an array of arrays of numbers. While I'm not the best code golfer, I am rather lazy, so I do have some terse solutions up my sleeve.
Sometimes a list of things is too large and it needs to be split into batches before it can be processed effectively. A quick google didn't reveal any quick copy-pastable elisp (a.k.a. Emacs Lisp) functions that did this kind of batching, so I cobbled together what I found and came up with this
cl-loop implementation, which is hopefully performant.
evil-mc is great for working with multiple cursors and smartparens is great for working with lispy s-expressions. But can they work nicely together without putting in a lot of effort writing glue between the two? Read on to find out.
"Convoluting a lisp s-expression" sounds like computer science ivory tower bollocks, but after I actually learned what it was and how to use it, I'm seeing it pop up quite regularly when writing lisp. Let me show you the magic; I promise every time you get to use it, you'll feel like a king!
If you use both emacs-emojify and selectrum and you're having trouble getting emoji to show up properly in the list of completion candidates, especially after the latest round of selectrum updates (commit 21cee86) then I have an elisp configuration snippet that may help you. Read on to see it.
It turns out that writing in proper title case can be important for a front-end developer, since there are often things on screen that need to appear as a title to convey importance: dialog headers, menu items, buttons labels, to name a few.
The problem is I had always dismissed it as something for school, academics or "real" writers, so I never bothered to learn the rules properly. This meant many distracting trips to https://titlecase.com/. Realising this, I used Emacs to make a quick way to convert something to title case without relying on my brain. This post is my journey on how I wrote that thing.
I've found that Microsoft's Azure AD MSAL Extensions for .NET don't seem to work very well under WSL2. In particular, there is this this issue that's reportedly been fixed as of November 2020 but, even with Azure.Identity v1.3.0, it remains a problem for me. The error can look something like
value cannot be null: attributeValue1 or
Unable to load shared library 'libsecret-1.so.0'.
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.