Fun with Emacs

Buy Xah Emacs Tutorial. Master emacs benefits for life.
, , …,

You probably heard that emacs can do lots of things, such as running shell, as a file manager, do ftp/sftp, read and send email, read newsgroup forums, and even as a web browser, and lots of other things other than text editing. But you are rather new and don't know how. This page lists some of fun things with simple instructions you can do right away with emacs.

emacs learning curve
A comic on emacs's learning curve. 〔Original source appears to be Steve Rowe's blog. 《A friend of mine put this together》 @

Emacs has thousands of commands. To call a command, type 【Alt+x】.

Split Windows

emacs split
Wildly split emacs screen. From top to bottom: calendar, Unicode, shell, hex editing mode, HTML mode, file management, calculator.

You can split your window into two or more panes, vertically or horizontally. Call split-window-vertically to split into top/bottom panes. To split a pane side-by-side, call split-window-horizontally. To unsplit, call delete-other-windows.

Spliting Window is available under the menu 〖File ▸ Split Window〗.

View Calendar

To run calendar in emacs, pull the menu 〖Tools ▸ Calendar〗, or call calendar.

emacs calendar
A screenshots of emacs's calendar feature.

To close the calendar pane, type q.


To run a calculator in emacs, call calc.

emacs calculator
Calc mode in emacs.

To quit calculator, type q.

To compute “1+2”, type 【1 Enter ↵ 2 +】. Or, you can type the expression directly by starting with a sinle quote, like this: 【' 1 + 2 Enter ↵】.

Calculator can also be started by going to the menu 〖Tools ▸ Programmable Calculator〗.

Converting Numbers to Binary, Octal, Hexadecimal forms.

To convert the decimal 10 to binary representation in calc, type 【10 Enter ↵ d2】. The d2 will display all numbers in the window in the binary form. The numbers will have a 2# prefix to indicate that they are in base 2. To display them back in decimal form, type d0. To show numbers in octal or hexadecimal form, type d8 or d6.

To convert a binary number 1010 to decimal, type 2#1010 Enter ↵ to enter the number then type d0 to show all numbers in decimal form. Similarly, to enter a number in octal form, precede it with 8# and hexadecimal numbers are prefixed with 16#.

unit conversion

To find out what is 40 F° in C°, type 【40 Enter ↵ ut dF Enter ↵ dC Enter ↵】.

Directory Navigation and Managing Files

A Screenshot of emacs's feature of directory navigation.

Emacs is a excellent tool for file management, such as viewing directory, creating files, copying files, moving files, creating directory, deleting files or directory. Once you become familiar with it, you almost never go back to shell or your operating system's file viewer for these tasks.

To start, call dired or pull the menu 〖File ▸ Dired〗, then, give a dir path.

For a full tutorial, see: Emacs: File Management, dired Tutorial.

FTP (or file transfer)

You can also transfer files between different machines connected by a network. The way to do this in emacs is consistent with the way it does directory navigation.

Call dired and type a directory you want to work with. In this directory, suppose myfile.html is the one you want to upload across the network to the machine on “” in the directory /public_html. Suppose your login name for that machine is “jane”.

Here's what you do. Call dired then choose a source dir. Then move your cursor to the file you want to copy. Type “C” (for copy), then emacs will prompt you for a directory to copy to. Type / You'll be asked for password, then it'll be copied over.

Once you logged in the ftp server, you can actually edit and save files on the remote server, bypassing all the upload/download pain.

Emacs also allows you to do sftp or ftp over ssh.

(info "(emacs) Remote Files")


To view the many colors and their hexadecimal values in RGB model, call list-colors-display. This is very useful when you work in HTML.

emacs colors

Command Line Interface (aka Shell)

To use emacs as the OS's command line interface (in Mac OS X, Linux, or Windows), call shell. Now, you can use emacs just as a shell. The advantage is that, you can have the entire shell's screen output history in your window, and you can copy & paste any part you like, just as if it is a normal text file. Normally in a shell, you can visit past command by pressing the up arrow. But now up arrow moves you cursor to the line above. To show the previous commands you used, press 【Ctrl+】.

See: Emacs: Run Shell in Emacs.

LISP in Emacs

Sometime you hear that emacs has the artificial intelligence language LISP built in. That's right. Here's how you can run a short example.

In emacs, open a file, any file. In the file, type (+ 1 2), then, select the whole text, then call eval-region. You will see the result “3”. CONGRADULATIONS, you've just evaluated a lisp program!

See: Emacs Lisp Basics.

Internet Relay Chat (IRC)

If you don't know already, IRC is Internet Relay Chat. IRC is a public instant messaging forum that allows a groups of people to discuss things together. Typically, irc topics are about programing languages (Perl, Bash, PHP, HTML, OCaml, …) or tools (emacs, ubuntu, git …).

Yes, you can run IRC in emacs if you are running emacs version 22 or later. To see what version of emacs you have, type “emacs --version” in the command line prompt. Or, inside emacs, call version.

To start irc, call irc. Then, you'll be prompted to enter the server name and port and user name, and channel you want to join. For example, use the following:

IRC Server:
IRC Port: 6667
IRC Nick: imrandomjack
Channels: #emacs

then you'll be connected to the #emacs discussion room in the server.

O My GOD, Too Many Commands

emacs icon Yeah, that's emacs. Some say, it's a operating system. Others say, it's a overflowing kitchen sink.

Life is filled with endless meaningful things to learn, if it is gonna be a fulfilling life.

Like it? Buy Xah Emacs Tutorial.
blog comments powered by Disqus