Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Emacs beginner's HOWTO.pdf
Скачиваний:
15
Добавлен:
23.08.2013
Размер:
87.27 Кб
Скачать

Emacs Beginner's HOWTO

4.1 Temporary Customization

While experimenting with Emacs customization, you'll probably want to do it in a way that is temporary. If you do something horribly wrong, you can just C−x C−c to exit emacs and run it again. Once you've figured out what changes you'd like to make permanent, you can add them to your very own .emacs file so that they take effect every time you start Emacs. This is discussed in the next section.

Variable Assignments

The easiest customizations are accomplished by changing the value of a variable in Emacs. The list code to do this looks like this:

(setq variable−name new−value)

Where variable−name is the name of the variable and new−value is the value you'd like to give the variable. (In Lisp−speak, you're binding a variable to a value.) The setq function in lisp is analogous to the assignment operators (usually =) in other programming languages.

NOTE: I'm glossing over many details here for the sake of simplicity. You may also see me or others use the Lisp functions set and even setq−default. If you're really curious, feel free to look them up in an Emacs Lisp reference.

Let's look at a line from my .emacs file

(setq−default transient−mark−mode t)

The variable transient−mark−mode controls whether or not a region becomes highlighted when I mark it. In many GUI applications, if you click and drag the mouse to select a range of text it becomes hi−lighted in reverse video or some other color. Emacs will do the same thing it the

transient−mark−mode variable is set (to a non−nil value).

A WHAT value?

Okay. Brief digression. Most programming languages have some notion of true/false values. In C/C++ a value is considered true if it is a non−zero value. In Perl, a non−null or non−zero value is true. In Lisp, the same idea applies but the names and symbols are different.

True is usually written as t and false (or null) is written as nil. Like in other languages, though, any non−nill value is considered true.

To get the full description of what transient−mark−mode does, you can use the on−line help. Type

C−h v or M−x describe−variable and then transient−mark−mode. If you're lazy like me, you can take advantage of variable name completion using the Tab key. Just type part of the variable name and hit the Tab key. If you've typed enough of it that Emacs can already uniquely identify it, you'll see the whole name completed for you.

Another variable that folks often set is fill−column. It tells Emacs how wide the screen should be for the purposes of word−wrapping (and auto−fill−mode respects this value). To set the value to something absurd, you could type:

4.1 Temporary Customization

13

Соседние файлы в предмете Электротехника