Sams Teach Yourself Emacs in 24 Hours |
||||||||||||||
Hour 1: Introduction to Emacs |
||||||||||||||
|
This book covers both GNU Emacs and XEmacs; furthermore, GNU Emacs is covered for Windows as well. The Emacs version that is focused on is version 20, and incompatibilities with Emacs 19 are pointed out. All in all, this book covers quite a few different combinations. Something special might need to be done for GNU Emacs version 19, whereas other things need to be done for Emacs under Windows.
Throughout this book I will tell you to insert code into your .emacs file, in case you need a given feature in, for example, GNU Emacs. In these cases, you need to make a clause around the lines to ensure that the given line is only interpreted by GNU Emacs. Several predicates are defined in sams-lib.el, which describe the setup that you are using (see Table 1.1).
Name |
Meaning |
sams-Emacs-20-p |
This predicate is true if your current Emacs is version 20 |
sams-Emacs-19-p |
This predicate is true if your current Emacs is version 19 |
sams-UNIX-p |
This predicate is true if your Emacs is running under UNIX |
sams-Windows-p |
This predicate is true if your current Emacs is running under Windows |
sams-GNU-Emacs-p |
This predicate is true if your current Emacs is GNU Emacs |
sams-XEmacs-p |
If I suggest, for example, that you insert the line (require 'customize) in GNU Emacs version 19, you should take one of the following actions:
If you are not using GNU Emacs version 19, do nothing.
If you are only using GNU Emacs version 19, no other versions of GNU Emacs, and never XEmacs, just insert the line as is into your .emacs file
If you use GNU Emacs version 19, but you also use other versions or XEmacs, insert the following code into your .emacs file:
(if (and sams-Gnu-Emacs-p sams-Emacs-19-p) (progn (require 'customize) ))
The parentheses say that (and sams-GNU-Emacs-p sams-Emacs-19-p) is the predicate that selects the correct conditions. This is a Lisp expression; because you haven't learned Lisp yet, however, Table 1.2 shows you a few different examples of such predicates (that is, alternatives to (and ...) in the preceding code.)
Any number of lines can be dropped in place of (require 'customize). Therefore, as a final example, I suggest that you insert the following lines if you use GNU Emacs in UNIX:
(message "Loading bla bla...") (require 'bla) (message "Loading bla bla...Done")
In your .emacs file, this would look like:
(if (and sams-GNU-Emacs-p sams-Windows-p) (progn (message "Loading bla bla...") (require 'bla) (message "Loading bla bla...Done") ))
Sams Teach Yourself Emacs in 24 Hours |
||||||||||||||
Hour 1: Introduction to Emacs |
||||||||||||||
|
© Copyright Macmillan USA. All rights reserved.