custom.texi 99 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556
  1. @node Customization, Quitting, Emulation, Top
  2. @chapter Customization
  3. @cindex customization
  4. This chapter talks about various topics relevant to adapting the
  5. behavior of Emacs in minor ways.
  6. All kinds of customization affect only the particular Emacs job that you
  7. do them in. They are completely lost when you kill the Emacs job, and
  8. have no effect on other Emacs jobs you may run at the same time or
  9. later. The only way an Emacs job can affect anything outside of it is
  10. by writing a file; in particular, the only way to make a customization
  11. `permanent' is to put something in your init file or other appropriate
  12. file to do the customization in each session. @xref{Init File}.
  13. @menu
  14. * Minor Modes:: Each minor mode is one feature you can turn on
  15. independently of any others.
  16. * Variables:: Many Emacs commands examine Emacs variables
  17. to decide what to do; by setting variables,
  18. you can control their functioning.
  19. * Keyboard Macros:: A keyboard macro records a sequence of keystrokes
  20. to be replayed with a single command.
  21. * Key Bindings:: The keymaps say what command each key runs.
  22. By changing them, you can "redefine keys".
  23. * Syntax:: The syntax table controls how words and expressions
  24. are parsed.
  25. * Init File:: How to write common customizations in the init file.
  26. * Audible Bell:: Changing how Emacs sounds the bell.
  27. * Faces:: Changing the fonts and colors of a region of text.
  28. * Frame Components:: Controlling the presence and positions of the
  29. menubar, toolbars, and gutters.
  30. * X Resources:: X resources controlling various aspects of the
  31. behavior of XEmacs.
  32. @end menu
  33. @node Minor Modes
  34. @section Minor Modes
  35. @cindex minor modes
  36. @cindex mode line
  37. Minor modes are options which you can use or not. For example, Auto
  38. Fill mode is a minor mode in which @key{SPC} breaks lines between words
  39. as you type. All the minor modes are independent of each other and of
  40. the selected major mode. Most minor modes inform you in the mode line
  41. when they are on; for example, @samp{Fill} in the mode line means that
  42. Auto Fill mode is on.
  43. Append @code{-mode} to the name of a minor mode to get the name of a
  44. command function that turns the mode on or off. Thus, the command to
  45. enable or disable Auto Fill mode is called @kbd{M-x auto-fill-mode}. These
  46. commands are usually invoked with @kbd{M-x}, but you can bind keys to them
  47. if you wish. With no argument, the function turns the mode on if it was
  48. off and off if it was on. This is known as @dfn{toggling}. A positive
  49. argument always turns the mode on, and an explicit zero argument or a
  50. negative argument always turns it off.
  51. @cindex Auto Fill mode
  52. @findex auto-fill-mode
  53. Auto Fill mode allows you to enter filled text without breaking lines
  54. explicitly. Emacs inserts newlines as necessary to prevent lines from
  55. becoming too long. @xref{Filling}.
  56. @cindex Overwrite mode
  57. @findex overwrite-mode
  58. Overwrite mode causes ordinary printing characters to replace existing
  59. text instead of moving it to the right. For example, if point is in
  60. front of the @samp{B} in @samp{FOOBAR}, and you type a @kbd{G} in Overwrite
  61. mode, it changes to @samp{FOOGAR}, instead of @samp{FOOGBAR}.@refill
  62. @cindex Abbrev mode
  63. @findex abbrev-mode
  64. Abbrev mode allows you to define abbreviations that automatically expand
  65. as you type them. For example, @samp{amd} might expand to @samp{abbrev
  66. mode}. @xref{Abbrevs}, for full information.
  67. @node Variables
  68. @section Variables
  69. @cindex variable
  70. @cindex option
  71. A @dfn{variable} is a Lisp symbol which has a value. Variable names
  72. can contain any characters, but by convention they are words separated
  73. by hyphens. A variable can also have a documentation string, which
  74. describes what kind of value it should have and how the value will be
  75. used.
  76. Lisp allows any variable to have any kind of value, but most variables
  77. that Emacs uses require a value of a certain type. Often the value has
  78. to be a string or a number. Sometimes we say that a certain feature is
  79. turned on if a variable is ``non-@code{nil},'' meaning that if the
  80. variable's value is @code{nil}, the feature is off, but the feature is
  81. on for @i{any} other value. The conventional value to turn on the
  82. feature---since you have to pick one particular value when you set the
  83. variable---is @code{t}.
  84. Emacs uses many Lisp variables for internal recordkeeping, as any Lisp
  85. program must, but the most interesting variables for you are the ones that
  86. exist for the sake of customization. Emacs does not (usually) change the
  87. values of these variables; instead, you set the values, and thereby alter
  88. and control the behavior of certain Emacs commands. These variables are
  89. called @dfn{options}. Most options are documented in this manual and
  90. appear in the Variable Index (@pxref{Variable Index}).
  91. One example of a variable which is an option is @code{fill-column}, which
  92. specifies the position of the right margin (as a number of characters from
  93. the left margin) to be used by the fill commands (@pxref{Filling}).
  94. @menu
  95. * Examining:: Examining or setting one variable's value.
  96. * Easy Customization:: Convenient and easy customization of variables.
  97. * Edit Options:: Examining or editing list of all variables' values.
  98. * Locals:: Per-buffer values of variables.
  99. * File Variables:: How files can specify variable values.
  100. @end menu
  101. @node Examining
  102. @subsection Examining and Setting Variables
  103. @cindex setting variables
  104. @table @kbd
  105. @item C-h v
  106. @itemx M-x describe-variable
  107. Print the value and documentation of a variable.
  108. @findex set-variable
  109. @item M-x set-variable
  110. Change the value of a variable.
  111. @end table
  112. @kindex C-h v
  113. @findex describe-variable
  114. To examine the value of a single variable, use @kbd{C-h v}
  115. (@code{describe-variable}), which reads a variable name using the
  116. minibuffer, with completion. It prints both the value and the
  117. documentation of the variable.
  118. @example
  119. C-h v fill-column @key{RET}
  120. @end example
  121. @noindent
  122. prints something like:
  123. @smallexample
  124. fill-column's value is 75
  125. Documentation:
  126. *Column beyond which automatic line-wrapping should happen.
  127. Automatically becomes local when set in any fashion.
  128. @end smallexample
  129. @cindex option
  130. @noindent
  131. The star at the beginning of the documentation indicates that this variable
  132. is an option. @kbd{C-h v} is not restricted to options; it allows any
  133. variable name.
  134. @findex set-variable
  135. If you know which option you want to set, you can use @kbd{M-x
  136. set-variable} to set it. This prompts for the variable name in the
  137. minibuffer (with completion), and then prompts for a Lisp expression for the
  138. new value using the minibuffer a second time. For example,
  139. @example
  140. M-x set-variable @key{RET} fill-column @key{RET} 75 @key{RET}
  141. @end example
  142. @noindent
  143. sets @code{fill-column} to 75, as if you had executed the Lisp expression
  144. @code{(setq fill-column 75)}.
  145. Setting variables in this way, like all means of customizing Emacs
  146. except where explicitly stated, affects only the current Emacs session.
  147. @node Easy Customization
  148. @subsection Easy Customization Interface
  149. @findex customize
  150. @cindex customization buffer
  151. A convenient way to find the user option variables that you want to
  152. change, and then change them, is with @kbd{M-x customize} (or use a
  153. keyboard shortcut, @kbd{C-h C}. This command
  154. creates a @dfn{customization buffer} with which you can browse through
  155. the Emacs user options in a logically organized structure, then edit and
  156. set their values. You can also use the customization buffer to save
  157. settings permanently. (Not all Emacs user options are included in this
  158. structure as of yet, but we are adding the rest.)
  159. @menu
  160. * Groups: Customization Groups.
  161. How options are classified in a structure.
  162. * Changing an Option:: How to edit a value and set an option.
  163. * Face Customization:: How to edit the attributes of a face.
  164. * Specific Customization:: Making a customization buffer for specific
  165. options, faces, or groups.
  166. @end menu
  167. @node Customization Groups
  168. @subsubsection Customization Groups
  169. @cindex customization groups
  170. For customization purposes, user options are organized into
  171. @dfn{groups} to help you find them. Groups are collected into bigger
  172. groups, all the way up to a master group called @code{Emacs}.
  173. @kbd{M-x customize} (or @kbd{C-h C}) creates a customization buffer that
  174. shows the top-level @code{Emacs} group and the second-level groups immediately
  175. under it. It looks like this, in part:
  176. @smallexample
  177. /- Emacs group: ---------------------------------------------------\
  178. [State]: visible group members are all at standard settings.
  179. Customization of the One True Editor.
  180. See also [Manual].
  181. [Open] Editing group
  182. Basic text editing facilities.
  183. [Open] External group
  184. Interfacing to external utilities.
  185. @var{more second-level groups}
  186. \- Emacs group end ------------------------------------------------/
  187. @end smallexample
  188. @noindent
  189. This says that the buffer displays the contents of the @code{Emacs}
  190. group. The other groups are listed because they are its contents. But
  191. they are listed differently, without indentation and dashes, because
  192. @emph{their} contents are not included. Each group has a single-line
  193. documentation string; the @code{Emacs} group also has a @samp{[State]}
  194. line.
  195. @cindex editable fields (customization buffer)
  196. @cindex active fields (customization buffer)
  197. Most of the text in the customization buffer is read-only, but it
  198. typically includes some @dfn{editable fields} that you can edit. There
  199. are also @dfn{active fields}; this means a field that does something
  200. when you @dfn{invoke} it. To invoke an active field, either click on it
  201. with @kbd{Mouse-1}, or move point to it and type @key{RET}.
  202. For example, the phrase @samp{[Open]} that appears in a second-level
  203. group is an active field. Invoking the @samp{[Open]} field for a group
  204. opens up a new customization buffer, which shows that group and its
  205. contents. This field is a kind of hypertext link to another group.
  206. The @code{Emacs} group does not include any user options itself, but
  207. other groups do. By examining various groups, you will eventually find
  208. the options and faces that belong to the feature you are interested in
  209. customizing. Then you can use the customization buffer to set them.
  210. @findex customize-browse
  211. You can view the structure of customization groups on a larger scale
  212. with @kbd{M-x customize-browse}. This command creates a special kind of
  213. customization buffer which shows only the names of the groups (and
  214. options and faces), and their structure.
  215. In this buffer, you can show the contents of a group by invoking
  216. @samp{[+]}. When the group contents are visible, this button changes to
  217. @samp{[-]}; invoking that hides the group contents.
  218. Each group, option or face name in this buffer has an active field
  219. which says @samp{[Group]}, @samp{[Option]} or @samp{[Face]}. Invoking
  220. that active field creates an ordinary customization buffer showing just
  221. that group and its contents, just that option, or just that face.
  222. This is the way to set values in it.
  223. @node Changing an Option
  224. @subsubsection Changing an Option
  225. Here is an example of what a user option looks like in the
  226. customization buffer:
  227. @smallexample
  228. Kill Ring Max: [Hide] 30
  229. [State]: this option is unchanged from its standard setting.
  230. Maximum length of kill ring before oldest elements are thrown away.
  231. @end smallexample
  232. The text following @samp{[Hide]}, @samp{30} in this case, indicates
  233. the current value of the option. If you see @samp{[Show]} instead of
  234. @samp{[Hide]}, it means that the value is hidden; the customization
  235. buffer initially hides values that take up several lines. Invoke
  236. @samp{[Show]} to show the value.
  237. The line after the option name indicates the @dfn{customization state}
  238. of the option: in the example above, it says you have not changed the
  239. option yet. The word @samp{[State]} at the beginning of this line is
  240. active; you can get a menu of various operations by invoking it with
  241. @kbd{Mouse-1} or @key{RET}. These operations are essential for
  242. customizing the variable.
  243. The line after the @samp{[State]} line displays the beginning of the
  244. option's documentation string. If there are more lines of
  245. documentation, this line ends with @samp{[More]}; invoke this to show
  246. the full documentation string.
  247. To enter a new value for @samp{Kill Ring Max}, move point to the value
  248. and edit it textually. For example, you can type @kbd{M-d}, then insert
  249. another number.
  250. When you begin to alter the text, you will see the @samp{[State]} line
  251. change to say that you have edited the value:
  252. @smallexample
  253. [State]: you have edited the value as text, but not set the option.
  254. @end smallexample
  255. @cindex setting option value
  256. Editing the value does not actually set the option variable. To do
  257. that, you must @dfn{set} the option. To do this, invoke the word
  258. @samp{[State]} and choose @samp{Set for Current Session}.
  259. The state of the option changes visibly when you set it:
  260. @smallexample
  261. [State]: you have set this option, but not saved it for future sessions.
  262. @end smallexample
  263. You don't have to worry about specifying a value that is not valid;
  264. setting the option checks for validity and will not really install an
  265. unacceptable value.
  266. @kindex M-TAB @r{(customization buffer)}
  267. @findex widget-complete
  268. While editing a value or field that is a file name, directory name,
  269. command name, or anything else for which completion is defined, you can
  270. type @kbd{M-@key{TAB}} (@code{widget-complete}) to do completion.
  271. Some options have a small fixed set of possible legitimate values.
  272. These options don't let you edit the value textually. Instead, an
  273. active field @samp{[Value Menu]} appears before the value; invoke this
  274. field to edit the value. For a boolean ``on or off'' value, the active
  275. field says @samp{[Toggle]}, and it changes to the other value.
  276. @samp{[Value Menu]} and @samp{[Toggle]} edit the buffer; the changes
  277. take effect when you use the @samp{Set for Current Session} operation.
  278. Some options have values with complex structure. For example, the
  279. value of @code{load-path} is a list of directories. Here is how it
  280. appears in the customization buffer:
  281. @smallexample
  282. Load Path:
  283. [INS] [DEL] [Current dir?]: /usr/local/share/emacs/19.34.94/site-lisp
  284. [INS] [DEL] [Current dir?]: /usr/local/share/emacs/site-lisp
  285. [INS] [DEL] [Current dir?]: /usr/local/share/emacs/19.34.94/leim
  286. [INS] [DEL] [Current dir?]: /usr/local/share/emacs/19.34.94/lisp
  287. [INS] [DEL] [Current dir?]: /build/emacs/e19/lisp
  288. [INS] [DEL] [Current dir?]: /build/emacs/e19/lisp/gnus
  289. [INS]
  290. [State]: this item has been changed outside the customization buffer.
  291. List of directories to search for files to load....
  292. @end smallexample
  293. @noindent
  294. Each directory in the list appears on a separate line, and each line has
  295. several editable or active fields.
  296. You can edit any of the directory names. To delete a directory from
  297. the list, invoke @samp{[DEL]} on that line. To insert a new directory in
  298. the list, invoke @samp{[INS]} at the point where you want to insert it.
  299. You can also invoke @samp{[Current dir?]} to switch between including
  300. a specific named directory in the path, and including @code{nil} in the
  301. path. (@code{nil} in a search path means ``try the current
  302. directory.'')
  303. @kindex TAB @r{(customization buffer)}
  304. @kindex S-TAB @r{(customization buffer)}
  305. @findex widget-forward
  306. @findex widget-backward
  307. Two special commands, @key{TAB} and @kbd{S-@key{TAB}}, are useful for
  308. moving through the customization buffer. @key{TAB}
  309. (@code{widget-forward}) moves forward to the next active or editable
  310. field; @kbd{S-@key{TAB}} (@code{widget-backward}) moves backward to the
  311. previous active or editable field.
  312. Typing @key{RET} on an editable field also moves forward, just like
  313. @key{TAB}. The reason for this is that people have a tendency to type
  314. @key{RET} when they are finished editing a field. If you have occasion
  315. to insert a newline in an editable field, use @kbd{C-o} or @kbd{C-q
  316. C-j},
  317. @cindex saving option value
  318. Setting the option changes its value in the current Emacs session;
  319. @dfn{saving} the value changes it for future sessions as well. This
  320. works by writing code into your init file so as to set the option
  321. variable again each time you start Emacs. @xref{Init File}. To save
  322. the option, invoke @samp{[State]} and select the @samp{Save for Future
  323. Sessions} operation.
  324. You can also restore the option to its standard value by invoking
  325. @samp{[State]} and selecting the @samp{Reset} operation. There are
  326. actually three reset operations:
  327. @table @samp
  328. @item Reset to Current
  329. If you have made some modifications and not yet set the option,
  330. this restores the text in the customization buffer to match
  331. the actual value.
  332. @item Reset to Saved
  333. This restores the value of the option to the last saved value,
  334. and updates the text accordingly.
  335. @item Reset to Standard Settings
  336. This sets the option to its standard value, and updates the text
  337. accordingly. This also eliminates any saved value for the option,
  338. so that you will get the standard value in future Emacs sessions.
  339. @end table
  340. The state of a group indicates whether anything in that group has been
  341. edited, set or saved. You can select @samp{Set for Current Session},
  342. @samp{Save for Future Sessions} and the various kinds of @samp{Reset}
  343. operation for the group; these operations on the group apply to all
  344. options in the group and its subgroups.
  345. Near the top of the customization buffer there are two lines
  346. containing several active fields:
  347. @smallexample
  348. [Set] [Save] [Reset] [Done]
  349. @end smallexample
  350. @noindent
  351. Invoking @samp{[Done]} buries this customization buffer. Each of the
  352. other fields performs an operation---set, save or reset---on each of the
  353. items in the buffer that could meaningfully be set, saved or reset.
  354. @node Face Customization
  355. @subsubsection Customizing Faces
  356. @cindex customizing faces
  357. @cindex bold font
  358. @cindex italic font
  359. @cindex fonts and faces
  360. In addition to user options, some customization groups also include
  361. faces. When you show the contents of a group, both the user options and
  362. the faces in the group appear in the customization buffer. Here is an
  363. example of how a face looks:
  364. @smallexample
  365. Custom Changed Face: (sample)
  366. [State]: this face is unchanged from its standard setting.
  367. Face used when the customize item has been changed.
  368. Parent groups: [Custom Magic Faces]
  369. Attributes: [ ] Bold: [Toggle] off (nil)
  370. [ ] Italic: [Toggle] off (nil)
  371. [ ] Underline: [Toggle] off (nil)
  372. [ ] Foreground: white (sample)
  373. [ ] Background: blue (sample)
  374. [ ] Inverse: [Toggle] off (nil)
  375. [ ] Stipple:
  376. [ ] Font Family:
  377. [ ] Size:
  378. [ ] Strikethru: off
  379. @end smallexample
  380. Each face attribute has its own line. The @samp{[@var{x}]} field
  381. before the attribute name indicates whether the attribute is
  382. @dfn{enabled}; @samp{X} means that it is. You can enable or disable the
  383. attribute by invoking that field. When the attribute is enabled, you
  384. can change the attribute value in the usual ways.
  385. @xref{Faces}, for description of how @code{face-frob-from-locale-first}
  386. variable affects changing @samp{Bold} and @samp{Italic} attributes.
  387. @c Is this true for XEmacs?
  388. @c On a black-and-white display, the colors you can use for the
  389. @c background are @samp{black}, @samp{white}, @samp{gray}, @samp{gray1},
  390. @c and @samp{gray3}. Emacs supports these shades of gray by using
  391. @c background stipple patterns instead of a color.
  392. @c
  393. Setting, saving and resetting a face work like the same operations for
  394. options (@pxref{Changing an Option}).
  395. A face can specify different appearances for different types of
  396. display. For example, a face can make text red on a color display, but
  397. use a bold font on a monochrome display. To specify multiple
  398. appearances for a face, select @samp{Show Display Types} in the menu you
  399. get from invoking @samp{[State]}.
  400. @c It would be cool to implement this
  401. @c @findex modify-face
  402. @c Another more basic way to set the attributes of a specific face is
  403. @c with @kbd{M-x modify-face}. This command reads the name of a face, then
  404. @c reads the attributes one by one. For the color and stipple attributes,
  405. @c the attribute's current value is the default---type just @key{RET} if
  406. @c you don't want to change that attribute. Type @samp{none} if you want
  407. @c to clear out the attribute.
  408. @node Specific Customization
  409. @subsubsection Customizing Specific Items
  410. Instead of finding the options you want to change by moving down
  411. through the structure of groups, you can specify the particular option,
  412. face or group that you want to customize.
  413. @table @kbd
  414. @item M-x customize-option @key{RET} @var{option} @key{RET}
  415. Set up a customization buffer with just one option, @var{option}.
  416. @item M-x customize-face @key{RET} @var{face} @key{RET}
  417. Set up a customization buffer with just one face, @var{face}.
  418. @item M-x customize-group @key{RET} @var{group} @key{RET}
  419. Set up a customization buffer with just one group, @var{group}.
  420. @item M-x customize-apropos @key{RET} @var{regexp} @key{RET}
  421. Set up a customization buffer with all the options, faces and groups
  422. that match @var{regexp}.
  423. @item M-x customize-saved
  424. Set up a customization buffer containing all options and faces that you
  425. have saved with customization buffers.
  426. @item M-x customize-customized
  427. Set up a customization buffer containing all options and faces that you
  428. have customized but not saved.
  429. @end table
  430. @findex customize-option
  431. If you want to alter a particular user option variable with the
  432. customization buffer, and you know its name, you can use the command
  433. @kbd{M-x customize-option} and specify the option name. This sets up
  434. the customization buffer with just one option---the one that you asked
  435. for. Editing, setting and saving the value work as described above, but
  436. only for the specified option.
  437. @findex customize-face
  438. Likewise, you can modify a specific face, chosen by name, using
  439. @kbd{M-x customize-face}.
  440. @findex customize-group
  441. You can also set up the customization buffer with a specific group,
  442. using @kbd{M-x customize-group}. The immediate contents of the chosen
  443. group, including option variables, faces, and other groups, all appear
  444. as well. However, these subgroups' own contents start out hidden. You
  445. can show their contents in the usual way, by invoking @samp{[Show]}.
  446. @findex customize-apropos
  447. To control more precisely what to customize, you can use @kbd{M-x
  448. customize-apropos}. You specify a regular expression as argument; then
  449. all options, faces and groups whose names match this regular expression
  450. are set up in the customization buffer. If you specify an empty regular
  451. expression, this includes @emph{all} groups, options and faces in the
  452. customization buffer (but that takes a long time).
  453. @findex customize-saved
  454. @findex customize-customized
  455. If you change option values and then decide the change was a mistake,
  456. you can use two special commands to revisit your previous changes. Use
  457. @kbd{customize-saved} to look at the options and faces that you have
  458. saved. Use @kbd{M-x customize-customized} to look at the options and
  459. faces that you have set but not saved.
  460. @node Edit Options
  461. @subsection Editing Variable Values
  462. @table @kbd
  463. @item M-x list-options
  464. Display a buffer listing names, values, and documentation of all options.
  465. @item M-x edit-options
  466. Change option values by editing a list of options.
  467. @end table
  468. @findex list-options
  469. @kbd{M-x list-options} displays a list of all Emacs option variables in
  470. an Emacs buffer named @samp{*List Options*}. Each option is shown with its
  471. documentation and its current value. Here is what a portion of it might
  472. look like:
  473. @smallexample
  474. ;; exec-path:
  475. ("." "/usr/local/bin" "/usr/ucb" "/bin" "/usr/bin" "/u2/emacs/etc")
  476. *List of directories to search programs to run in subprocesses.
  477. Each element is a string (directory name)
  478. or nil (try the default directory).
  479. ;;
  480. ;; fill-column:
  481. 75
  482. *Column beyond which automatic line-wrapping should happen.
  483. Automatically becomes local when set in any fashion.
  484. ;;
  485. @end smallexample
  486. @findex edit-options
  487. @kbd{M-x edit-options} goes one step further and immediately selects the
  488. @samp{*List Options*} buffer; this buffer uses the major mode Options mode,
  489. which provides commands that allow you to point at an option and change its
  490. value:
  491. @table @kbd
  492. @item s
  493. Set the variable point is in or near to a new value read using the
  494. minibuffer.
  495. @item x
  496. Toggle the variable point is in or near: if the value was @code{nil},
  497. it becomes @code{t}; otherwise it becomes @code{nil}.
  498. @item 1
  499. Set the variable point is in or near to @code{t}.
  500. @item 0
  501. Set the variable point is in or near to @code{nil}.
  502. @item n
  503. @itemx p
  504. Move to the next or previous variable.
  505. @end table
  506. @node Locals
  507. @subsection Local Variables
  508. @table @kbd
  509. @item M-x make-local-variable
  510. Make a variable have a local value in the current buffer.
  511. @item M-x kill-local-variable
  512. Make a variable use its global value in the current buffer.
  513. @item M-x make-variable-buffer-local
  514. Mark a variable so that setting it will make it local to the
  515. buffer that is current at that time.
  516. @end table
  517. @cindex local variables
  518. You can make any variable @dfn{local} to a specific Emacs buffer.
  519. This means that the variable's value in that buffer is independent of
  520. its value in other buffers. A few variables are always local in every
  521. buffer. All other Emacs variables have a @dfn{global} value which is in
  522. effect in all buffers that have not made the variable local.
  523. Major modes always make the variables they set local to the buffer.
  524. This is why changing major modes in one buffer has no effect on other
  525. buffers.
  526. @findex make-local-variable
  527. @kbd{M-x make-local-variable} reads the name of a variable and makes it
  528. local to the current buffer. Further changes in this buffer will not
  529. affect others, and changes in the global value will not affect this
  530. buffer.
  531. @findex make-variable-buffer-local
  532. @cindex per-buffer variables
  533. @kbd{M-x make-variable-buffer-local} reads the name of a variable and
  534. changes the future behavior of the variable so that it automatically
  535. becomes local when it is set. More precisely, once you have marked a
  536. variable in this way, the usual ways of setting the
  537. variable will automatically invoke @code{make-local-variable} first. We
  538. call such variables @dfn{per-buffer} variables.
  539. Some important variables have been marked per-buffer already. They
  540. include @code{abbrev-mode}, @code{auto-fill-function},
  541. @code{case-fold-search}, @code{comment-column}, @code{ctl-arrow},
  542. @code{fill-column}, @code{fill-prefix}, @code{indent-tabs-mode},
  543. @code{left-margin}, @*@code{mode-line-format}, @code{overwrite-mode},
  544. @code{selective-display-ellipses}, @*@code{selective-display},
  545. @code{tab-width}, and @code{truncate-lines}. Some other variables are
  546. always local in every buffer, but they are used for internal
  547. purposes.@refill
  548. Note: the variable @code{auto-fill-function} was formerly named
  549. @code{auto-fill-hook}.
  550. @findex kill-local-variable
  551. If you want a variable to cease to be local to the current buffer,
  552. call @kbd{M-x kill-local-variable} and provide the name of a variable to
  553. the prompt. The global value of the variable
  554. is again in effect in this buffer. Setting the major mode kills all
  555. the local variables of the buffer.
  556. @findex setq-default
  557. To set the global value of a variable, regardless of whether the
  558. variable has a local value in the current buffer, you can use the
  559. Lisp function @code{setq-default}. It works like @code{setq}.
  560. If there is a local value in the current buffer, the local value is
  561. not affected by @code{setq-default}; thus, the new global value may
  562. not be visible until you switch to another buffer, as in the case of:
  563. @example
  564. (setq-default fill-column 75)
  565. @end example
  566. @noindent
  567. @code{setq-default} is the only way to set the global value of a variable
  568. that has been marked with @code{make-variable-buffer-local}.
  569. @findex default-value
  570. Programs can look at a variable's default value with @code{default-value}.
  571. This function takes a symbol as an argument and returns its default value.
  572. The argument is evaluated; usually you must quote it explicitly, as in
  573. the case of:
  574. @example
  575. (default-value 'fill-column)
  576. @end example
  577. @node File Variables
  578. @subsection Local Variables in Files
  579. @cindex local variables in files
  580. A file can contain a @dfn{local variables list}, which specifies the
  581. values to use for certain Emacs variables when that file is edited.
  582. Visiting the file checks for a local variables list and makes each variable
  583. in the list local to the buffer in which the file is visited, with the
  584. value specified in the file.
  585. A local variables list goes near the end of the file, in the last page.
  586. (It is often best to put it on a page by itself.) The local variables list
  587. starts with a line containing the string @samp{Local Variables:}, and ends
  588. with a line containing the string @samp{End:}. In between come the
  589. variable names and values, one set per line, as @samp{@var{variable}:@:
  590. @var{value}}. The @var{value}s are not evaluated; they are used literally.
  591. The line which starts the local variables list does not have to say
  592. just @samp{Local Variables:}. If there is other text before @samp{Local
  593. Variables:}, that text is called the @dfn{prefix}, and if there is other
  594. text after, that is called the @dfn{suffix}. If a prefix or suffix are
  595. present, each entry in the local variables list should have the prefix
  596. before it and the suffix after it. This includes the @samp{End:} line.
  597. The prefix and suffix are included to disguise the local variables list
  598. as a comment so the compiler or text formatter will ignore it.
  599. If you do not need to disguise the local variables list as a comment in
  600. this way, there is no need to include a prefix or a suffix.@refill
  601. Two ``variable'' names are special in a local variables list: a value
  602. for the variable @code{mode} sets the major mode, and a value for the
  603. variable @code{eval} is simply evaluated as an expression and the value
  604. is ignored. These are not real variables; setting them in any other
  605. context does not have the same effect. If @code{mode} is used in a
  606. local variables list, it should be the first entry in the list.
  607. Here is an example of a local variables list:
  608. @example
  609. ;;; Local Variables: ***
  610. ;;; mode:lisp ***
  611. ;;; comment-column:0 ***
  612. ;;; comment-start: ";;; " ***
  613. ;;; comment-end:"***" ***
  614. ;;; End: ***
  615. @end example
  616. Note that the prefix is @samp{;;; } and the suffix is @samp{ ***}.
  617. Note also that comments in the file begin with and end with the same
  618. strings. Presumably the file contains code in a language which is
  619. enough like Lisp for Lisp mode to be useful but in which comments
  620. start and end differently. The prefix and suffix are used in the local
  621. variables list to make the list look like several lines of comments when
  622. the compiler or interpreter for that language reads the file.
  623. The start of the local variables list must be no more than 3000
  624. characters from the end of the file, and must be in the last page if the
  625. file is divided into pages. Otherwise, Emacs will not notice it is
  626. there. The purpose is twofold: a stray @samp{Local Variables:}@: not in
  627. the last page does not confuse Emacs, and Emacs never needs to search a
  628. long file that contains no page markers and has no local variables list.
  629. You may be tempted to turn on Auto Fill mode with a local variable
  630. list. That is inappropriate. Whether you use Auto Fill mode or not is
  631. a matter of personal taste, not a matter of the contents of particular
  632. files. If you want to use Auto Fill, set up major mode hooks with your
  633. init file to turn it on (when appropriate) for you alone
  634. (@pxref{Init File}). Don't try to use a local variable list that would
  635. impose your taste on everyone working with the file.
  636. XEmacs allows you to specify local variables in the first line
  637. of a file, in addition to specifying them in the @code{Local Variables}
  638. section at the end of a file.
  639. If the first line of a file contains two occurrences of @code{`-*-'},
  640. XEmacs uses the information between them to determine what the major
  641. mode and variable settings should be. For example, these are all legal:
  642. @example
  643. ;;; -*- mode: emacs-lisp -*-
  644. ;;; -*- mode: postscript; version-control: never -*-
  645. ;;; -*- tags-file-name: "/foo/bar/TAGS" -*-
  646. @end example
  647. For historical reasons, the syntax @code{`-*- modename -*-'} is allowed
  648. as well; for example, you can use:
  649. @example
  650. ;;; -*- emacs-lisp -*-
  651. @end example
  652. @vindex enable-local-variables
  653. The variable @code{enable-local-variables} controls the use of local
  654. variables lists in files you visit. The value can be @code{t},
  655. @code{nil}, or something else. A value of @code{t} means local variables
  656. lists are obeyed; @code{nil} means they are ignored; anything else means
  657. query.
  658. The command @code{M-x normal-mode} always obeys local variables lists
  659. and ignores this variable.
  660. @node Keyboard Macros
  661. @section Keyboard Macros
  662. @cindex keyboard macros
  663. A @dfn{keyboard macro} is a command defined by the user to abbreviate a
  664. sequence of keys. For example, if you discover that you are about to type
  665. @kbd{C-n C-d} forty times, you can speed your work by defining a keyboard
  666. macro to invoke @kbd{C-n C-d} and calling it with a repeat count of forty.
  667. @c widecommands
  668. @table @kbd
  669. @item C-x (
  670. Start defining a keyboard macro (@code{start-kbd-macro}).
  671. @item C-x )
  672. End the definition of a keyboard macro (@code{end-kbd-macro}).
  673. @item C-x e
  674. Execute the most recent keyboard macro (@code{call-last-kbd-macro}).
  675. @item C-u C-x (
  676. Re-execute last keyboard macro, then add more keys to its definition.
  677. @item C-x q
  678. When this point is reached during macro execution, ask for confirmation
  679. (@code{kbd-macro-query}).
  680. @item M-x name-last-kbd-macro
  681. Give a command name (for the duration of the session) to the most
  682. recently defined keyboard macro.
  683. @item M-x insert-kbd-macro
  684. Insert in the buffer a keyboard macro's definition, as Lisp code.
  685. @end table
  686. Keyboard macros differ from other Emacs commands in that they are
  687. written in the Emacs command language rather than in Lisp. This makes it
  688. easier for the novice to write them and makes them more convenient as
  689. temporary hacks. However, the Emacs command language is not powerful
  690. enough as a programming language to be useful for writing anything
  691. general or complex. For such things, Lisp must be used.
  692. You define a keyboard macro by executing the commands which are its
  693. definition. Put differently, as you are defining a keyboard macro, the
  694. definition is being executed for the first time. This way, you see
  695. what the effects of your commands are, and don't have to figure
  696. them out in your head. When you are finished, the keyboard macro is
  697. defined and also has been executed once. You can then execute the same
  698. set of commands again by invoking the macro.
  699. @menu
  700. * Basic Kbd Macro:: Defining and running keyboard macros.
  701. * Save Kbd Macro:: Giving keyboard macros names; saving them in files.
  702. * Kbd Macro Query:: Keyboard macros that do different things each use.
  703. @end menu
  704. @node Basic Kbd Macro
  705. @subsection Basic Use
  706. @kindex C-x (
  707. @kindex C-x )
  708. @kindex C-x e
  709. @findex start-kbd-macro
  710. @findex end-kbd-macro
  711. @findex call-last-kbd-macro
  712. To start defining a keyboard macro, type @kbd{C-x (}
  713. (@code{start-kbd-macro}). From then on, anything you type continues to be
  714. executed, but also becomes part of the definition of the macro. @samp{Def}
  715. appears in the mode line to remind you of what is going on. When you are
  716. finished, the @kbd{C-x )} command (@code{end-kbd-macro}) terminates the
  717. definition, without becoming part of it.
  718. For example,
  719. @example
  720. C-x ( M-f foo C-x )
  721. @end example
  722. @noindent
  723. defines a macro to move forward a word and then insert @samp{foo}.
  724. You can give @kbd{C-x )} a repeat count as an argument, in which case it
  725. repeats the macro that many times right after defining it, but defining
  726. the macro counts as the first repetition (since it is executed as you
  727. define it). If you give @kbd{C-x )} an argument of 4, it executes the
  728. macro immediately 3 additional times. An argument of zero to @kbd{C-x
  729. e} or @kbd{C-x )} means repeat the macro indefinitely (until it gets an
  730. error or you type @kbd{C-g}).
  731. Once you have defined a macro, you can invoke it again with the
  732. @kbd{C-x e} command (@code{call-last-kbd-macro}). You can give the
  733. command a repeat count numeric argument to execute the macro many times.
  734. To repeat an operation at regularly spaced places in the
  735. text, define a macro and include as part of the macro the commands to move
  736. to the next place you want to use it. For example, if you want to change
  737. each line, you should position point at the start of a line, and define a
  738. macro to change that line and leave point at the start of the next line.
  739. Repeating the macro will then operate on successive lines.
  740. After you have terminated the definition of a keyboard macro, you can add
  741. to the end of its definition by typing @kbd{C-u C-x (}. This is equivalent
  742. to plain @kbd{C-x (} followed by retyping the whole definition so far. As
  743. a consequence it re-executes the macro as previously defined.
  744. @node Save Kbd Macro
  745. @subsection Naming and Saving Keyboard Macros
  746. @findex name-last-kbd-macro
  747. To save a keyboard macro for longer than until you define the
  748. next one, you must give it a name using @kbd{M-x name-last-kbd-macro}.
  749. This reads a name as an argument using the minibuffer and defines that name
  750. to execute the macro. The macro name is a Lisp symbol, and defining it in
  751. this way makes it a valid command name for calling with @kbd{M-x} or for
  752. binding a key to with @code{global-set-key} (@pxref{Keymaps}). If you
  753. specify a name that has a prior definition other than another keyboard
  754. macro, Emacs prints an error message and nothing is changed.
  755. @findex insert-kbd-macro
  756. Once a macro has a command name, you can save its definition in a file.
  757. You can then use it in another editing session. First visit the file
  758. you want to save the definition in. Then use the command:
  759. @example
  760. M-x insert-kbd-macro @key{RET} @var{macroname} @key{RET}
  761. @end example
  762. @noindent
  763. This inserts some Lisp code that, when executed later, will define the same
  764. macro with the same definition it has now. You need not understand Lisp
  765. code to do this, because @code{insert-kbd-macro} writes the Lisp code for you.
  766. Then save the file. You can load the file with @code{load-file}
  767. (@pxref{Lisp Libraries}). If the file you save in is your initialization file
  768. (@pxref{Init File}), then the macro will be defined each
  769. time you run Emacs.
  770. If you give @code{insert-kbd-macro} a prefix argument, it creates
  771. additional Lisp code to record the keys (if any) that you have bound to the
  772. keyboard macro, so that the macro is reassigned the same keys when you
  773. load the file.
  774. @node Kbd Macro Query
  775. @subsection Executing Macros With Variations
  776. @kindex C-x q
  777. @findex kbd-macro-query
  778. You can use @kbd{C-x q} (@code{kbd-macro-query}), to get an effect similar
  779. to that of @code{query-replace}. The macro asks you each time
  780. whether to make a change. When you are defining the macro, type @kbd{C-x
  781. q} at the point where you want the query to occur. During macro
  782. definition, the @kbd{C-x q} does nothing, but when you invoke the macro,
  783. @kbd{C-x q} reads a character from the terminal to decide whether to
  784. continue.
  785. The special answers to a @kbd{C-x q} query are @key{SPC}, @key{DEL},
  786. @kbd{C-d}, @kbd{C-l}, and @kbd{C-r}. Any other character terminates
  787. execution of the keyboard macro and is then read as a command.
  788. @key{SPC} means to continue. @key{DEL} means to skip the remainder of
  789. this repetition of the macro, starting again from the beginning in the
  790. next repetition. @kbd{C-d} means to skip the remainder of this
  791. repetition and cancel further repetition. @kbd{C-l} redraws the frame
  792. and asks you again for a character to specify what to do. @kbd{C-r} enters
  793. a recursive editing level, in which you can perform editing that is not
  794. part of the macro. When you exit the recursive edit using @kbd{C-M-c},
  795. you are asked again how to continue with the keyboard macro. If you
  796. type a @key{SPC} at this time, the rest of the macro definition is
  797. executed. It is up to you to leave point and the text in a state such
  798. that the rest of the macro will do what you want.@refill
  799. @kbd{C-u C-x q}, which is @kbd{C-x q} with a numeric argument, performs a
  800. different function. It enters a recursive edit reading input from the
  801. keyboard, both when you type it during the definition of the macro and
  802. when it is executed from the macro. During definition, the editing you do
  803. inside the recursive edit does not become part of the macro. During macro
  804. execution, the recursive edit gives you a chance to do some particularized
  805. editing. @xref{Recursive Edit}.
  806. @node Key Bindings
  807. @section Customizing Key Bindings
  808. This section deals with the @dfn{keymaps} that define the bindings
  809. between keys and functions, and shows how you can customize these bindings.
  810. @cindex command
  811. @cindex function
  812. @cindex command name
  813. A command is a Lisp function whose definition provides for interactive
  814. use. Like every Lisp function, a command has a function name, which is
  815. a Lisp symbol whose name usually consists of lower case letters and
  816. hyphens.
  817. @menu
  818. * Keymaps:: Definition of the keymap data structure.
  819. Names of Emacs's standard keymaps.
  820. * Rebinding:: How to redefine one key's meaning conveniently.
  821. * Disabling:: Disabling a command means confirmation is required
  822. before it can be executed. This is done to protect
  823. beginners from surprises.
  824. @end menu
  825. @node Keymaps
  826. @subsection Keymaps
  827. @cindex keymap
  828. @cindex global keymap
  829. @vindex global-map
  830. The bindings between characters and command functions are recorded in
  831. data structures called @dfn{keymaps}. Emacs has many of these. One, the
  832. @dfn{global} keymap, defines the meanings of the single-character keys that
  833. are defined regardless of major mode. It is the value of the variable
  834. @code{global-map}.
  835. @cindex local keymap
  836. @vindex c-mode-map
  837. @vindex lisp-mode-map
  838. Each major mode has another keymap, its @dfn{local keymap}, which
  839. contains overriding definitions for the single-character keys that are
  840. redefined in that mode. Each buffer records which local keymap is
  841. installed for it at any time, and the current buffer's local keymap is
  842. the only one that directly affects command execution. The local keymaps
  843. for Lisp mode, C mode, and many other major modes always exist even when
  844. not in use. They are the values of the variables @code{lisp-mode-map},
  845. @code{c-mode-map}, and so on. For less frequently used major modes, the
  846. local keymap is sometimes constructed only when the mode is used for the
  847. first time in a session, to save space.
  848. @cindex minibuffer
  849. @vindex minibuffer-local-map
  850. @vindex minibuffer-local-ns-map
  851. @vindex minibuffer-local-completion-map
  852. @vindex minibuffer-local-must-match-map
  853. @vindex repeat-complex-command-map
  854. @vindex isearch-mode-map
  855. There are local keymaps for the minibuffer, too; they contain various
  856. completion and exit commands.
  857. @itemize @bullet
  858. @item
  859. @code{minibuffer-local-map} is used for ordinary input (no completion).
  860. @item
  861. @code{minibuffer-local-ns-map} is similar, except that @key{SPC} exits
  862. just like @key{RET}. This is used mainly for Mocklisp compatibility.
  863. @item
  864. @code{minibuffer-local-completion-map} is for permissive completion.
  865. @item
  866. @code{minibuffer-local-must-match-map} is for strict completion and
  867. for cautious completion.
  868. @item
  869. @code{repeat-complex-command-map} is for use in @kbd{C-x @key{ESC} @key{ESC}}.
  870. @item
  871. @code{isearch-mode-map} contains the bindings of the special keys which
  872. are bound in the pseudo-mode entered with @kbd{C-s} and @kbd{C-r}.
  873. @end itemize
  874. @vindex ctl-x-map
  875. @vindex help-map
  876. @vindex esc-map
  877. Finally, each prefix key has a keymap which defines the key sequences
  878. that start with it. For example, @code{ctl-x-map} is the keymap used for
  879. characters following a @kbd{C-x}.
  880. @itemize @bullet
  881. @item
  882. @code{ctl-x-map} is the variable name for the map used for characters that
  883. follow @kbd{C-x}.
  884. @item
  885. @code{help-map} is used for characters that follow @kbd{C-h}.
  886. @item
  887. @code{esc-map} is for characters that follow @key{ESC}. All Meta
  888. characters are actually defined by this map.
  889. @item
  890. @code{ctl-x-4-map} is for characters that follow @kbd{C-x 4}.
  891. @item
  892. @code{mode-specific-map} is for characters that follow @kbd{C-c}.
  893. @end itemize
  894. The definition of a prefix key is the keymap to use for looking up
  895. the following character. Sometimes the definition is actually a Lisp
  896. symbol whose function definition is the following character keymap. The
  897. effect is the same, but it provides a command name for the prefix key that
  898. you can use as a description of what the prefix key is for. Thus the
  899. binding of @kbd{C-x} is the symbol @code{Ctl-X-Prefix}, whose function
  900. definition is the keymap for @kbd{C-x} commands, the value of
  901. @code{ctl-x-map}.@refill
  902. Prefix key definitions can appear in either the global
  903. map or a local map. The definitions of @kbd{C-c}, @kbd{C-x}, @kbd{C-h},
  904. and @key{ESC} as prefix keys appear in the global map, so these prefix
  905. keys are always available. Major modes can locally redefine a key as a
  906. prefix by putting a prefix key definition for it in the local
  907. map.@refill
  908. A mode can also put a prefix definition of a global prefix character such
  909. as @kbd{C-x} into its local map. This is how major modes override the
  910. definitions of certain keys that start with @kbd{C-x}. This case is
  911. special, because the local definition does not entirely replace the global
  912. one. When both the global and local definitions of a key are other
  913. keymaps, the next character is looked up in both keymaps, with the local
  914. definition overriding the global one. The character after the
  915. @kbd{C-x} is looked up in both the major mode's own keymap for redefined
  916. @kbd{C-x} commands and in @code{ctl-x-map}. If the major mode's own keymap
  917. for @kbd{C-x} commands contains @code{nil}, the definition from the global
  918. keymap for @kbd{C-x} commands is used.@refill
  919. @node Rebinding
  920. @subsection Changing Key Bindings
  921. @cindex key rebinding, this session
  922. @cindex rebinding keys, this session
  923. You can redefine an Emacs key by changing its entry in a keymap.
  924. You can change the global keymap, in which case the change is effective in
  925. all major modes except those that have their own overriding local
  926. definitions for the same key. Or you can change the current buffer's
  927. local map, which affects all buffers using the same major mode.
  928. @menu
  929. * Interactive Rebinding:: Changing Key Bindings Interactively
  930. * Programmatic Rebinding:: Changing Key Bindings Programmatically
  931. * Key Bindings Using Strings:: Using Strings for Changing Key Bindings
  932. @end menu
  933. @node Interactive Rebinding
  934. @subsubsection Changing Key Bindings Interactively
  935. @findex global-set-key
  936. @findex local-set-key
  937. @findex local-unset-key
  938. @table @kbd
  939. @item M-x global-set-key @key{RET} @var{key} @var{cmd} @key{RET}
  940. Defines @var{key} globally to run @var{cmd}.
  941. @item M-x local-set-key @key{RET} @var{keys} @var{cmd} @key{RET}
  942. Defines @var{key} locally (in the major mode now in effect) to run
  943. @var{cmd}.
  944. @item M-x local-unset-key @key{RET} @var{keys} @key{RET}
  945. Removes the local binding of @var{key}.
  946. @end table
  947. @var{cmd} is a symbol naming an interactively-callable function.
  948. When called interactively, @var{key} is the next complete key sequence
  949. that you type. When called as a function, @var{key} is a string, a
  950. vector of events, or a vector of key-description lists as described in
  951. the @code{define-key} function description. The binding goes in
  952. the current buffer's local map, which is shared with other buffers in
  953. the same major mode.
  954. The following example:
  955. @example
  956. M-x global-set-key @key{RET} C-f next-line @key{RET}
  957. @end example
  958. @noindent
  959. redefines @kbd{C-f} to move down a line. The fact that @var{cmd} is
  960. read second makes it serve as a kind of confirmation for @var{key}.
  961. These functions offer no way to specify a particular prefix keymap as
  962. the one to redefine in, but that is not necessary, as you can include
  963. prefixes in @var{key}. @var{key} is read by reading characters one by
  964. one until they amount to a complete key (that is, not a prefix key).
  965. Thus, if you type @kbd{C-f} for @var{key}, Emacs enters
  966. the minibuffer immediately to read @var{cmd}. But if you type
  967. @kbd{C-x}, another character is read; if that character is @kbd{4},
  968. another character is read, and so on. For example,@refill
  969. @example
  970. M-x global-set-key @key{RET} C-x 4 $ spell-other-window @key{RET}
  971. @end example
  972. @noindent
  973. redefines @kbd{C-x 4 $} to run the (fictitious) command
  974. @code{spell-other-window}.
  975. @findex define-key
  976. @findex substitute-key-definition
  977. The most general way to modify a keymap is the function
  978. @code{define-key}, used in Lisp code (such as your init file).
  979. @code{define-key} takes three arguments: the keymap, the key to modify
  980. in it, and the new definition. @xref{Init File}, for an example.
  981. @code{substitute-key-definition} is used similarly; it takes three
  982. arguments, an old definition, a new definition, and a keymap, and
  983. redefines in that keymap all keys that were previously defined with the
  984. old definition to have the new definition instead.
  985. @node Programmatic Rebinding
  986. @subsubsection Changing Key Bindings Programmatically
  987. You can use the functions @code{global-set-key} and @code{define-key}
  988. to rebind keys under program control.
  989. @findex define-key
  990. @findex global-set-key
  991. @table @kbd
  992. @item @code{(global-set-key @var{keys} @var{cmd})}
  993. Defines @var{keys} globally to run @var{cmd}.
  994. @item @code{(define-key @var{keymap} @var{keys} @var{def})}
  995. Defines @var{keys} to run @var{def} in the keymap @var{keymap}.
  996. @end table
  997. @var{keymap} is a keymap object.
  998. @var{keys} is the sequence of keystrokes to bind.
  999. @var{def} is anything that can be a key's definition:
  1000. @itemize @bullet
  1001. @item
  1002. @code{nil}, meaning key is undefined in this keymap
  1003. @item
  1004. A command, that is, a Lisp function suitable for interactive calling
  1005. @item
  1006. A string or key sequence vector, which is treated as a keyboard macro
  1007. @item
  1008. A keymap to define a prefix key
  1009. @item
  1010. A symbol so that when the key is looked up, the symbol stands for its
  1011. function definition, which should at that time be one of the above,
  1012. or another symbol whose function definition is used, and so on
  1013. @item
  1014. A cons, @code{(string . defn)}, meaning that @var{defn} is the definition
  1015. (@var{defn} should be a valid definition in its own right)
  1016. @item
  1017. A cons, @code{(keymap . char)}, meaning use the definition of
  1018. @var{char} in map @var{keymap}
  1019. @end itemize
  1020. For backward compatibility, XEmacs allows you to specify key
  1021. sequences as strings. However, the preferred method is to use the
  1022. representations of key sequences as vectors of keystrokes.
  1023. @xref{Keystrokes}, for more information about the rules for constructing
  1024. key sequences.
  1025. Emacs allows you to abbreviate representations for key sequences in
  1026. most places where there is no ambiguity.
  1027. Here are some rules for abbreviation:
  1028. @itemize @bullet
  1029. @item
  1030. The keysym by itself is equivalent to a list of just that keysym, i.e.,
  1031. @code{f1} is equivalent to @code{(f1)}.
  1032. @item
  1033. A keystroke by itself is equivalent to a vector containing just that
  1034. keystroke, i.e., @code{(control a)} is equivalent to @code{[(control a)]}.
  1035. @item
  1036. You can use ASCII codes for keysyms that have them. i.e.,
  1037. @code{65} is equivalent to @code{A}. (This is not so much an
  1038. abbreviation as an alternate representation.)
  1039. @end itemize
  1040. Here are some examples of programmatically binding keys:
  1041. @example
  1042. ;;; Bind @code{my-command} to @key{f1}
  1043. (global-set-key 'f1 'my-command)
  1044. ;;; Bind @code{my-command} to @kbd{Shift-f1}
  1045. (global-set-key '(shift f1) 'my-command)
  1046. ;;; Bind @code{my-command} to @kbd{C-c Shift-f1}
  1047. (global-set-key '[(control c) (shift f1)] 'my-command)
  1048. ;;; Bind @code{my-command} to the middle mouse button.
  1049. (global-set-key 'button2 'my-command)
  1050. ;;; Bind @code{my-command} to @kbd{@key{META} @key{CTL} @key{Right Mouse Button}}
  1051. ;;; in the keymap that is in force when you are running @code{dired}.
  1052. (define-key dired-mode-map '(meta control button3) 'my-command)
  1053. @end example
  1054. @comment ;; note that these next four lines are not synonymous:
  1055. @comment ;;
  1056. @comment (global-set-key '(meta control delete) 'my-command)
  1057. @comment (global-set-key '(meta control backspace) 'my-command)
  1058. @comment (global-set-key '(meta control h) 'my-command)
  1059. @comment (global-set-key '(meta control H) 'my-command)
  1060. @comment
  1061. @comment ;; note that this binds two key sequences: ``control-j'' and ``linefeed''.
  1062. @comment ;;
  1063. @comment (global-set-key "\^J" 'my-command)
  1064. @node Key Bindings Using Strings
  1065. @subsubsection Using Strings for Changing Key Bindings
  1066. For backward compatibility, you can still use strings to represent
  1067. key sequences. Thus you can use commands like the following:
  1068. @example
  1069. ;;; Bind @code{end-of-line} to @kbd{C-f}
  1070. (global-set-key "\C-f" 'end-of-line)
  1071. @end example
  1072. Note, however, that in some cases you may be binding more than one
  1073. key sequence by using a single command. This situation can
  1074. arise because in ASCII, @kbd{C-i} and @key{TAB} have
  1075. the same representation. Therefore, when Emacs sees:
  1076. @example
  1077. (global-set-key "\C-i" 'end-of-line)
  1078. @end example
  1079. it is unclear whether the user intended to bind @kbd{C-i} or @key{TAB}.
  1080. The solution XEmacs adopts is to bind both of these key
  1081. sequences.
  1082. @cindex redefining keys
  1083. After binding a command to two key sequences with a form like:
  1084. @example
  1085. (define-key global-map "\^X\^I" 'command-1)
  1086. @end example
  1087. it is possible to redefine only one of those sequences like so:
  1088. @example
  1089. (define-key global-map [(control x) (control i)] 'command-2)
  1090. (define-key global-map [(control x) tab] 'command-3)
  1091. @end example
  1092. This applies only when running under a window system. If you are
  1093. talking to Emacs through an ASCII-only channel, you do not get any of
  1094. these features.
  1095. Here is a table of pairs of key sequences that behave in a
  1096. similar fashion:
  1097. @example
  1098. control h backspace
  1099. control l clear
  1100. control i tab
  1101. control m return
  1102. control j linefeed
  1103. control [ escape
  1104. control @@ control space
  1105. @end example
  1106. @node Disabling
  1107. @subsection Disabling Commands
  1108. @cindex disabled command
  1109. Disabling a command marks it as requiring confirmation before it
  1110. can be executed. The purpose of disabling a command is to prevent
  1111. beginning users from executing it by accident and being confused.
  1112. The direct mechanism for disabling a command is to have a non-@code{nil}
  1113. @code{disabled} property on the Lisp symbol for the command. These
  1114. properties are normally set by the user's init file with
  1115. Lisp expressions such as:
  1116. @example
  1117. (put 'delete-region 'disabled t)
  1118. @end example
  1119. @xref{Init File}.
  1120. If the value of the @code{disabled} property is a string, that string
  1121. is included in the message printed when the command is used:
  1122. @example
  1123. (put 'delete-region 'disabled
  1124. "Text deleted this way cannot be yanked back!\n")
  1125. @end example
  1126. @findex disable-command
  1127. @findex enable-command
  1128. You can disable a command either by editing the init file
  1129. directly or with the command @kbd{M-x disable-command}, which edits the
  1130. init file for you. @xref{Init File}.
  1131. When you attempt to invoke a disabled command interactively in Emacs,
  1132. a window is displayed containing the command's name, its
  1133. documentation, and some instructions on what to do next; then
  1134. Emacs asks for input saying whether to execute the command as requested,
  1135. enable it and execute, or cancel it. If you decide to enable the
  1136. command, you are asked whether to do this permanently or just for the
  1137. current session. Enabling permanently works by automatically editing
  1138. your init file. You can use @kbd{M-x enable-command} at any
  1139. time to enable any command permanently.
  1140. Whether a command is disabled is independent of what key is used to
  1141. invoke it; it also applies if the command is invoked using @kbd{M-x}.
  1142. Disabling a command has no effect on calling it as a function from Lisp
  1143. programs.
  1144. @node Syntax
  1145. @section The Syntax Table
  1146. @cindex syntax table
  1147. All the Emacs commands which parse words or balance parentheses are
  1148. controlled by the @dfn{syntax table}. The syntax table specifies which
  1149. characters are opening delimiters, which are parts of words, which are
  1150. string quotes, and so on. Actually, each major mode has its own syntax
  1151. table (though sometimes related major modes use the same one) which it
  1152. installs in each buffer that uses that major mode. The syntax table
  1153. installed in the current buffer is the one that all commands use, so we
  1154. call it ``the'' syntax table. A syntax table is a Lisp object, a vector of
  1155. length 256 whose elements are numbers.
  1156. @menu
  1157. * Entry: Syntax Entry. What the syntax table records for each character.
  1158. * Change: Syntax Change. How to change the information.
  1159. @end menu
  1160. @node Syntax Entry
  1161. @subsection Information About Each Character
  1162. The syntax table entry for a character is a number that encodes six
  1163. pieces of information:
  1164. @itemize @bullet
  1165. @item
  1166. The syntactic class of the character, represented as a small integer
  1167. @item
  1168. The matching delimiter, for delimiter characters only
  1169. (the matching delimiter of @samp{(} is @samp{)}, and vice versa)
  1170. @item
  1171. A flag saying whether the character is the first character of a
  1172. two-character comment starting sequence
  1173. @item
  1174. A flag saying whether the character is the second character of a
  1175. two-character comment starting sequence
  1176. @item
  1177. A flag saying whether the character is the first character of a
  1178. two-character comment ending sequence
  1179. @item
  1180. A flag saying whether the character is the second character of a
  1181. two-character comment ending sequence
  1182. @end itemize
  1183. The syntactic classes are stored internally as small integers, but are
  1184. usually described to or by the user with characters. For example, @samp{(}
  1185. is used to specify the syntactic class of opening delimiters. Here is a
  1186. table of syntactic classes, with the characters that specify them.
  1187. @table @samp
  1188. @item @w{-}
  1189. The class of whitespace characters. Please don't use the formerly
  1190. advertised @w{ }, which is not supported by GNU Emacs.
  1191. @item w
  1192. The class of word-constituent characters.
  1193. @item _
  1194. The class of characters that are part of symbol names but not words.
  1195. This class is represented by @samp{_} because the character @samp{_}
  1196. has this class in both C and Lisp.
  1197. @item .
  1198. The class of punctuation characters that do not fit into any other
  1199. special class.
  1200. @item (
  1201. The class of opening delimiters.
  1202. @item )
  1203. The class of closing delimiters.
  1204. @item '
  1205. The class of expression-adhering characters. These characters are
  1206. part of a symbol if found within or adjacent to one, and are part
  1207. of a following expression if immediately preceding one, but are like
  1208. whitespace if surrounded by whitespace.
  1209. @item "
  1210. The class of string-quote characters. They match each other in pairs,
  1211. and the characters within the pair all lose their syntactic
  1212. significance except for the @samp{\} and @samp{/} classes of escape
  1213. characters, which can be used to include a string-quote inside the
  1214. string.
  1215. @item $
  1216. The class of self-matching delimiters. This is intended for @TeX{}'s
  1217. @samp{$}, which is used both to enter and leave math mode. Thus,
  1218. a pair of matching @samp{$} characters surround each piece of math mode
  1219. @TeX{} input. A pair of adjacent @samp{$} characters act like a single
  1220. one for purposes of matching.
  1221. @item /
  1222. The class of escape characters that always just deny the following
  1223. character its special syntactic significance. The character after one
  1224. of these escapes is always treated as alphabetic.
  1225. @item \
  1226. The class of C-style escape characters. In practice, these are
  1227. treated just like @samp{/}-class characters, because the extra
  1228. possibilities for C escapes (such as being followed by digits) have no
  1229. effect on where the containing expression ends.
  1230. @item <
  1231. The class of comment-starting characters. Only single-character
  1232. comment starters (such as @samp{;} in Lisp mode) are represented this
  1233. way.
  1234. @item >
  1235. The class of comment-ending characters. Newline has this syntax in
  1236. Lisp mode.
  1237. @end table
  1238. @vindex parse-sexp-ignore-comments
  1239. The characters flagged as part of two-character comment delimiters can
  1240. have other syntactic functions most of the time. For example, @samp{/} and
  1241. @samp{*} in C code, when found separately, have nothing to do with
  1242. comments. The comment-delimiter significance overrides when the pair of
  1243. characters occur together in the proper order. Only the list and sexp
  1244. commands use the syntax table to find comments; the commands specifically
  1245. for comments have other variables that tell them where to find comments.
  1246. Moreover, the list and sexp commands notice comments only if
  1247. @code{parse-sexp-ignore-comments} is non-@code{nil}. This variable is set
  1248. to @code{nil} in modes where comment-terminator sequences are liable to
  1249. appear where there is no comment, for example, in Lisp mode where the
  1250. comment terminator is a newline but not every newline ends a comment.
  1251. @node Syntax Change
  1252. @subsection Altering Syntax Information
  1253. It is possible to alter a character's syntax table entry by storing a new
  1254. number in the appropriate element of the syntax table, but it would be hard
  1255. to determine what number to use. Emacs therefore provides a command that
  1256. allows you to specify the syntactic properties of a character in a
  1257. convenient way.
  1258. @findex modify-syntax-entry
  1259. @kbd{M-x modify-syntax-entry} is the command to change a character's
  1260. syntax. It can be used interactively and is also used by major
  1261. modes to initialize their own syntax tables. Its first argument is the
  1262. character to change. The second argument is a string that specifies the
  1263. new syntax. When called from Lisp code, there is a third, optional
  1264. argument, which specifies the syntax table in which to make the change. If
  1265. not supplied, or if this command is called interactively, the third
  1266. argument defaults to the current buffer's syntax table.
  1267. @enumerate
  1268. @item
  1269. The first character in the string specifies the syntactic class. It
  1270. is one of the characters in the previous table (@pxref{Syntax Entry}).
  1271. @item
  1272. The second character is the matching delimiter. For a character that
  1273. is not an opening or closing delimiter, this should be a space, and may
  1274. be omitted if no following characters are needed.
  1275. @item
  1276. The remaining characters are flags. The flag characters allowed are:
  1277. @table @samp
  1278. @item 1
  1279. Flag this character as the first of a two-character comment starting sequence.
  1280. @item 2
  1281. Flag this character as the second of a two-character comment starting sequence.
  1282. @item 3
  1283. Flag this character as the first of a two-character comment ending sequence.
  1284. @item 4
  1285. Flag this character as the second of a two-character comment ending sequence.
  1286. @end table
  1287. @end enumerate
  1288. @kindex C-h s
  1289. @findex describe-syntax
  1290. Use @kbd{C-h s} (@code{describe-syntax}) to display a description of
  1291. the contents of the current syntax table. The description of each
  1292. character includes both the string you have to pass to
  1293. @code{modify-syntax-entry} to set up that character's current syntax,
  1294. and some English to explain that string if necessary.
  1295. @node Init File
  1296. @section The Init File
  1297. @cindex init file
  1298. @cindex Emacs initialization file
  1299. @cindex key rebinding, permanent
  1300. @cindex rebinding keys, permanently
  1301. When you start Emacs, it normally loads either @file{.xemacs/init.el}
  1302. or the file @file{.emacs} (whichever comes first) in your home directory.
  1303. This file, if it exists, should contain Lisp code. It is called your
  1304. initialization file or @dfn{init file}. Use the command line switch
  1305. @samp{-q} to tell Emacs whether to load an init file (@pxref{Entering
  1306. Emacs}). Use the command line switch @samp{-user-init-file}
  1307. (@pxref{Command Switches}) to tell Emacs to load a different file
  1308. instead of @file{~/.xemacs/init.el}/@file{~/.emacs}.
  1309. When the init file is read, the variable @code{user-init-file} says
  1310. which init file was loaded.
  1311. At some sites there is a @dfn{default init file}, which is the
  1312. library named @file{default.el}, found via the standard search path for
  1313. libraries. The Emacs distribution contains no such library; your site
  1314. may create one for local customizations. If this library exists, it is
  1315. loaded whenever you start Emacs. But your init file, if any, is loaded
  1316. first; if it sets @code{inhibit-default-init} non-@code{nil}, then
  1317. @file{default} is not loaded.
  1318. If you have a large amount of code in your init file, you should
  1319. byte-compile it to @file{~/.xemacs/init.elc} or @file{~/.emacs.elc}.
  1320. @menu
  1321. * Init Syntax:: Syntax of constants in Emacs Lisp.
  1322. * Init Examples:: How to do some things with an init file.
  1323. * Terminal Init:: Each terminal type can have an init file.
  1324. @end menu
  1325. @node Init Syntax
  1326. @subsection Init File Syntax
  1327. The init file contains one or more Lisp function call
  1328. expressions. Each consists of a function name followed by
  1329. arguments, all surrounded by parentheses. For example, @code{(setq
  1330. fill-column 60)} represents a call to the function @code{setq} which is
  1331. used to set the variable @code{fill-column} (@pxref{Filling}) to 60.
  1332. The second argument to @code{setq} is an expression for the new value
  1333. of the variable. This can be a constant, a variable, or a function call
  1334. expression. In the init file, constants are used most of the time.
  1335. They can be:
  1336. @table @asis
  1337. @item Numbers
  1338. Integers are written in decimal, with an optional initial minus sign.
  1339. If a sequence of digits is followed by a period and another sequence
  1340. of digits, it is interpreted as a floating point number.
  1341. The number prefixes @samp{#b}, @samp{#o}, and @samp{#x} are supported to
  1342. represent numbers in binary, octal, and hexadecimal notation (or radix).
  1343. @item Strings
  1344. Lisp string syntax is the same as C string syntax with a few extra
  1345. features. Use a double-quote character to begin and end a string constant.
  1346. Newlines and special characters may be present literally in strings. They
  1347. can also be represented as backslash sequences: @samp{\n} for newline,
  1348. @samp{\b} for backspace, @samp{\r} for return, @samp{\t} for tab,
  1349. @samp{\f} for formfeed (control-l), @samp{\e} for escape, @samp{\\} for a
  1350. backslash, @samp{\"} for a double-quote, or @samp{\@var{ooo}} for the
  1351. character whose octal code is @var{ooo}. Backslash and double-quote are
  1352. the only characters for which backslash sequences are mandatory.
  1353. You can use @samp{\C-} as a prefix for a control character, as in
  1354. @samp{\C-s} for ASCII Control-S, and @samp{\M-} as a prefix for
  1355. a Meta character, as in @samp{\M-a} for Meta-A or @samp{\M-\C-a} for
  1356. Control-Meta-A.@refill
  1357. @item Characters
  1358. Lisp character constant syntax consists of a @samp{?} followed by
  1359. either a character or an escape sequence starting with @samp{\}.
  1360. Examples: @code{?x}, @code{?\n}, @code{?\"}, @code{?\)}. Note that
  1361. strings and characters are not interchangeable in Lisp; some contexts
  1362. require one and some contexts require the other.
  1363. @item True
  1364. @code{t} stands for `true'.
  1365. @item False
  1366. @code{nil} stands for `false'.
  1367. @item Other Lisp objects
  1368. Write a single-quote (') followed by the Lisp object you want.
  1369. @end table
  1370. @node Init Examples
  1371. @subsection Init File Examples
  1372. Here are some examples of doing certain commonly desired things with
  1373. Lisp expressions:
  1374. @itemize @bullet
  1375. @item
  1376. Make @key{TAB} in C mode just insert a tab if point is in the middle of a
  1377. line.
  1378. @example
  1379. (setq c-tab-always-indent nil)
  1380. @end example
  1381. Here we have a variable whose value is normally @code{t} for `true'
  1382. and the alternative is @code{nil} for `false'.
  1383. @item
  1384. Make searches case sensitive by default (in all buffers that do not
  1385. override this).
  1386. @example
  1387. (setq-default case-fold-search nil)
  1388. @end example
  1389. This sets the default value, which is effective in all buffers that do
  1390. not have local values for the variable. Setting @code{case-fold-search}
  1391. with @code{setq} affects only the current buffer's local value, which
  1392. is probably not what you want to do in an init file.
  1393. @item
  1394. Make Text mode the default mode for new buffers.
  1395. @example
  1396. (setq default-major-mode 'text-mode)
  1397. @end example
  1398. Note that @code{text-mode} is used because it is the command for entering
  1399. the mode we want. A single-quote is written before it to make a symbol
  1400. constant; otherwise, @code{text-mode} would be treated as a variable name.
  1401. @item
  1402. Turn on Auto Fill mode automatically in Text mode and related modes.
  1403. @example
  1404. (setq text-mode-hook
  1405. '(lambda () (auto-fill-mode 1)))
  1406. @end example
  1407. Here we have a variable whose value should be a Lisp function. The
  1408. function we supply is a list starting with @code{lambda}, and a single
  1409. quote is written in front of it to make it (for the purpose of this
  1410. @code{setq}) a list constant rather than an expression. Lisp functions
  1411. are not explained here; for mode hooks it is enough to know that
  1412. @code{(auto-fill-mode 1)} is an expression that will be executed when
  1413. Text mode is entered. You could replace it with any other expression
  1414. that you like, or with several expressions in a row.
  1415. @example
  1416. (setq text-mode-hook 'turn-on-auto-fill)
  1417. @end example
  1418. This is another way to accomplish the same result.
  1419. @code{turn-on-auto-fill} is a symbol whose function definition is
  1420. @code{(lambda () (auto-fill-mode 1))}.
  1421. @item
  1422. Load the installed Lisp library named @file{foo} (actually a file
  1423. @file{foo.elc} or @file{foo.el} in a standard Emacs directory).
  1424. @example
  1425. (load "foo")
  1426. @end example
  1427. When the argument to @code{load} is a relative pathname, not starting
  1428. with @samp{/} or @samp{~}, @code{load} searches the directories in
  1429. @code{load-path} (@pxref{Loading}).
  1430. @item
  1431. Load the compiled Lisp file @file{foo.elc} from your home directory.
  1432. @example
  1433. (load "~/foo.elc")
  1434. @end example
  1435. Here an absolute file name is used, so no searching is done.
  1436. @item
  1437. Rebind the key @kbd{C-x l} to run the function @code{make-symbolic-link}.
  1438. @example
  1439. (global-set-key "\C-xl" 'make-symbolic-link)
  1440. @end example
  1441. or
  1442. @example
  1443. (define-key global-map "\C-xl" 'make-symbolic-link)
  1444. @end example
  1445. Note once again the single-quote used to refer to the symbol
  1446. @code{make-symbolic-link} instead of its value as a variable.
  1447. @item
  1448. Do the same thing for C mode only.
  1449. @example
  1450. (define-key c-mode-map "\C-xl" 'make-symbolic-link)
  1451. @end example
  1452. @item
  1453. Bind the function key @key{F1} to a command in C mode.
  1454. Note that the names of function keys must be lower case.
  1455. @example
  1456. (define-key c-mode-map 'f1 'make-symbolic-link)
  1457. @end example
  1458. @item
  1459. Bind the shifted version of @key{F1} to a command.
  1460. @example
  1461. (define-key c-mode-map '(shift f1) 'make-symbolic-link)
  1462. @end example
  1463. @item
  1464. Redefine all keys which now run @code{next-line} in Fundamental mode
  1465. to run @code{forward-line} instead.
  1466. @example
  1467. (substitute-key-definition 'next-line 'forward-line
  1468. global-map)
  1469. @end example
  1470. @item
  1471. Make @kbd{C-x C-v} undefined.
  1472. @example
  1473. (global-unset-key "\C-x\C-v")
  1474. @end example
  1475. One reason to undefine a key is so that you can make it a prefix.
  1476. Simply defining @kbd{C-x C-v @var{anything}} would make @kbd{C-x C-v}
  1477. a prefix, but @kbd{C-x C-v} must be freed of any non-prefix definition
  1478. first.
  1479. @item
  1480. Make @samp{$} have the syntax of punctuation in Text mode.
  1481. Note the use of a character constant for @samp{$}.
  1482. @example
  1483. (modify-syntax-entry ?\$ "." text-mode-syntax-table)
  1484. @end example
  1485. @item
  1486. Enable the use of the command @code{eval-expression} without confirmation.
  1487. @example
  1488. (put 'eval-expression 'disabled nil)
  1489. @end example
  1490. @end itemize
  1491. @node Terminal Init
  1492. @subsection Terminal-Specific Initialization
  1493. Each terminal type can have a Lisp library to be loaded into Emacs when
  1494. it is run on that type of terminal. For a terminal type named
  1495. @var{termtype}, the library is called @file{term/@var{termtype}} and it is
  1496. found by searching the directories @code{load-path} as usual and trying the
  1497. suffixes @samp{.elc} and @samp{.el}. Normally it appears in the
  1498. subdirectory @file{term} of the directory where most Emacs libraries are
  1499. kept.@refill
  1500. The usual purpose of the terminal-specific library is to define the
  1501. escape sequences used by the terminal's function keys using the library
  1502. @file{keypad.el}. See the file
  1503. @file{term/vt100.el} for an example of how this is done.@refill
  1504. When the terminal type contains a hyphen, only the part of the name
  1505. before the first hyphen is significant in choosing the library name.
  1506. Thus, terminal types @samp{aaa-48} and @samp{aaa-30-rv} both use
  1507. the library @file{term/aaa}. The code in the library can use
  1508. @code{(getenv "TERM")} to find the full terminal type name.@refill
  1509. @vindex term-file-prefix
  1510. The library's name is constructed by concatenating the value of the
  1511. variable @code{term-file-prefix} and the terminal type. Your init
  1512. file can prevent the loading of the terminal-specific library by setting
  1513. @code{term-file-prefix} to @code{nil}. @xref{Init File}.
  1514. @vindex term-setup-hook
  1515. The value of the variable @code{term-setup-hook}, if not @code{nil}, is
  1516. called as a function of no arguments at the end of Emacs initialization,
  1517. after both your init file and any terminal-specific library have been
  1518. read. @xref{Init File}. You can set the value in the init file to
  1519. override part of any of the terminal-specific libraries and to define
  1520. initializations for terminals that do not have a library.@refill
  1521. @node Audible Bell
  1522. @section Changing the Bell Sound
  1523. @cindex audible bell, changing
  1524. @cindex bell, changing
  1525. @vindex sound-alist
  1526. @findex load-default-sounds
  1527. @findex play-sound
  1528. You can now change how the audible bell sounds using the variable
  1529. @code{sound-alist}.
  1530. @code{sound-alist}'s value is an list associating symbols with, among
  1531. other things, strings of audio-data. When @code{ding} is called with
  1532. one of the symbols, the associated sound data is played instead of the
  1533. standard beep. This only works if you are logged in on the console of a
  1534. machine with audio hardware. To listen to a sound of the provided type,
  1535. call the function @code{play-sound} with the argument @var{sound}. You
  1536. can also set the volume of the sound with the optional argument
  1537. @var{volume}.@refill
  1538. @cindex ding
  1539. Each element of @code{sound-alist} is a list describing a sound.
  1540. The first element of the list is the name of the sound being defined.
  1541. Subsequent elements of the list are alternating keyword/value pairs:
  1542. @table @code
  1543. @item sound
  1544. A string of raw sound data, or the name of another sound to play.
  1545. The symbol @code{t} here means use the default X beep.
  1546. @item volume
  1547. An integer from 0-100, defaulting to @code{bell-volume}.
  1548. @item pitch
  1549. If using the default X beep, the pitch (Hz) to generate.
  1550. @item duration
  1551. If using the default X beep, the duration (milliseconds).
  1552. @end table
  1553. For compatibility, elements of `sound-alist' may also be of the form:
  1554. @example
  1555. ( @var{sound-name} . @var{<sound>} )
  1556. ( @var{sound-name} @var{<volume>} @var{<sound>} )
  1557. @end example
  1558. You should probably add things to this list by calling the function
  1559. @code{load-sound-file}.
  1560. Note that you can only play audio data if running on the console screen
  1561. of a machine with audio hardware which emacs understands, which at this
  1562. time means a Sun SparcStation, SGI, or HP9000s700.
  1563. Also note that the pitch, duration, and volume options are available
  1564. everywhere, but most X servers ignore the `pitch' option.
  1565. @vindex bell-volume
  1566. The variable @code{bell-volume} should be an integer from 0 to 100,
  1567. with 100 being loudest, which controls how loud the sounds emacs makes
  1568. should be. Elements of the @code{sound-alist} may override this value.
  1569. This variable applies to the standard X bell sound as well as sound files.
  1570. If the symbol @code{t} is in place of a sound-string, Emacs uses the
  1571. default X beep. This allows you to define beep-types of
  1572. different volumes even when not running on the console.
  1573. @findex load-sound-file
  1574. You can add things to this list by calling the function
  1575. @code{load-sound-file}, which reads in an audio-file and adds its data to
  1576. the sound-alist. You can specify the sound with the @var{sound-name}
  1577. argument and the file into which the sounds are loaded with the
  1578. @var{filename} argument. The optional @var{volume} argument sets the
  1579. volume.
  1580. @code{load-sound-file (@var{filename sound-name} &optional @var{volume})}
  1581. To load and install some sound files as beep-types, use the function
  1582. @code{load-default-sounds} (note that this only works if you are on
  1583. display 0 of a machine with audio hardware).
  1584. The following beep-types are used by Emacs itself. Other Lisp
  1585. packages may use other beep types, but these are the ones that the C
  1586. kernel of Emacs uses.
  1587. @table @code
  1588. @item auto-save-error
  1589. An auto-save does not succeed
  1590. @item command-error
  1591. The Emacs command loop catches an error
  1592. @item undefined-key
  1593. You type a key that is undefined
  1594. @item undefined-click
  1595. You use an undefined mouse-click combination
  1596. @item no-completion
  1597. Completion was not possible
  1598. @item y-or-n-p
  1599. You type something other than the required @code{y} or @code{n}
  1600. @item yes-or-no-p
  1601. You type something other than @code{yes} or @code{no}
  1602. @end table
  1603. @comment node-name, next, previous, up
  1604. @node Faces
  1605. @section Faces
  1606. XEmacs has objects called extents and faces. An @dfn{extent}
  1607. is a region of text and a @dfn{face} is a collection of textual
  1608. attributes, such as fonts and colors. Every extent is displayed in some
  1609. face; therefore, changing the properties of a face immediately updates the
  1610. display of all associated extents. Faces can be frame-local: you can
  1611. have a region of text that displays with completely different
  1612. attributes when its buffer is viewed from a different X window.
  1613. The display attributes of faces may be specified either in Lisp or through
  1614. the X resource manager.
  1615. @subsection Customizing Faces
  1616. You can change the face of an extent with the functions in
  1617. this section. All the functions prompt for a @var{face} as an
  1618. argument; use completion for a list of possible values.
  1619. @table @kbd
  1620. @item M-x invert-face
  1621. Swap the foreground and background colors of the given @var{face}.
  1622. @item M-x make-face-bold
  1623. Make the font of the given @var{face} bold. When called from a
  1624. program, returns @code{nil} if this is not possible.
  1625. @item M-x make-face-bold-italic
  1626. Make the font of the given @var{face} bold italic.
  1627. When called from a program, returns @code{nil} if not possible.
  1628. @item M-x make-face-italic
  1629. Make the font of the given @var{face} italic.
  1630. When called from a program, returns @code{nil} if not possible.
  1631. @item M-x make-face-unbold
  1632. Make the font of the given @var{face} non-bold.
  1633. When called from a program, returns @code{nil} if not possible.
  1634. @item M-x make-face-unitalic
  1635. Make the font of the given @var{face} non-italic.
  1636. When called from a program, returns @code{nil} if not possible.
  1637. @item M-x make-face-larger
  1638. Make the font of the given @var{face} a little larger.
  1639. When called from a program, returns @code{nil} if not possible.
  1640. @item M-x make-face-smaller
  1641. Make the font of the given @var{face} a little smaller.
  1642. When called from a program, returns @code{nil} if not possible.
  1643. @item M-x set-face-background
  1644. Change the background color of the given @var{face}.
  1645. @item M-x set-face-background-pixmap
  1646. Change the background pixmap of the given @var{face}.
  1647. @item M-x set-face-font
  1648. Change the font of the given @var{face}.
  1649. @item M-x set-face-foreground
  1650. Change the foreground color of the given @var{face}.
  1651. @item M-x set-face-underline-p
  1652. Change whether the given @var{face} is underlined.
  1653. @end table
  1654. @findex make-face-larger
  1655. @findex make-face-smaller
  1656. @findex invert-face
  1657. You can exchange the foreground and background color of the selected
  1658. @var{face} with the function @code{invert-face}. If the face does not
  1659. specify both foreground and background, then its foreground and
  1660. background are set to the background and foreground of the default face.
  1661. When calling this from a program, you can supply the optional argument
  1662. @var{frame} to specify which frame is affected; otherwise, all frames
  1663. are affected.
  1664. @findex make-face-bold
  1665. @findex make-face-bold-italic
  1666. @findex make-face-italic
  1667. @findex make-face-unbold
  1668. @findex make-face-unitalic
  1669. @vindex face-frob-from-locale-first
  1670. The work of @code{make-face-bold}, @code{make-face-bold-italic},
  1671. @code{make-face-italic}, @code{make-face-unbold},
  1672. @code{make-face-unitalic} functions is affected by
  1673. @code{face-frob-from-locale-first} variable. If it is @code{nil}, those
  1674. functions first try to manipulate device specific data like X font names
  1675. to obtain the desired font face specification. This may be unsuitable
  1676. in environments using different font face specifications for different
  1677. frames, non-Mule environments in particular.
  1678. If the variable is non-@code{nil}, those functions first try to figure
  1679. out whether the face font is the same as one of predefined faces:
  1680. @code{default}, @code{bold}, @code{italic}, @code{bold-italic}. If it
  1681. is the same, then the new face font specification is set to be the same
  1682. as that of a corresponding predefined face. Thus if the predefined face
  1683. is set up properly for different frames, the same will hold for the face
  1684. being changed by the functions. This is the behavior one might desire
  1685. in non-Mule environments mentioned above: face being changed still looks
  1686. right in all frames.
  1687. How predefined faces might be set up for different frames in such an
  1688. environments is described in @ref{Face Resources}.
  1689. @findex set-face-background
  1690. You can set the background color of the specified @var{face} with the
  1691. function @code{set-face-background}. The argument @code{color} should
  1692. be a string, the name of a color. When called from a program, if the
  1693. optional @var{frame} argument is provided, the face is changed only
  1694. in that frame; otherwise, it is changed in all frames.
  1695. @findex set-face-background-pixmap
  1696. You can set the background pixmap of the specified @var{face} with the
  1697. function @code{set-face-background-pixmap}. The pixmap argument
  1698. @var{name} should be a string, the name of a file of pixmap data. The
  1699. directories listed in the @code{x-bitmap-file-path} variable are
  1700. searched. The bitmap may also be a list of the form @code{(@var{width
  1701. height data})}, where @var{width} and @var{height} are the size in
  1702. pixels, and @var{data} is a string containing the raw bits of the
  1703. bitmap. If the optional @var{frame} argument is provided, the face is
  1704. changed only in that frame; otherwise, it is changed in all frames.
  1705. The variable @code{x-bitmap-file-path} takes as a value a list of the
  1706. directories in which X bitmap files may be found. If the value is
  1707. @code{nil}, the list is initialized from the @code{*bitmapFilePath}
  1708. resource.
  1709. If the environment variable @b{XBMLANGPATH} is set, then it is consulted
  1710. before the @code{x-bitmap-file-path} variable.
  1711. @findex set-face-font
  1712. You can set the font of the specified @var{face} with the function
  1713. @code{set-face-font}. The @var{font} argument should be a string, the
  1714. name of a font. When called from a program, if the
  1715. optional @var{frame} argument is provided, the face is changed only
  1716. in that frame; otherwise, it is changed in all frames.
  1717. @findex set-face-foreground
  1718. You can set the foreground color of the specified @var{face} with the
  1719. function @code{set-face-foreground}. The argument @var{color} should be
  1720. a string, the name of a color. If the optional @var{frame} argument is
  1721. provided, the face is changed only in that frame; otherwise, it is
  1722. changed in all frames.
  1723. @findex set-face-underline-p
  1724. You can set underline the specified @var{face} with the function
  1725. @code{set-face-underline-p}. The argument @var{underline-p} can be used
  1726. to make underlining an attribute of the face or not. If the optional
  1727. @var{frame} argument is provided, the face is changed only in that
  1728. frame; otherwise, it is changed in all frames.
  1729. @node Frame Components
  1730. @section Frame Components
  1731. You can control the presence and position of most frame components, such
  1732. as the menubar, toolbars, and gutters.
  1733. This section is not written yet. Try the Lisp Reference Manual:
  1734. @ref{Menubar,,,lispref,}, @ref{Toolbar Intro,,,lispref,}, and
  1735. @ref{Gutter Intro,,,lispref,}.
  1736. @node X Resources
  1737. @section X Resources
  1738. @cindex X resources
  1739. @findex x-create-frame
  1740. Historically, XEmacs has used the X resource application class @samp{Emacs}
  1741. for its resources. Unfortunately, GNU Emacs uses the same application
  1742. class, and resources are not compatible between the two Emacsen. This
  1743. sharing of the application class often leads to trouble if you want to
  1744. run both variants.
  1745. Starting with XEmacs 21, XEmacs uses the class @samp{XEmacs} if it finds
  1746. any XEmacs resources in the resource database when the X connection is
  1747. initialized. Otherwise, it will use the class @samp{Emacs} for
  1748. backwards compatibility. The variable @var{x-emacs-application-class}
  1749. may be consulted to determine the application class being used.
  1750. The examples in this section assume the application class is @samp{Emacs}.
  1751. The Emacs resources are generally set per-frame. Each Emacs frame can have
  1752. its own name or the same name as another, depending on the name passed to the
  1753. @code{make-frame} function.
  1754. You can specify resources for all frames with the syntax:
  1755. @example
  1756. Emacs*parameter: value
  1757. @end example
  1758. @noindent
  1759. or
  1760. @example
  1761. Emacs*EmacsFrame.parameter:value
  1762. @end example
  1763. @noindent
  1764. You can specify resources for a particular frame with the syntax:
  1765. @example
  1766. Emacs*FRAME-NAME.parameter: value
  1767. @end example
  1768. @noindent
  1769. @menu
  1770. * Geometry Resources:: Controlling the size and position of frames.
  1771. * Iconic Resources:: Controlling whether frames come up iconic.
  1772. * Resource List:: List of resources settable on a frame or device.
  1773. * Face Resources:: Controlling faces using resources.
  1774. * Widgets:: The widget hierarchy for XEmacs.
  1775. * Menubar Resources:: Specifying resources for the menubar.
  1776. @end menu
  1777. @node Geometry Resources
  1778. @subsection Geometry Resources
  1779. To make the default size of all Emacs frames be 80 columns by 55 lines,
  1780. do this:
  1781. @example
  1782. Emacs*EmacsFrame.geometry: 80x55
  1783. @end example
  1784. @noindent
  1785. To set the geometry of a particular frame named @samp{fred}, do this:
  1786. @example
  1787. Emacs*fred.geometry: 80x55
  1788. @end example
  1789. @noindent
  1790. Important! Do not use the following syntax:
  1791. @example
  1792. Emacs*geometry: 80x55
  1793. @end example
  1794. @noindent
  1795. You should never use @code{*geometry} with any X application. It does
  1796. not say "make the geometry of Emacs be 80 columns by 55 lines." It
  1797. really says, "make Emacs and all subwindows thereof be 80x55 in whatever
  1798. units they care to measure in." In particular, that is both telling the
  1799. Emacs text pane to be 80x55 in characters, and telling the menubar pane
  1800. to be 80x55 pixels, which is surely not what you want.
  1801. As a special case, this geometry specification also works (and sets the
  1802. default size of all Emacs frames to 80 columns by 55 lines):
  1803. @example
  1804. Emacs.geometry: 80x55
  1805. @end example
  1806. @noindent
  1807. since that is the syntax used with most other applications (since most
  1808. other applications have only one top-level window, unlike Emacs). In
  1809. general, however, the top-level shell (the unmapped ApplicationShell
  1810. widget named @samp{Emacs} that is the parent of the shell widgets that
  1811. actually manage the individual frames) does not have any interesting
  1812. resources on it, and you should set the resources on the frames instead.
  1813. The @code{-geometry} command-line argument sets only the geometry of the
  1814. initial frame created by Emacs.
  1815. A more complete explanation of geometry-handling is
  1816. @itemize @bullet
  1817. @item
  1818. The @code{-geometry} command-line option sets the @code{Emacs.geometry}
  1819. resource, that is, the geometry of the ApplicationShell.
  1820. @item
  1821. For the first frame created, the size of the frame is taken from the
  1822. ApplicationShell if it is specified, otherwise from the geometry of the
  1823. frame.
  1824. @item
  1825. For subsequent frames, the order is reversed: First the frame, and then
  1826. the ApplicationShell.
  1827. @item
  1828. For the first frame created, the position of the frame is taken from the
  1829. ApplicationShell (@code{Emacs.geometry}) if it is specified, otherwise
  1830. from the geometry of the frame.
  1831. @item
  1832. For subsequent frames, the position is taken only from the frame, and
  1833. never from the ApplicationShell.
  1834. @end itemize
  1835. This is rather complicated, but it does seem to provide the most
  1836. intuitive behavior with respect to the default sizes and positions of
  1837. frames created in various ways.
  1838. @node Iconic Resources
  1839. @subsection Iconic Resources
  1840. Analogous to @code{-geometry}, the @code{-iconic} command-line option
  1841. sets the iconic flag of the ApplicationShell (@code{Emacs.iconic}) and
  1842. always applies to the first frame created regardless of its name.
  1843. However, it is possible to set the iconic flag on particular frames (by
  1844. name) by using the @code{Emacs*FRAME-NAME.iconic} resource.
  1845. @node Resource List
  1846. @subsection Resource List
  1847. Emacs frames accept the following resources:
  1848. @table @asis
  1849. @item @code{geometry} (class @code{Geometry}): string
  1850. Initial geometry for the frame. @xref{Geometry Resources}, for a
  1851. complete discussion of how this works.
  1852. @item @code{iconic} (class @code{Iconic}): boolean
  1853. Whether this frame should appear in the iconified state.
  1854. @item @code{internalBorderWidth} (class @code{InternalBorderWidth}): int
  1855. How many blank pixels to leave between the text and the edge of the
  1856. window.
  1857. @item @code{interline} (class @code{Interline}): int
  1858. How many pixels to leave between each line (may not be implemented).
  1859. @item @code{menubar} (class @code{Menubar}): boolean
  1860. Whether newly-created frames should initially have a menubar. Set to
  1861. true by default.
  1862. @item @code{initiallyUnmapped} (class @code{InitiallyUnmapped}): boolean
  1863. Whether XEmacs should leave the initial frame unmapped when it starts
  1864. up. This is useful if you are starting XEmacs as a server (e.g. in
  1865. conjunction with gnuserv or the external client widget). You can also
  1866. control this with the @code{-unmapped} command-line option.
  1867. @item @code{barCursor} (class @code{BarColor}): boolean
  1868. Whether the cursor should be displayed as a bar, or the traditional box.
  1869. @item @code{cursorColor} (class @code{CursorColor}): color-name
  1870. The color of the text cursor.
  1871. @item @code{scrollBarWidth} (class @code{ScrollBarWidth}): integer
  1872. How wide the vertical scrollbars should be, in pixels; 0 means no
  1873. vertical scrollbars. You can also use a resource specification of the
  1874. form @code{*scrollbar.width}, or the usual toolkit scrollbar resources:
  1875. @code{*XmScrollBar.width} (Motif), @code{*XlwScrollBar.width} (Lucid),
  1876. or @code{*Scrollbar.thickness} (Athena). We don't recommend that you
  1877. use the toolkit resources, though, because they're dependent on how
  1878. exactly your particular build of XEmacs was configured.
  1879. @item @code{scrollBarHeight} (class @code{ScrollBarHeight}): integer
  1880. How high the horizontal scrollbars should be, in pixels; 0 means no
  1881. horizontal scrollbars. You can also use a resource specification of the
  1882. form @code{*scrollbar.height}, or the usual toolkit scrollbar resources:
  1883. @code{*XmScrollBar.height} (Motif), @code{*XlwScrollBar.height} (Lucid),
  1884. or @code{*Scrollbar.thickness} (Athena). We don't recommend that you use
  1885. the toolkit resources, though, because they're dependent on how exactly
  1886. your particular build of XEmacs was configured.
  1887. @item @code{scrollBarPlacement} (class @code{ScrollBarPlacement}): string
  1888. Where the horizontal and vertical scrollbars should be positioned. This
  1889. should be one of the four strings @samp{BOTTOM_LEFT},
  1890. @samp{BOTTOM_RIGHT}, @samp{TOP_LEFT}, and @samp{TOP_RIGHT}. Default is
  1891. @samp{BOTTOM_RIGHT} for the Motif and Lucid scrollbars and
  1892. @samp{BOTTOM_LEFT} for the Athena scrollbars.
  1893. @item @code{topToolBarHeight} (class @code{TopToolBarHeight}): integer
  1894. @itemx @code{bottomToolBarHeight} (class @code{BottomToolBarHeight}): integer
  1895. @itemx @code{leftToolBarWidth} (class @code{LeftToolBarWidth}): integer
  1896. @itemx @code{rightToolBarWidth} (class @code{RightToolBarWidth}): integer
  1897. Height and width of the four possible toolbars.
  1898. @item @code{topToolBarShadowColor} (class @code{TopToolBarShadowColor}): color-name
  1899. @itemx @code{bottomToolBarShadowColor} (class @code{BottomToolBarShadowColor}): color-name
  1900. Color of the top and bottom shadows for the toolbars. NOTE: These resources
  1901. do @emph{not} have anything to do with the top and bottom toolbars (i.e. the
  1902. toolbars at the top and bottom of the frame)! Rather, they affect the top
  1903. and bottom shadows around the edges of all four kinds of toolbars.
  1904. @item @code{topToolBarShadowPixmap} (class @code{TopToolBarShadowPixmap}): pixmap-name
  1905. @itemx @code{bottomToolBarShadowPixmap} (class @code{BottomToolBarShadowPixmap}): pixmap-name
  1906. Pixmap of the top and bottom shadows for the toolbars. If set, these
  1907. resources override the corresponding color resources. NOTE: These
  1908. resources do @emph{not} have anything to do with the top and bottom
  1909. toolbars (i.e. the toolbars at the top and bottom of the frame)!
  1910. Rather, they affect the top and bottom shadows around the edges of all
  1911. four kinds of toolbars.
  1912. @item @code{toolBarShadowThickness} (class @code{ToolBarShadowThickness}): integer
  1913. Thickness of the shadows around the toolbars, in pixels.
  1914. @item @code{visualBell} (class @code{VisualBell}): boolean
  1915. Whether XEmacs should flash the screen rather than making an audible beep.
  1916. @item @code{bellVolume} (class @code{BellVolume}): integer
  1917. Volume of the audible beep.
  1918. @item @code{useBackingStore} (class @code{UseBackingStore}): boolean
  1919. Whether XEmacs should set the backing-store attribute of the X windows
  1920. it creates. This increases the memory usage of the X server but decreases
  1921. the amount of X traffic necessary to update the screen, and is useful
  1922. when the connection to the X server goes over a low-bandwidth line
  1923. such as a modem connection.
  1924. @end table
  1925. Emacs devices accept the following resources:
  1926. @table @asis
  1927. @item @code{textPointer} (class @code{Cursor}): cursor-name
  1928. The cursor to use when the mouse is over text. This resource is used to
  1929. initialize the variable @code{x-pointer-shape}.
  1930. @item @code{selectionPointer} (class @code{Cursor}): cursor-name
  1931. The cursor to use when the mouse is over a selectable text region (an
  1932. extent with the @samp{highlight} property; for example, an Info
  1933. cross-reference). This resource is used to initialize the variable
  1934. @code{x-selection-pointer-shape}.
  1935. @item @code{spacePointer} (class @code{Cursor}): cursor-name
  1936. The cursor to use when the mouse is over a blank space in a buffer (that
  1937. is, after the end of a line or after the end-of-file). This resource is
  1938. used to initialize the variable @code{x-nontext-pointer-shape}.
  1939. @item @code{modeLinePointer} (class @code{Cursor}): cursor-name
  1940. The cursor to use when the mouse is over a modeline. This resource is
  1941. used to initialize the variable @code{x-mode-pointer-shape}.
  1942. @item @code{gcPointer} (class @code{Cursor}): cursor-name
  1943. The cursor to display when a garbage-collection is in progress. This
  1944. resource is used to initialize the variable @code{x-gc-pointer-shape}.
  1945. @item @code{scrollbarPointer} (class @code{Cursor}): cursor-name
  1946. The cursor to use when the mouse is over the scrollbar. This resource
  1947. is used to initialize the variable @code{x-scrollbar-pointer-shape}.
  1948. @item @code{pointerColor} (class @code{Foreground}): color-name
  1949. @itemx @code{pointerBackground} (class @code{Background}): color-name
  1950. The foreground and background colors of the mouse cursor. These
  1951. resources are used to initialize the variables
  1952. @code{x-pointer-foreground-color} and @code{x-pointer-background-color}.
  1953. @end table
  1954. @node Face Resources
  1955. @subsection Face Resources
  1956. The attributes of faces are also per-frame. They can be specified as:
  1957. @example
  1958. Emacs.FACE_NAME.parameter: value
  1959. @end example
  1960. @noindent
  1961. or
  1962. @example
  1963. Emacs*FRAME_NAME.FACE_NAME.parameter: value
  1964. @end example
  1965. @noindent
  1966. Faces accept the following resources:
  1967. @table @asis
  1968. @item @code{attributeFont} (class @code{AttributeFont}): font-name
  1969. The font of this face.
  1970. @item @code{attributeForeground} (class @code{AttributeForeground}): color-name
  1971. @itemx @code{attributeBackground} (class @code{AttributeBackground}): color-name
  1972. The foreground and background colors of this face.
  1973. @item @code{attributeBackgroundPixmap} (class @code{AttributeBackgroundPixmap}): file-name
  1974. The name of an @sc{xbm} file (or @sc{xpm} file, if your version of Emacs
  1975. supports @sc{xpm}), to use as a background stipple.
  1976. @item @code{attributeUnderline} (class @code{AttributeUnderline}): boolean
  1977. Whether text in this face should be underlined.
  1978. @end table
  1979. All text is displayed in some face, defaulting to the face named
  1980. @code{default}. To set the font of normal text, use
  1981. @code{Emacs*default.attributeFont}. To set it in the frame named
  1982. @code{fred}, use @code{Emacs*fred.default.attributeFont}.
  1983. These are the names of the predefined faces:
  1984. @table @code
  1985. @item default
  1986. Everything inherits from this.
  1987. @item bold
  1988. If this is not specified in the resource database, Emacs tries to find a
  1989. bold version of the font of the default face.
  1990. @item italic
  1991. If this is not specified in the resource database, Emacs tries to find
  1992. an italic version of the font of the default face.
  1993. @item bold-italic
  1994. If this is not specified in the resource database, Emacs tries to find a
  1995. bold-italic version of the font of the default face.
  1996. @item modeline
  1997. This is the face that the modeline is displayed in. If not specified in
  1998. the resource database, it is determined from the default face by
  1999. reversing the foreground and background colors.
  2000. @item highlight
  2001. This is the face that highlighted extents (for example, Info
  2002. cross-references and possible completions, when the mouse passes over
  2003. them) are displayed in.
  2004. @item left-margin
  2005. @itemx right-margin
  2006. These are the faces that the left and right annotation margins are
  2007. displayed in.
  2008. @item zmacs-region
  2009. This is the face that mouse selections are displayed in.
  2010. @item isearch
  2011. This is the face that the matched text being searched for is displayed
  2012. in.
  2013. @item info-node
  2014. This is the face of info menu items. If unspecified, it is copied from
  2015. @code{bold-italic}.
  2016. @item info-xref
  2017. This is the face of info cross-references. If unspecified, it is copied
  2018. from @code{bold}. (Note that, when the mouse passes over a
  2019. cross-reference, the cross-reference's face is determined from a
  2020. combination of the @code{info-xref} and @code{highlight} faces.)
  2021. @end table
  2022. Other packages might define their own faces; to see a list of all faces,
  2023. use any of the interactive face-manipulation commands such as
  2024. @code{set-face-font} and type @samp{?} when you are prompted for the
  2025. name of a face.
  2026. If the @code{bold}, @code{italic}, and @code{bold-italic} faces are not
  2027. specified in the resource database, then XEmacs attempts to derive them
  2028. from the font of the default face. It can only succeed at this if you
  2029. have specified the default font using the XLFD (X Logical Font
  2030. Description) format, which looks like
  2031. @example
  2032. *-courier-medium-r-*-*-*-120-*-*-*-*-*-*
  2033. @end example
  2034. @noindent
  2035. If you use any of the other, less strict font name formats, some of which
  2036. look like
  2037. @example
  2038. lucidasanstypewriter-12
  2039. fixed
  2040. 9x13
  2041. @end example
  2042. then XEmacs won't be able to guess the names of the bold and italic
  2043. versions. All X fonts can be referred to via XLFD-style names, so you
  2044. should use those forms. See the man pages for @samp{X(1)},
  2045. @samp{xlsfonts(1)}, and @samp{xfontsel(1)}.
  2046. @node Widgets
  2047. @subsection Widgets
  2048. There are several structural widgets between the terminal EmacsFrame
  2049. widget and the top level ApplicationShell; the exact names and types of
  2050. these widgets change from release to release (for example, they changed
  2051. between 19.8 and 19.9, 19.9 and 19.10, and 19.10 and 19.12) and are
  2052. subject to further change in the future, so you should avoid mentioning
  2053. them in your resource database. The above-mentioned syntaxes should be
  2054. forward- compatible. As of 19.13, the exact widget hierarchy is as
  2055. follows:
  2056. @example
  2057. INVOCATION-NAME "shell" "container" FRAME-NAME
  2058. x-emacs-application-class "EmacsShell" "EmacsManager" "EmacsFrame"
  2059. @end example
  2060. where INVOCATION-NAME is the terminal component of the name of the
  2061. XEmacs executable (usually @samp{xemacs}), and
  2062. @samp{x-emacs-application-class} is generally @samp{Emacs}.
  2063. @node Menubar Resources
  2064. @subsection Menubar Resources
  2065. As the menubar is implemented as a widget which is not a part of XEmacs
  2066. proper, it does not use the face mechanism for specifying fonts and
  2067. colors: It uses whatever resources are appropriate to the type of widget
  2068. which is used to implement it.
  2069. If Emacs was compiled to use only the Lucid Motif-lookalike menu widgets,
  2070. then one way to specify the font of the menubar would be
  2071. @example
  2072. Emacs*menubar*font: *-courier-medium-r-*-*-*-120-*-*-*-*-*-*
  2073. @end example
  2074. If both the Lucid Motif-lookalike menu widgets and X Font Sets are
  2075. configured to allow multilingual menubars, then one uses
  2076. @example
  2077. *menubar*FontSet: -*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-*, \
  2078. -*-*-*-*-*-*-*-120-*-jisx0208.1983-0
  2079. @end example
  2080. That would specify fonts for a Japanese menubar. Specifying only one
  2081. XLFD is acceptable; specifying more than one for a given registry
  2082. (language) is also allowed. When X Font Sets are configured, some .font
  2083. resources (eg, menubars) are ignored in favor of the corresponding
  2084. .fontSet resources.
  2085. If the Motif library is being used, then one would have to use
  2086. @example
  2087. Emacs*menubar*fontList: *-courier-medium-r-*-*-*-120-*-*-*-*-*-*
  2088. @end example
  2089. because the Motif library uses the @code{fontList} resource name instead
  2090. of @code{font}, which has subtly different semantics.
  2091. The same is true of the scrollbars: They accept whichever resources are
  2092. appropriate for the toolkit in use.