-->
Previous Table of Contents Next


Customizing emacs

You can customize your version of emacs by placing custom functions within a file called .emacs. This file must reside in your home directory. This file contains functions written in emacs LISP, with which you can personalize emacs to your liking. An example LISP function follows:


(keyboard-translate ?\C-h ?\C-?)

This function is helpful if your terminal translates the <Backspace> key into the <Ctrl-h> characters. These characters are, by default, the sequence used to summon help from within emacs. By specifying a new function and binding this function to a key, you can customize how emacs responds to these key sequences.

In the preceding example, ?\C-h represents the <Ctrl-h> keypress. ?\C-? represents the <Delete> key. On nearly all ASCII keyboards, both keys represent the same ASCII value, namely 8. After you enter this function line into your .emacs file and save it, the next time you invoke emacs, you’ll be able to delete characters by using the <Backspace> key.

Of course, this also means you’ll no longer have access to help from the keyboard. To alleviate this problem, you can bind the help function to a new key sequence, just as you did with the delete function. Simply place the following line into your .emacs file, specifying your chosen key for key:


(keyboard-translate ?\C-key ?\C-h)

From Here…

You can find more information on another editor and about Linux’s files system in the following chapters:

  Chapter 8, “Using the vi Editor,” discusses the basics of using this popular editor. vi is important because it’s found on all Linux/UNIX systems. If you know how to use vi, you should be able to edit a file on any system. Systems administrators also use vi for many systems admin tasks.
  Chapter 11, “Backing Up Data,” shows you how to properly back up your text files from accidental erasure.
  Chapter 16, “Understanding the File and Directory System,” discusses the basics of files and directories. You should have a basic understanding of the file system when using emacs or any other editor. Whereas the editor creates and modifies files, it’s up to you to name them and place them in the appropriate directories.
  Chapter 20, “Printing,” provides information on printing your text files under Linux. Printing files under Linux can be tricky; this chapter helps you prepare your system for printing.


Previous Table of Contents Next