When using the mouse, simply select the desired choice from the list. When using the text approach, type the number (or other character) corresponding to your desired choice. The options available are similar to those that apply to the entire buffer. You'll see the familiar save and reset options along with a few new ones:
Set for Current Session
Same as the global option. Saves the new value for the duration of this session.
Save for Future Sessions
Same as the global option. Applies this value immediately and updates your .emacs file so the new value is used whenever you start Emacs.
Reset to Current
Goes back to the current value for the variable. Any unsaved changes are thrown out, but changes saved—even just for this session—count as "current" changes.
Erase Customization
Same as the global option. Any changes to the variable are removed and .emacs is updated if needed.
Use Backup Value
Goes back to the value saved before the "current" value was set. In other words, revert to the value replaced by the most recent save.
Add Comment
You can add your own comments to the variable to help you remember why you made this change. Comments last as long as the saved change. Changes made only for the current session keep the comment only for the current session (not often useful). Comments added to changes that you save for future sessions show up on this screen in those future sessions. Erasing the customized value also erases comments.
If you make a mistake or supply a value that is not appropriate for the variable, you get a brief error message in the minibuffer. As with other utilities that grew up in the world of Unix, no news is good news. If you don't see any error messages, your change was successfully saved.
10.1.4 An Abbrev Mode Example
Word abbreviation mode is a wonderful way to correct typos on the fly. But it can't work that way unless it is turned on. Let's use Custom to turn on word abbreviation mode (discussed in Chapter 3).
Type: M-x custom Enter
Main customization screen.
Click on the Go to Group button next to Editing group
The Editing group.
Click on the Go to Group button next to Abbreviations group
The Abbreviations group.
Click on the Go to Group button next to Abbrev Mode group
The Abbrev Mode group.
Finally, we're at a screen where we can set the option! Notice that the first content line, Abbrev Mode group, says next to the State button visible group members are all at standard settings. Also note that Abbrev Mode, near the bottom of the screen, says this option is unchanged from its standard setting.
We'll turn on the Abbrev Mode option by pressing the Toggle button.
Click Toggle next to Abbrev Mode
Abbrev mode is set to on.
The text near Abbrev Mode group now says, You have edited something in this group, but not set it. The text near the Abbrev Mode option says, you have edited the value as text, but you have not set the option. These are clear hints that we must take one more step to set this option. And if those weren't hints enough, the minibuffer explicitly instructs, To install your edits, invoke [State] and choose the Set operation. We could click on the State button next to the option, but it's just as convenient (if not more convenient) to click on the Save For Future Sessions option near the top of the screen. This saves all options we've changed in the buffer, which in our case is just one option.
Near the top of the screen, click on Save for Future Sessions
Emacs tells you that it wrote the .emacs file.
Next to the Abbrev Mode group it now says, something in this group has been set and saved. Next to the Abbrev Mode option it says, this option has been set and saved. Note also that Abbrev appears on the mode line now; we have indeed successfully turned on word abbreviation mode. Click Finish repeatedly to kill all the Custom buffers.
Congratulations; you're on your way to customizing Emacs. You should spend some time wandering around in the various groups Custom offers to get a sense of the things you can control. We'll look at the popular topics of customizing fonts, colors, and keyboard mappings in later sections. But Custom offers a much wider variety of areas to tweak. Don't be afraid to look around. You can always use the Reset option to undo something that doesn't behave the way you expected or wanted.
10.1.5 The Options Menu
You can also access Custom through a bit of a back door: the Options menu. Figure 10-6 shows the Options menu. There are three key entries at this top leveclass="underline"
Figure 10-6. The Options menu (Windows)
Show/Hide
Allows you to turn on (and off) several features of Emacs including the menu bar and toolbar.
Save Options
A quick shortcut to saving any changes you make to Emacs through the Options menu.
Customize Emacs
A submenu that allows you to tweak common items such as fonts and variables as well as helping you browse and search through the options available to Custom.
10.1.6 A Dired Example
Let's tackle another Custom example with the help of the Options menu. Dired (discussed in Chapter 5) has many customizable features. One such feature is the dired-view-command-alist variable. This is a list of helper applications that allow you to open various kinds of files. This feature can be quite handy for viewing binary files such as images or PDF files. This list of helper applications is tailored to Linux. If you want to use other applications or you're on a Windows or Mac system, you'll need to customize this variable.
Before you customize this option, you need to open a directory or simply type C-x d to enter Dired. Next, from the Options → Customize Emacs menu, select the Specific Option item.
Choose Options → Customize Emacs → Specific Option
The minibuffer prompts for a specific option to customize (Windows).
The minibuffer prompts for an option name. We want to customize dired-view-command-alist.
Type: dired-view-command-alist Enter
Editing a list entry in Custom (Windows).
You should see the familiar Custom options for saving and resetting the values along with the value of the dired-view-command-alist variable. For this particular variable, we have a list of entries for common file types including PostScript files, PDF documents, and images. To alter one of the existing entries, simply move to the String line and edit the text in grey to launch the application you would like to use. (You can also alter the filename pattern by editing the text in the Regexp line.) For example, PDF documents can be viewed with the open command in Mac OS X, so we could change that line as shown in Figure 10-7. In fact, on Mac OS X, you can use the generic open command for just about every type of file. On Windows it is even easier. Simply enter %s as the string, and Windows uses its default application to open that file type.