Essentially, you replace the binary that comes with Mac OS X with a shell script that runs the new version of Emacs you installed. You might want to simply rename the old binary so that you can on occasion use it instead.
Here's the procedure.
1. To be sure which Emacs runs when you type emacs, type which emacsin the Terminal application.
% which emacs
/usr/bin/emacs
2. Rename or delete /usr/bin/emacs .
% sudo mv /usr/bin/emacs /usr/bin/oldemacs
3. You'll be prompted for your password.
4. Create a file called emacs with the following two lines:
#!/bin/sh
/Applications/Emacs.app/Contents/MacOS/Emacs "$@"
If you installed Emacs into a different folder, adjust the second line accordingly.
5. Move the file you created to /usr/bin :
% sudo mv emacs /usr/bin
6. Change /usr/bin/emacs to be executable by the world:
% chmod +x /usr/bin/emacs
Now you can invoke graphical Emacs from the terminal window simply by typing emacs, with or without command-line arguments. [92]
13.2.5 Mac OS X and the Meta Key
This book has mentioned using the Commandkey for Metaon Mac OS X. By default, the Commandkey (sometimes called the Open Applekey, or more simply xxxMacSymxxx) is Meta. But in fact you have a choice. The variable mac-command-key-is-metacan be used to select which key you want to use.
As the variable name implies, setting mac-command-key-is-metato tmeans that you use xxxMacSymxxx as the Metakey. So you can type the M-xcombination as xxxMacSymxxx x.
The alternative (setting mac-command-key-is-metato nil) sets the Option(or Alt) key to be your Metakey. You might do this if you want to continue using the Commandkey for Mac functions or if you find that Optionis simply easier to reach. Of course, it's not quite that simple. Emacs still traps the Commandkey. That trapping is supposed to be turned off with one more variable: mac-pass-command-to-system, but to be honest, we never got that to work.
As mentioned in Chapter 3 Chapter 3. Search and Replace The commands we discussed in the first two chapters are enough to get you started, but they're certainly not enough to do any serious editing. If you're using Emacs for anything longer than a few paragraphs, you'll want the support this chapter describes. In this chapter, we cover the various ways that Emacs lets you search for and replace text. Emacs provides the traditional search and replace facilities you would expect in any editor; it also provides several important variants, including incremental searches, regular expression searches, and query-replace. We also cover spell-checking here, because it is a type of replacement (errors are sought and replaced with corrections). Finally, we cover word abbreviation mode; this feature is a type of automatic replacement that can be a real timesaver.
, Emacs uses Ispell for its spell-checking functionality. However, despite voluminous hooks to it, the Ispell executable is not part of Emacs and is not installed by default on Mac OS X. You must therefore install Ispell to get spell-checking to work properly.
We took the easy path to doing this: downloading and installing Fink (see http://fink.sourceforge.net for instructions). Fink is an all-purpose Mac OS X installer that enables you to install Unix software on your Mac easily.
After installing Fink, installing Ispell was completely painless:
% fink install ispell
Just one further step is required so that Emacs finds Ispell without tweaking. Create a symbolic link between the location where Fink installs Ispell ( /sw/bin/ispell ) and where Emacs expects Ispell to be ( /usr/bin/ispell ). [93]
% sudo ln -s /sw/bin/ispell /usr/bin/ispell
Voilà. Emacs spell-checking with Ispell now works as described in Chapter 3 Chapter 3. Search and Replace The commands we discussed in the first two chapters are enough to get you started, but they're certainly not enough to do any serious editing. If you're using Emacs for anything longer than a few paragraphs, you'll want the support this chapter describes. In this chapter, we cover the various ways that Emacs lets you search for and replace text. Emacs provides the traditional search and replace facilities you would expect in any editor; it also provides several important variants, including incremental searches, regular expression searches, and query-replace. We also cover spell-checking here, because it is a type of replacement (errors are sought and replaced with corrections). Finally, we cover word abbreviation mode; this feature is a type of automatic replacement that can be a real timesaver.
.
You can also download and install Emacs 21.3 for the various Windows platforms (Win95, Win98, Win2K, WinXP, and so on). As most Windows machines do not ship with the tools required to build Emacs from scratch, we'll look at downloading and installing prebuilt executables. [94]
As with all platforms, you have choices when installing Emacs on Windows. You can install a binary hosted by the FSF (likely to be older, but certainly stable). You can find a more recent binary online (we'll point you to the one we prefer). You could also build Emacs from CVS, but if you're doing that on Windows, chances are you are not reading this book. Windows comes with no default compilers.
13.3.1.1 Installing the latest binaries: Nqmacs
Our source for the latest binaries is Nqmacs (http://sourceforge.net/projects/nqmacs/). This is simply a build of the latest version of GNU Emacs from CVS sources, not a separate version of Emacs as the name may imply. Windows binaries are posted here on a regular basis, giving Windows users access to the latest version without having to build it themselves.
To install on Windows, simply download the latest binaries, unpack into a new folder using WinZip or Windows own decompression utilities, go to the bin subfolder and double-click on runemacs.exe . By right-clicking on the icon, you can send a copy of the icon to the desktop.
13.3.1.2 Installing Emacs from the FSF
As we mentioned, the binaries at the FSF are stable but generally older. For example, at this writing, the Nqmacs site provides binaries built on 7/25/04 while the FSF's site provides binaries from 3/10/2004.
To download Emacs from the FSF, simply point your browser at http://ftp.gnu.org/pub/gnu/emacs/. Scroll down to find the windows folder. In there, you should find several downloads. The binaries come in three flavors:
• bare(barebin)—the bare minimum you need to get going
• standard(bin)—what most folks need to get running
• full(fullbin)—the full meal deal; everything and then some
Grab the one you want and download it. You can use WinZip (http://www.winzip.com) to unpack it. If you have the Cygwin utilities installed, you can also use gunzipand taras we discussed in the Unix installation section.
Читать дальше