Node:Conclusion, Next:, Previous:Debugging, Up:Top



18 Conclusion

We have now reached the end of this Introduction. You have now learned enough about programming in Emacs Lisp to set values, to write simple .emacs files for yourself and your friends, and write simple customizations and extensions to Emacs.

This is a place to stop. Or, if you wish, you can now go onward, and teach yourself.

You have learned some of the basic nuts and bolts of programming. But only some. There are a great many more brackets and hinges that are easy to use that we have not touched.

A path you can follow right now lies among the sources to GNU Emacs and in The GNU Emacs Lisp Reference Manual.

The Emacs Lisp sources are an adventure. When you read the sources and come across a function or expression that is unfamiliar, you need to figure out or find out what it does.

Go to the Reference Manual. It is a thorough, complete, and fairly easy-to-read description of Emacs Lisp. It is written not only for experts, but for people who know what you know. (The Reference Manual comes with the standard GNU Emacs distribution. Like this introduction, it comes as a Texinfo source file, so you can read it on-line and as a typeset, printed book.)

Go to the other on-line help that is part of GNU Emacs: the on-line documentation for all functions, and find-tags, the program that takes you to sources.

Here is an example of how I explore the sources. Because of its name, simple.el is the file I looked at first, a long time ago. As it happens some of the functions in simple.el are complicated, or at least look complicated at first sight. The open-line function, for example, looks complicated.

You may want to walk through this function slowly, as we did with the forward-sentence function. (See forward-sentence.) Or you may want to skip that function and look at another, such as split-line. You don't need to read all the functions. According to count-words-in-defun, the split-line function contains 27 words and symbols.

Even though it is short, split-line contains four expressions we have not studied: skip-chars-forward, indent-to, current-column and ?\n.

Consider the skip-chars-forward function. (It is part of the function definition for back-to-indentation, which is shown in Review.)

In GNU Emacs, you can find out more about skip-chars-forward by typing C-h f (describe-function) and the name of the function. This gives you the function documentation.

You may be able to guess what is done by a well named function such as indent-to; or you can look it up, too. Incidentally, the describe-function function itself is in help.el; it is one of those long, but decipherable functions. You can look up describe-function using the C-h f command!

In this instance, since the code is Lisp, the *Help* buffer contains the name of the library containing the function's source. You can put point over the name of the library and press the RET key, which in this situation is bound to help-follow, and be taken directly to the source, in the same way as M-. (find-tag).

The definition for describe-function illustrates how to customize the interactive expression without using the standard character codes; and it shows how to create a temporary buffer.

(The indent-to function is written in C rather than Emacs Lisp; it is a `built-in' function. help-follow only provides you with the documentation of a built-in function; it does not take you to the source. But find-tag will take you to the source, if properly set up.)

You can look at a function's source using find-tag, which is bound to M-. Finally, you can find out what the Reference Manual has to say by visiting the manual in Info, and typing i (Info-index) and the name of the function, or by looking up skip-chars-forward in the index to a printed copy of the manual.

Similarly, you can find out what is meant by ?\n. You can try using Info-index with ?\n. It turns out that this action won't help; but don't give up. If you search the index for \n without the ?, you will be taken directly to the relevant section of the manual. (See Character Type. ?\n stands for the newline character.)

Other interesting source files include paragraphs.el, loaddefs.el, and loadup.el. The paragraphs.el file includes short, easily understood functions as well as longer ones. The loaddefs.el file contains the many standard autoloads and many keymaps. I have never looked at it all; only at parts. loadup.el is the file that loads the standard parts of Emacs; it tells you a great deal about how Emacs is built. (See Building Emacs, for more about building.)

As I said, you have learned some nuts and bolts; however, and very importantly, we have hardly touched major aspects of programming; I have said nothing about how to sort information, except to use the predefined sort function; I have said nothing about how to store information, except to use variables and lists; I have said nothing about how to write programs that write programs. These are topics for another, and different kind of book, a different kind of learning.

What you have done is learn enough for much practical work with GNU Emacs. What you have done is get started. This is the end of a beginning.