* Front Page * Table of Contents * Return to Town

Emacs

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, press 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 s).

To move the cursor around you can use the arrow keys; you can also use C-n and 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 and press h, then let go of the control key and press t). Then

Other useful commands

Other resources for learning Emacs

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 the function 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 M-x bbj-login, 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.

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 your ~/.emacs or ~/.emacs.d/init.el file:

(require 'erc) (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 use 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 /list command 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 C-x C-b.

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, pressing 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 place.

The "Gnus" app can be used as a mail browser client. Simply append these two lines of code to your ~/.emacs or ~/.emacs.d/init.el file:

(require 'gnus) (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