Fun with Emacs

By Xah Lee. Date: . Last updated: .

You probably heard that emacs can do lots of things. This page shows some.

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〉 @ http://blogs.msdn.com/steverowe/archive/2004/11/17/code-editor-learning-curves.aspx

Emacs Tetris

emacs tetris 49994
M-x tetris.

Alt+x tetris to start it. Use arrow keys to move the blocks.

Alt+x kill-buffer to close it.

Split Windows

wildly split emacs screen
Wildly split emacs screen. From top to bottom: calendar, Unicode, shell, hexl-mode , html-mode, dired, calculator.

You can split your window into two or more panes, vertically or horizontally.

[see Emacs: Split Windows Basics]

View Calendar

To run calendar in emacs, Alt+x calendar.

emacs calendar
A screenshots of emacs's calendar feature.

To close the calendar pane, type q.

Calculator

To run a calculator in emacs, Alt+x 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 ↵】.

Directory Navigation and Managing Files

A Screenshot of emacs's feature of directory navigation.

To start, Alt+x dired, then, type a dir path.

To exit, press 【q】.

For a full tutorial, see: Emacs: File Manager, dired.

Pretty Colors

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

emacs colors

Command Line Interface (aka Shell)

emacs shell 2014-08-22
Bash shell in emacs. M-x shell.

Alt+x shell to start a shell interface.

For detail, 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.

emacs lisp eval 2017 01 04
eval emacs lisp code basics. [see How to Evaluate Emacs Lisp Code]

In emacs, open a file, any file. In the file, type (+ 1 2), then, select the whole text, then Alt+x 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, Alt+x version.

To start irc, Alt+x 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.freenode.net
IRC Port: 6667
IRC Nick: imrandomjack
Channels: #emacs

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

Liket it? Put $1 at patreon. Or Buy Xah Emacs Tutorial. Thanks.