Previous: , Up: defvar   [Contents][Index]


8.5.1 defvar and an asterisk

In the past, Emacs used the defvar special form both for internal variables that you would not expect a user to change and for variables that you do expect a user to change. Although you can still use defvar for user customizable variables, please use defcustom instead, since it provides a path into the Customization commands. (See Specifying Variables using defcustom.)

When you specified a variable using the defvar special form, you could distinguish a variable that a user might want to change from others by typing an asterisk, ‘*’, in the first column of its documentation string. For example:

(defvar shell-command-default-error-buffer nil
  "*Buffer name for `shell-command' … error output.
… ")

You could (and still can) use the set-variable command to change the value of shell-command-default-error-buffer temporarily. However, options set using set-variable are set only for the duration of your editing session. The new values are not saved between sessions. Each time Emacs starts, it reads the original value, unless you change the value within your .emacs file, either by setting it manually or by using customize. See Your .emacs File.

For me, the major use of the set-variable command is to suggest variables that I might want to set in my .emacs file. There are now more than 700 such variables, far too many to remember readily. Fortunately, you can press TAB after calling the M-x set-variable command to see the list of variables. (See Examining and Setting Variables in The GNU Emacs Manual.)


Previous: , Up: defvar   [Contents][Index]

This page has generated for branch:work/add_lispintr, commit:65845cf60c073f2f3182d1d07483530e9bbe1d96 to check Japanese translation.