Emulating The Terminal Emulators For Fun (with emacs color-theme)

I have a small laptop that I carry to the coffee shop for writing. It is a bit shaky in the hardware department, very small, and has no functioning wireless. The hard drive is encrypted. These attributes together make it the perfect laptop to carry around between, say, the gym, the coffee shop, the grocery store, Huxley's daycare, etc. I have a small number of files synced on it via a hard wired network connection at home so there is quasi-real time work to do with it, but only a subset of the larger number of files and folders I regularly use. The lack of an Internet connection means that I am not distracted while writing, the low value of the hardware means it won't matter if it gets dropped, crushed or even stolen, and having the hard drive encrypted with a killer password and such means that the very valuable data (as if) that is on it can't fall into the wrong hands.

But a computer with such serious limitations is not much fun unless you add a few quirks. So, I've configured the interface to emulate a terminal. I'm using gnome, with a white type on black background theme off the shelf, so the gui file manager looks like a cli terminal file manager like Midnight Commander. I use terminal based apps for a number of things anyway, so when a terminal is maximized the laptop looks like, well, a terminal. And when I'm using emacs, which is how I do all my writing, I have a color theme that is mostly black in the background and white in front (text), but with a number of old fashioned terminal looking colors here and there on the window, maximized with minimal fixings (i.e., no toolbar, menu bar turned off, etc.).

One might ask, why not just use terminal with no x-windowing system or desktop, then I'd have a true terminal-like interface? There are several reasons for this. For one thing, the X system properly configured to use the native resolution of the screen and the abilities of the graphics card in graphics mode produces a much better and easier to read output than the text terminal version of the screen. This was not true in the (distant) past, when graphical interfaces dropped on top of DOS were ugly and hard to use, low resolution and poorly implemented. But those days are long gone, possibly even predating the widespread use of desktop Linux.

Another reason is that I do actually want to use the mouse. What for? When? For whatever I want, whenever I want. It's there, why not use it? Yes, you can use a mouse in a text terminal with a small utility, but it's quirky and bad and doesn't do everything.

Yet another reason is that while screen-based emacs and x-windows emacs are very similar in what you can configure, they are not exactly the same, and I prefer to maintain a single internal knowledge base of modifications that work, and very similar (or even identical) .emacs files for desktop, regular laptop, and mini throwaway laptop.

And there are other reasons still. There are a few pieces of software I'd prefer to have handy. For example, I like Nautilus more than Midnight Commander for file management (not that I do much of that on this small laptop).

And all this is a long and winding way to get to a fun piece of emacs advice for you. Color themes.

Adjusting the color of various bits and pieces of the emacs window, including your background and font colors, is fairly easy (the emacs wiki provides information on the variables and how to set them). In fact, I would say that this is an area where hand coding the settings you want to use all the time in your .emacs file is easier than messing around with the quasi menu-driven emacs configuration system (under "Options - Customize" if you use the menu) where you would need to have a rather demented view of how things work to find these seemingly basic options.

But there is an even easier way: color themes.

The short version is this:

Alt-X color-theme-select

This gives you a "menu" (a buffer with a list) of themes. Put the cursor on a theme and hit enter, and watch the magic! I usually use something called "charcoal black" but there are a number of other excellent themes. A fun one is wordperfect (white on blue). Oh hell, they're all fun.

What is really cool about the emacs color themes that show up when you type in the above command is that they were all designed to pretty much ruin any semblance of an x windowing system or a regular graphical user interface. Anyone looking over your shoulder at any of the themes lacking a white background will think they are looking at a 1970s style terminal that some CS student spent all semester fiddling with. Except, since you are using the GUI, the text up close will be pretty clean and you'll enjoy writing on the terminal.

I don't know, but I'm guessing that changing around the colors now and then helps with eye strain, if you get that. I don't, so I don't know. But, as all writers know, sometimes changing the kind of pen you use or the kind of paper you write on (figuratively, of course, those technologies have not been used in decades) is good for the process. This is a way to do that.

But wait, there's more. You probably need to install something. The wiki page on this technique is here, and it may instruct you to get this .el file which you will put in your emacs path (there's a .something folder in your home directory, something like .emacs.d, in which you put the file). Then, you will likely need to add some code to your .emacs file. It is all in the wiki. What you need to do specifically will depend on which version of emacs you are using, and who knows, by the time you see this perhaps themes will be built in.

Tags

More like this

I'm an EMACS dropout. I really, really did try to learn it, but at the time VI was wired into my brain and my fingers. I find, some 25 years after I first learned VI, and some 15 years after I stopped using it, that it's STILL wired into my fingers. This effect is particularly pronounced when I'm tired. Typing VI commands at 1:00 am when editing in Microsoft Word can produce some interesting results.

Karen, one of the emacs color themes is called "vi"

Of course, that's only the colors. There is a vi mode, I'm pretty sure. You need to stop using word in any event. No reason for it most of the time, really.

Karen, use VIWORD - a set of Word macros that makes a fair (but not close to complete) emulation of the most common vi commands.

I'm using gnome....

But these days, to give us some reasonably accurate idea of what you're talking about, it helps to specify Gnome 2 or 3? Big difference there.

By Randy Owens (not verified) on 23 Sep 2011 #permalink

One of my colleagues refers to vi this way:
Isn't that the editor with two modes: one that beeps and one that corrupts. your files?

Kidding of course.
I use emacs now only for running R and sweave. I must be getting old

Thanks. This is interesting.

I wanted to check it out, but there is nothing called "color-theme-select", "color-theme", or "theme-select" on my system.

I have: custom-new-theme-mode, custom-theme-add-face, custom-theme-add-variable, custom-theme-merge-theme, custom-theme-visit-theme, customize-create-theme, disable-theme, enable-theme, and load-theme, none of which match your post.

Not a big deal, but confusing, as most emacs things are. I use it to write too, but I'll never understand even 5% of it, and lisp is absolutely not worth the trouble to learn (for me!).

Anyhow, thanks for the post. One more emacs mystery.

Dave: Go here and hit "download" on the side bar. Pick the preferred download type, get that folder. Put color-theme.el in your load path, and the folder of "themes" in there as well (i.e. in ~/.emacs.d/

Then, if you are using a recent emacs (i.e. 23) put this in your .emacs file:

(defun color-theme-face-attr-construct (face frame)
(if (atom face)
(custom-face-attributes-get face frame)
(if (and (consp face) (eq (car face) 'quote))
(custom-face-attributes-get (cadr face) frame)
(custom-face-attributes-get (car face) frame))))

and reload the .emacs file or restart emacs and it should mostly work.

The color theme picker will mess with your .emacs file, so if there is some font info in there already you could get some slighly strange results but shouln't be too bac.

Ultimately you'll want to just play with then then pick the one theme you want to really use and use the theme picker to help you find all the lisp code you need (inspect the contents of that "themes" folder!)