Category “Emacs Tips” — 15 articles

Emacs ANSI colors

Emacs comes with a pretty good implementation of a terminal emulator, M-x term. Well not that good actually, but given what I use it for, it’s just what I need. Particulary if you add to that my cssh tool, so that connecting with ssh to a remote host is just a =C-= runs the command cssh-term-remote-open away, and completes on the host name thanks to ~/.ssh/known_hosts. Now, a problem that I still had to solve was the colors used in the terminal.

Emacs Cheat Sheet

I stumbled upon the following cheat sheet for Emacs yesterday, and it’s worth sharing. I already learnt or discovered again some nice default chords, like for example C-x C-o runs the command delete-blank-lines and C-M-o runs the command split-line. I guess I will use the later one a lot. Hope you’ll like it!

Don't be afraid of 'cl

In this blog article, you’re shown a quite long function that loop through your buffers to find out if any of them is associated with a file whose full name includes "projects". Well, you should not be afraid of using cl: (require 'cl) (loop for b being the buffers when (string-match "projects" (or (buffer-file-name b) "")) return t) If you want to collect the list of buffers whose name matches your test, then replace return t by collect b and you’re done.

I’m using Desktop Save Mode so that Emacs knows to open again all the buffers I’ve been using. That goes quite well with how often I start Emacs, that is once a week or once a month. Now, M-x ibuffer last line is as following: 718 buffers 19838205 668 files, 15 processes That means that at startup, Emacs will load that many files. In order not to have to wait until it’s done doing so, I’ve setup things this way:

The major reason why I dislike perl so much, and ruby too, and the thing I’d want different in the Emacs Lisp API so far is how they set developers mind into using regexp. You know the quote, don’t you? Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems. That said, some situations require the use of regexp — or are so much simpler to solve using them than the maintenance hell you’re building here ain’t that big a drag.

Dimitri Fontaine

PostgreSQL Major Contributor

Open Source Software Engineer