Why are you changing gc-cons-threshold?

The basics

The garbage collection in Emacs is very simple. You allocate some bytes and once you pass a certain threshold, it garbage collects. That’s it.

The problem

The default value for gc-cons-threshold is quite low by modern standards – it’s only 800KB. But is that actually a problem? Emacs is known to have poor defaults, but most of the time defaults are chosen because they work most of the time, and something as crucial as gc-cons-threshold was probably chosen with at least some thought. But if that’s the case, then why is everyone (including some popular distributions) increasing the default value?

Read on...
Migrating from Jekyll/Octopress to Hugo

Migrating my blog from Octopress to Hugo has been on my TODO list for a very long time. In fact, the only reason holding me back was lack of pagination support, but that has been implemented for a while now, so I finally got around to migrating my blog over.

Getting started

Since this is an entirely new generator, it made sense to start from scratch. So I created an empty site, copied all the markdown files over, and voila, new blog! But of course, it wasn’t all smooth sailing, and I needed to resolve some issues.

Read on...
Emacs as my <Leader> 1 Year Later

Last year, I wrote a Vim Survival Guide for a Vim user switching to Emacs. In that blog post I wrote:

My Emacs setup right now is still not as efficient as my vim/tmux/zsh setup.

I got an email from someone a couple days ago asking whether that’s still true. Rather than replying to him directly, I figured I should blog about it since it would make for an interesting topic.

Well, it started out pretty simple. I used Vim as my text editor, and after switching, I continued using Emacs as my text editor as well. But as you already know, Emacs is much more than that, and slowly over time, unexpectedly, it took over other parts of my workflow that I thought were untouchable.

Read on...
Asynchronous Eval in Emacs with Stylus and Skewer

You haven’t experienced Emacs if you haven’t experienced the power of C-x C-e. This is the magical keybinding which evalulates the current line. Another useful companion is C-M-x, which evaluates the current function.

Lisp dialects naturally work with these patterns seamlessly, and once I figured out the possibilities of this I got addicted and wanted it available in all of my languages. It’s like having a debugger available all the time. But unlike debuggers where you inspect and change variables at run time, and then need to translate your changes back to code, in Lisp you just edit the code directly and eval (and repeat until you like the result).

Read on...
Emacs as my <Leader> Vim Survival Guide

Two months ago I blogged about switching from Vim to Emacs. Today, Emacs is my main editor. I’ll try to keep this post short and to the point, because there is a lot to cover! But by the end of this post you’ll have to answer to the question whether you should give Emacs a try.

What is a text editor?

If we’re just talking about using Emacs as a text editor, then there is no comparison; Vim beats it, period. But is our job description a text editor? No. We are system administrators, software developers, web designers, etc. A text editor is a tool that we use to do our job (or hobby). And any tool should be replaced when a better option is available.

One simple example is grep. As a developer, you can immediately gain a productivity boost by replacing it with ack or ag. Do they search faster than grep? No. But since they’re so good at ignoring things (like your .git directory) that for practical purposes they end up saving you a lot of time.

As a text editor, I think Emacs is quite terrible. Its key bindings are notoriously bad to the point that something called Emacs pinky exists. If you’re an Emacs user not interested in Vim bindings you should seriously consider taking a look at god-mode or control-mode. But where Emacs really excels is all of the things outside of text editing.

Emacs is a great operating system, if only it had a good text editor.

Well, the nice thing about an operating system is that you can write a text editor for it; that text editor is called evil-mode.

Now, as a text editor, Vim is still better than evil-mode for obvious reasons, so if you’re just swapping it out you’re at a net loss of productivity in terms of text editing. However, what you gain from all of the other things that Emacs can do far outweighs the missing features.

Read on...