emacs X resources

I do most of my Emacs customization in my .emacs file. However, Emacs starts itself and creates an X11 window before it reads the .emacs file. So, customizations that affect the window itself are very expensive, since they’re applied after the window is created.

A few of these customizations include turning the menu bar, toolbar, and scroll bars off, as well as setting custom fonts and colors. Luckily, there’s a much faster way: X resources.

Try for yourself! Here’s the elisp to turn off the menu bar, toolbar, and scroll bars. Put it in your .emacs, and start Emacs.

(menu-bar-mode nil)
(tool-bar-mode nil)
(scroll-bar-mode nil)

Now, take it out, and instead, add these lines to your .Xresources file.

Emacs.menuBar: off
Emacs.verticalScrollBars: off
Emacs.toolBar: off

Run xrdb .Xresources, then try starting Emacs again. It should be much faster!

Emacs obeys many other X resources. For example, I use these to customize the default font and foreground and background colors:

Emacs*font: 7x14
Emacs*foreground: lightgray
Emacs*background: black

Here’s to fast-starting Emacs!

Leave a Reply

Your email address will not be published.