Emacs was originally a text editor that had it's start at MIT back in 1976, but has over the years morphed into a full-blown Lisp programming environment. It is jokingly referred to as an "operating system that lacks a good text editor."
Nowadays, however, Emacs is an app platform, much like the World Wide Web, or Microsoft's .NET app platforms. Emacs apps are programmed in a dialect of the Lisp programming language called "Emacs Lisp." Emacs apps are called "modes" (they put Emacs into a different mode of operation, behaving according to the rules of the app). "Major modes" are apps that take the whole screen, "minor modes" are apps that make small but useful changes to the default behavior of the "major mode" apps. Minor modes are often used to add features useful to programmers, like syntax coloring, when you edit the source code of a program file.
When you first enter into Emacs with a file as a parameter, text editing is the default mode.
Getting Started with Editing Text
Once you've started emacs, you can type away to your heart's
content. To save at any point, press
C-x C-s. When you want to quit,
C-c C-x. (Here
C- means press and hold the "Control" key, so
C-x C-s means "press and hold control and then press
x, then while
still pressing control, press
To move the cursor around you can use the arrow keys; you can also use
C-p to move the cursor up and down lines.
If you have some free time to learn, you can use the Emacs online
tutorial app. To launch it, press
C-h t (press and hold the control
h, then let go of the control key and press
Other useful commands
Enter a command by name:
M-x, that is "Alt-X". (In Emacs
M-means the "alt" key). This will enter you into a small cmomand line called the "minibuffer" where you can enter any command as if you had typed the key to execute it. Tab completion is available in this command line.
M-w(that is "Alt-W")
Move cursor up/down by paragraph:
M-}(on keyboards where the curly brackets keys are above the square brackets, you must press "Shift" and "Alt" at the same time).
Search for text:
C-sto search downwards, or
C-rto search upwards.
%is above the
5key on the keyboard, you must press "Shift" and "Alt" to enter the
Filter text through a command like
awk: highlight the text using
C-spaceand move the cursor around with the arrow keys or with the search (
C-s) function. Once your text is selected, press
C-u M-|(Control-U, Shift-Alt "|"), then enter the shell command you want to filter the highlighted text through.
Show a list of open tabs (tabs are called "buffers" in Emacs). Press
C-x C-b, then navigate the cursor through the list of tabs with the arrow keys, press enter to change to the tab under the cursor.
Run a command, capture it's output: Enter
M-&(that is Alt-Shift "&"), and then enter the command. A new file is created in a new tab where you can see the output of the command as it runs. You can then copy and paste the text. Press
qto close the tab.
Other resources for learning Emacs
For a more thorough introduction, check out this blog post.
Emacs facilities on Tilde.Town
The vanilla GNU Emacs 26.3 has been installed from the Ubuntu package
repository, and is available for all users. You can use The Eww web
browser as an alternative to Elinks, you can use Gnus as an
alternative to Alpine, however you are required to configure your
~/.emacs.d/init.el file on your own.
Unfortunately, Emacs support is minimal for the time being. Emacs info pages are not installed, and site-wide support for popular Emacs apps such as Magit, Evil, Ivy. If we get more Emacs enthusiasts as members of our community, we would love for you to contribute!
Using BBJ in Emacs
A very simple, but very usable BBJ client written in Emacs Lisp. To
load the client functions, simply
load the file
/town/src/shadowland/clients/emacs/bbj.el. The entry point to BBJ is
bbj-browse-index, so it is recommended you set a global
key binding to execute this function, for example
C-c b b j. Each
thread is opened in it's own buffer.
``` ;; Add these commands to your "~/.emacs" or "~/.emacs.d/init.el" file.
(load "/town/src/shadowland/clients/emacs/bbj.el") (global-set-key (kbd "C-c b b j") 'bbj-browse-index) ```
You are logged-in anonymously by default so you will not be able to
post comments or threads. To login, run the command
then enter your username and password at the prompts in the minibuffer
at the bottom of the screen. (The password is visible on screen,
sorry! We haven't figured out how to make it invisible yet!)
Then run the command
M-x bbj-browse-index to start using BBJ after
you have logged-in.
Navigate threads and posts: use the up/down,
Enter thread: press "enter".
Reload the page view: press
Create a new thread, or thread reply: press
Show the help menu: press
Using IRC in Emacs with ERC
The ERC app is an Emacs IRC client that comes pre-installed on
Emacs. To configure ERC, you must enter these 3 lines of code into
(setq erc-email-userid "your_login_name")
(setq erc-nick "your_login_name")
Logging-in to IRC
Simply run the
M-x erc command, and it will prompt you for which
server you want to join. Join the server
tilde.town (or you can also
localhost as the server), and when it asks for you password,
press "enter" without typing any password.
You will be greeted with the Tilde.Town IRC. Enter the
to refresh the list of active chat rooms -- you will see no output,
because ERC captures the output.
Joining an IRC Chat Room
You can then join a chat room by pressing
C-c C-j and pressing tab
twice, which will present a tab-completion list of available chat
rooms. Then type the name of the chat room (you must type the leading
# character too) and press enter.
Every chat room runs in it's own buffer, so you can switch between
chat rooms the same way you switch between any other buffers in Emacs
C-x b or
For example, to join the
#tildetown chat room, type the commands
C-c C-j #tildetown <enter>
Using server-local E-Mail in Emacs
Tilde.Town uses Alpine as the default mail client, and also provides Mutt as an alternative mail client. However Emacs is fully equipped with e-mail functionality.
Emacs has minor-modes for
.eml files, and you can create a new empty
.eml file using the command
C-x m. After composing the mail,
C-c C-c to send it, by default the
mail client command
line command is used to send the message, and is smart enough to read
the mail header recipients and subject lines and send it to the right
The "Gnus" app can be used as a mail browser
client. Simply append these two lines of code to your
(setq mail-sources '((file)))
(setq gnus-select-method '(nnmbox ""))
Now enter into the Gnus main menu with the command
M-x gnus. The
menu only contains your latest unread message, which is ordinarily
empty at first. Type (without control or alt keys)
Au (capital "A",
lowercase "u"), and this will present you a list of mailbox folders
you can navigate, there is only one at first, called
mail.misc. Navigate the cursor and press enter on this mail
directory to see all of your e-mail.
Gnus reads the mail spool file and formats it into separate emails you can easily navigate. There are functions to reply to e-mail messages which automatically open an e-mail editing buffer.
For more information on how to use Gnus, see the official manual.
last compiled: 2021-06-04 12:34:03.178788