Mercurial > hg > xemacs-beta
comparison man/xemacs/custom.texi @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | a99eebfee7d3 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
5 | 5 |
6 This chapter talks about various topics relevant to adapting the | 6 This chapter talks about various topics relevant to adapting the |
7 behavior of Emacs in minor ways. | 7 behavior of Emacs in minor ways. |
8 | 8 |
9 All kinds of customization affect only the particular Emacs job that you | 9 All kinds of customization affect only the particular Emacs job that you |
10 do them in. They are completely lost when you kill the Emacs job, and have | 10 do them in. They are completely lost when you kill the Emacs job, and |
11 no effect on other Emacs jobs you may run at the same time or later. The | 11 have no effect on other Emacs jobs you may run at the same time or |
12 only way an Emacs job can affect anything outside of it is by writing a | 12 later. The only way an Emacs job can affect anything outside of it is |
13 file; in particular, the only way to make a customization `permanent' is to | 13 by writing a file; in particular, the only way to make a customization |
14 put something in your @file{.emacs} file or other appropriate file to do the | 14 `permanent' is to put something in your init file or other appropriate |
15 customization in each session. @xref{Init File}. | 15 file to do the customization in each session. @xref{Init File}. |
16 | 16 |
17 @menu | 17 @menu |
18 * Minor Modes:: Each minor mode is one feature you can turn on | 18 * Minor Modes:: Each minor mode is one feature you can turn on |
19 independently of any others. | 19 independently of any others. |
20 * Variables:: Many Emacs commands examine Emacs variables | 20 * Variables:: Many Emacs commands examine Emacs variables |
24 to be replayed with a single command. | 24 to be replayed with a single command. |
25 * Key Bindings:: The keymaps say what command each key runs. | 25 * Key Bindings:: The keymaps say what command each key runs. |
26 By changing them, you can "redefine keys". | 26 By changing them, you can "redefine keys". |
27 * Syntax:: The syntax table controls how words and expressions | 27 * Syntax:: The syntax table controls how words and expressions |
28 are parsed. | 28 are parsed. |
29 * Init File:: How to write common customizations in the @file{.emacs} | 29 * Init File:: How to write common customizations in the init file. |
30 file. | 30 * Audible Bell:: Changing how Emacs sounds the bell. |
31 * Audible Bell:: Changing how Emacs sounds the bell. | 31 * Faces:: Changing the fonts and colors of a region of text. |
32 * Faces:: Changing the fonts and colors of a region of text. | 32 * Frame Components:: Controlling the presence and positions of the |
33 menubar, toolbars, and gutters. | |
33 * X Resources:: X resources controlling various aspects of the | 34 * X Resources:: X resources controlling various aspects of the |
34 behavior of XEmacs. | 35 behavior of XEmacs. |
35 @end menu | 36 @end menu |
36 | 37 |
37 @node Minor Modes | 38 @node Minor Modes |
383 C-j}, | 384 C-j}, |
384 | 385 |
385 @cindex saving option value | 386 @cindex saving option value |
386 Setting the option changes its value in the current Emacs session; | 387 Setting the option changes its value in the current Emacs session; |
387 @dfn{saving} the value changes it for future sessions as well. This | 388 @dfn{saving} the value changes it for future sessions as well. This |
388 works by writing code into your @file{~/.emacs} file so as to set the | 389 works by writing code into your init file so as to set the option |
389 option variable again each time you start Emacs. To save the option, | 390 variable again each time you start Emacs. @xref{Init File}. To save |
390 invoke @samp{[State]} and select the @samp{Save for Future Sessions} | 391 the option, invoke @samp{[State]} and select the @samp{Save for Future |
391 operation. | 392 Sessions} operation. |
392 | 393 |
393 You can also restore the option to its standard value by invoking | 394 You can also restore the option to its standard value by invoking |
394 @samp{[State]} and selecting the @samp{Reset} operation. There are | 395 @samp{[State]} and selecting the @samp{Reset} operation. There are |
395 actually three reset operations: | 396 actually three reset operations: |
396 | 397 |
746 | 747 |
747 You may be tempted to turn on Auto Fill mode with a local variable | 748 You may be tempted to turn on Auto Fill mode with a local variable |
748 list. That is inappropriate. Whether you use Auto Fill mode or not is | 749 list. That is inappropriate. Whether you use Auto Fill mode or not is |
749 a matter of personal taste, not a matter of the contents of particular | 750 a matter of personal taste, not a matter of the contents of particular |
750 files. If you want to use Auto Fill, set up major mode hooks with your | 751 files. If you want to use Auto Fill, set up major mode hooks with your |
751 @file{.emacs} file to turn it on (when appropriate) for you alone | 752 init file to turn it on (when appropriate) for you alone |
752 (@pxref{Init File}). Don't try to use a local variable list that would | 753 (@pxref{Init File}). Don't try to use a local variable list that would |
753 impose your taste on everyone working with the file. | 754 impose your taste on everyone working with the file. |
754 | 755 |
755 XEmacs allows you to specify local variables in the first line | 756 XEmacs allows you to specify local variables in the first line |
756 of a file, in addition to specifying them in the @code{Local Variables} | 757 of a file, in addition to specifying them in the @code{Local Variables} |
908 This inserts some Lisp code that, when executed later, will define the same | 909 This inserts some Lisp code that, when executed later, will define the same |
909 macro with the same definition it has now. You need not understand Lisp | 910 macro with the same definition it has now. You need not understand Lisp |
910 code to do this, because @code{insert-kbd-macro} writes the Lisp code for you. | 911 code to do this, because @code{insert-kbd-macro} writes the Lisp code for you. |
911 Then save the file. You can load the file with @code{load-file} | 912 Then save the file. You can load the file with @code{load-file} |
912 (@pxref{Lisp Libraries}). If the file you save in is your initialization file | 913 (@pxref{Lisp Libraries}). If the file you save in is your initialization file |
913 @file{~/.emacs} (@pxref{Init File}), then the macro will be defined each | 914 (@pxref{Init File}), then the macro will be defined each |
914 time you run Emacs. | 915 time you run Emacs. |
915 | 916 |
916 If you give @code{insert-kbd-macro} a prefix argument, it creates | 917 If you give @code{insert-kbd-macro} a prefix argument, it creates |
917 additional Lisp code to record the keys (if any) that you have bound to the | 918 additional Lisp code to record the keys (if any) that you have bound to the |
918 keyboard macro, so that the macro is reassigned the same keys when you | 919 keyboard macro, so that the macro is reassigned the same keys when you |
1151 @code{spell-other-window}. | 1152 @code{spell-other-window}. |
1152 | 1153 |
1153 @findex define-key | 1154 @findex define-key |
1154 @findex substitute-key-definition | 1155 @findex substitute-key-definition |
1155 The most general way to modify a keymap is the function | 1156 The most general way to modify a keymap is the function |
1156 @code{define-key}, used in Lisp code (such as your @file{.emacs} file). | 1157 @code{define-key}, used in Lisp code (such as your init file). |
1157 @code{define-key} takes three arguments: the keymap, the key to modify | 1158 @code{define-key} takes three arguments: the keymap, the key to modify |
1158 in it, and the new definition. @xref{Init File}, for an example. | 1159 in it, and the new definition. @xref{Init File}, for an example. |
1159 @code{substitute-key-definition} is used similarly; it takes three | 1160 @code{substitute-key-definition} is used similarly; it takes three |
1160 arguments, an old definition, a new definition, and a keymap, and | 1161 arguments, an old definition, a new definition, and a keymap, and |
1161 redefines in that keymap all keys that were previously defined with the | 1162 redefines in that keymap all keys that were previously defined with the |
1323 can be executed. The purpose of disabling a command is to prevent | 1324 can be executed. The purpose of disabling a command is to prevent |
1324 beginning users from executing it by accident and being confused. | 1325 beginning users from executing it by accident and being confused. |
1325 | 1326 |
1326 The direct mechanism for disabling a command is to have a non-@code{nil} | 1327 The direct mechanism for disabling a command is to have a non-@code{nil} |
1327 @code{disabled} property on the Lisp symbol for the command. These | 1328 @code{disabled} property on the Lisp symbol for the command. These |
1328 properties are normally set by the user's @file{.emacs} file with | 1329 properties are normally set by the user's init file with |
1329 Lisp expressions such as: | 1330 Lisp expressions such as: |
1330 | 1331 |
1331 @example | 1332 @example |
1332 (put 'delete-region 'disabled t) | 1333 (put 'delete-region 'disabled t) |
1333 @end example | 1334 @end example |
1335 | |
1336 @xref{Init File}. | |
1334 | 1337 |
1335 If the value of the @code{disabled} property is a string, that string | 1338 If the value of the @code{disabled} property is a string, that string |
1336 is included in the message printed when the command is used: | 1339 is included in the message printed when the command is used: |
1337 | 1340 |
1338 @example | 1341 @example |
1340 "Text deleted this way cannot be yanked back!\n") | 1343 "Text deleted this way cannot be yanked back!\n") |
1341 @end example | 1344 @end example |
1342 | 1345 |
1343 @findex disable-command | 1346 @findex disable-command |
1344 @findex enable-command | 1347 @findex enable-command |
1345 You can disable a command either by editing the @file{.emacs} file | 1348 You can disable a command either by editing the init file |
1346 directly or with the command @kbd{M-x disable-command}, which edits the | 1349 directly or with the command @kbd{M-x disable-command}, which edits the |
1347 @file{.emacs} file for you. @xref{Init File}. | 1350 init file for you. @xref{Init File}. |
1348 | 1351 |
1349 When you attempt to invoke a disabled command interactively in Emacs, | 1352 When you attempt to invoke a disabled command interactively in Emacs, |
1350 a window is displayed containing the command's name, its | 1353 a window is displayed containing the command's name, its |
1351 documentation, and some instructions on what to do next; then | 1354 documentation, and some instructions on what to do next; then |
1352 Emacs asks for input saying whether to execute the command as requested, | 1355 Emacs asks for input saying whether to execute the command as requested, |
1353 enable it and execute, or cancel it. If you decide to enable the | 1356 enable it and execute, or cancel it. If you decide to enable the |
1354 command, you are asked whether to do this permanently or just for the | 1357 command, you are asked whether to do this permanently or just for the |
1355 current session. Enabling permanently works by automatically editing | 1358 current session. Enabling permanently works by automatically editing |
1356 your @file{.emacs} file. You can use @kbd{M-x enable-command} at any | 1359 your init file. You can use @kbd{M-x enable-command} at any |
1357 time to enable any command permanently. | 1360 time to enable any command permanently. |
1358 | 1361 |
1359 Whether a command is disabled is independent of what key is used to | 1362 Whether a command is disabled is independent of what key is used to |
1360 invoke it; it also applies if the command is invoked using @kbd{M-x}. | 1363 invoke it; it also applies if the command is invoked using @kbd{M-x}. |
1361 Disabling a command has no effect on calling it as a function from Lisp | 1364 Disabling a command has no effect on calling it as a function from Lisp |
1528 character includes both the string you have to pass to | 1531 character includes both the string you have to pass to |
1529 @code{modify-syntax-entry} to set up that character's current syntax, | 1532 @code{modify-syntax-entry} to set up that character's current syntax, |
1530 and some English to explain that string if necessary. | 1533 and some English to explain that string if necessary. |
1531 | 1534 |
1532 @node Init File | 1535 @node Init File |
1533 @section The Init File, .emacs | 1536 @section The Init File |
1534 @cindex init file | 1537 @cindex init file |
1535 @cindex Emacs initialization file | 1538 @cindex Emacs initialization file |
1536 @cindex key rebinding, permanent | 1539 @cindex key rebinding, permanent |
1537 @cindex rebinding keys, permanently | 1540 @cindex rebinding keys, permanently |
1538 | 1541 |
1539 When you start Emacs, it normally loads the file @file{.emacs} in your | 1542 When you start Emacs, it normally loads either @file{.xemacs/init.el} |
1540 home directory. This file, if it exists, should contain Lisp code. It | 1543 or the file @file{.emacs} (whichever comes first) in your home directory. |
1541 is called your initialization file or @dfn{init file}. Use the command | 1544 This file, if it exists, should contain Lisp code. It is called your |
1542 line switch @samp{-q} to tell Emacs whether to load an | 1545 initialization file or @dfn{init file}. Use the command line switch |
1543 init file (@pxref{Entering Emacs}). Use the command line switch | 1546 @samp{-q} to tell Emacs whether to load an init file (@pxref{Entering |
1544 @samp{-user-init-file} (@pxref{Command Switches}) to tell Emacs to load | 1547 Emacs}). Use the command line switch @samp{-user-init-file} |
1545 a different file instead of @file{~/.emacs}. | 1548 (@pxref{Command Switches}) to tell Emacs to load a different file |
1546 | 1549 instead of @file{~/.xemacs/init.el}/@file{~/.emacs}. |
1547 When the @file{.emacs} file is read, the variable @code{user-init-file} | 1550 |
1548 says which init file was loaded. | 1551 When the init file is read, the variable @code{user-init-file} says |
1552 which init file was loaded. | |
1549 | 1553 |
1550 At some sites there is a @dfn{default init file}, which is the | 1554 At some sites there is a @dfn{default init file}, which is the |
1551 library named @file{default.el}, found via the standard search path for | 1555 library named @file{default.el}, found via the standard search path for |
1552 libraries. The Emacs distribution contains no such library; your site | 1556 libraries. The Emacs distribution contains no such library; your site |
1553 may create one for local customizations. If this library exists, it is | 1557 may create one for local customizations. If this library exists, it is |
1554 loaded whenever you start Emacs. But your init file, if any, is loaded | 1558 loaded whenever you start Emacs. But your init file, if any, is loaded |
1555 first; if it sets @code{inhibit-default-init} non-@code{nil}, then | 1559 first; if it sets @code{inhibit-default-init} non-@code{nil}, then |
1556 @file{default} is not loaded. | 1560 @file{default} is not loaded. |
1557 | 1561 |
1558 If you have a large amount of code in your @file{.emacs} file, you | 1562 If you have a large amount of code in your init file, you should |
1559 should move it into another file named @file{@var{something}.el}, | 1563 byte-compile it to @file{~/.xemacs/init.elc} or @file{~/.emacs.elc}. |
1560 byte-compile it (@pxref{Lisp Libraries}), and load that file from your | |
1561 @file{.emacs} file using @code{load}. | |
1562 | 1564 |
1563 @menu | 1565 @menu |
1564 * Init Syntax:: Syntax of constants in Emacs Lisp. | 1566 * Init Syntax:: Syntax of constants in Emacs Lisp. |
1565 * Init Examples:: How to do some things with an init file. | 1567 * Init Examples:: How to do some things with an init file. |
1566 * Terminal Init:: Each terminal type can have an init file. | 1568 * Terminal Init:: Each terminal type can have an init file. |
1567 @end menu | 1569 @end menu |
1568 | 1570 |
1569 @node Init Syntax | 1571 @node Init Syntax |
1570 @subsection Init File Syntax | 1572 @subsection Init File Syntax |
1571 | 1573 |
1572 The @file{.emacs} file contains one or more Lisp function call | 1574 The init file contains one or more Lisp function call |
1573 expressions. Each consists of a function name followed by | 1575 expressions. Each consists of a function name followed by |
1574 arguments, all surrounded by parentheses. For example, @code{(setq | 1576 arguments, all surrounded by parentheses. For example, @code{(setq |
1575 fill-column 60)} represents a call to the function @code{setq} which is | 1577 fill-column 60)} represents a call to the function @code{setq} which is |
1576 used to set the variable @code{fill-column} (@pxref{Filling}) to 60. | 1578 used to set the variable @code{fill-column} (@pxref{Filling}) to 60. |
1577 | 1579 |
1578 The second argument to @code{setq} is an expression for the new value | 1580 The second argument to @code{setq} is an expression for the new value |
1579 of the variable. This can be a constant, a variable, or a function call | 1581 of the variable. This can be a constant, a variable, or a function call |
1580 expression. In @file{.emacs}, constants are used most of the time. | 1582 expression. In the init file, constants are used most of the time. |
1581 They can be: | 1583 They can be: |
1582 | 1584 |
1583 @table @asis | 1585 @table @asis |
1584 @item Numbers | 1586 @item Numbers |
1585 Integers are written in decimal, with an optional initial minus sign. | 1587 Integers are written in decimal, with an optional initial minus sign. |
1809 the library @file{term/aaa}. The code in the library can use | 1811 the library @file{term/aaa}. The code in the library can use |
1810 @code{(getenv "TERM")} to find the full terminal type name.@refill | 1812 @code{(getenv "TERM")} to find the full terminal type name.@refill |
1811 | 1813 |
1812 @vindex term-file-prefix | 1814 @vindex term-file-prefix |
1813 The library's name is constructed by concatenating the value of the | 1815 The library's name is constructed by concatenating the value of the |
1814 variable @code{term-file-prefix} and the terminal type. Your @file{.emacs} | 1816 variable @code{term-file-prefix} and the terminal type. Your init |
1815 file can prevent the loading of the terminal-specific library by setting | 1817 file can prevent the loading of the terminal-specific library by setting |
1816 @code{term-file-prefix} to @code{nil}. | 1818 @code{term-file-prefix} to @code{nil}. @xref{Init File}. |
1817 | 1819 |
1818 @vindex term-setup-hook | 1820 @vindex term-setup-hook |
1819 The value of the variable @code{term-setup-hook}, if not @code{nil}, is | 1821 The value of the variable @code{term-setup-hook}, if not @code{nil}, is |
1820 called as a function of no arguments at the end of Emacs initialization, | 1822 called as a function of no arguments at the end of Emacs initialization, |
1821 after both your @file{.emacs} file and any terminal-specific library have | 1823 after both your init file and any terminal-specific library have been |
1822 been read. You can set the value in the @file{.emacs} file to override | 1824 read. @xref{Init File}. You can set the value in the init file to |
1823 part of any of the terminal-specific libraries and to define | 1825 override part of any of the terminal-specific libraries and to define |
1824 initializations for terminals that do not have a library.@refill | 1826 initializations for terminals that do not have a library.@refill |
1825 | 1827 |
1826 @node Audible Bell | 1828 @node Audible Bell |
1827 @section Changing the Bell Sound | 1829 @section Changing the Bell Sound |
1828 @cindex audible bell, changing | 1830 @cindex audible bell, changing |
2050 @code{set-face-underline-p}. The argument @var{underline-p} can be used | 2052 @code{set-face-underline-p}. The argument @var{underline-p} can be used |
2051 to make underlining an attribute of the face or not. If the optional | 2053 to make underlining an attribute of the face or not. If the optional |
2052 @var{frame} argument is provided, the face is changed only in that | 2054 @var{frame} argument is provided, the face is changed only in that |
2053 frame; otherwise, it is changed in all frames. | 2055 frame; otherwise, it is changed in all frames. |
2054 | 2056 |
2057 @node Frame Components | |
2058 @section Frame Components | |
2059 | |
2060 You can control the presence and position of most frame components, such | |
2061 as the menubar, toolbars, and gutters. | |
2062 | |
2063 This section is not written yet. Try the Lisp Reference Manual: | |
2064 @ref{Menubar,,,lispref,}, @ref{Toolbar Intro,,,lispref,}, and | |
2065 @ref{Gutter Intro,,,lispref,}. | |
2066 | |
2055 @node X Resources | 2067 @node X Resources |
2056 @section X Resources | 2068 @section X Resources |
2057 @cindex X resources | 2069 @cindex X resources |
2058 @findex x-create-frame | 2070 @findex x-create-frame |
2059 | 2071 |
2475 | 2487 |
2476 @node Menubar Resources | 2488 @node Menubar Resources |
2477 @subsection Menubar Resources | 2489 @subsection Menubar Resources |
2478 | 2490 |
2479 As the menubar is implemented as a widget which is not a part of XEmacs | 2491 As the menubar is implemented as a widget which is not a part of XEmacs |
2480 proper, it does not use the fac" mechanism for specifying fonts and | 2492 proper, it does not use the face mechanism for specifying fonts and |
2481 colors: It uses whatever resources are appropriate to the type of widget | 2493 colors: It uses whatever resources are appropriate to the type of widget |
2482 which is used to implement it. | 2494 which is used to implement it. |
2483 | 2495 |
2484 If Emacs was compiled to use only the Motif-lookalike menu widgets, then one | 2496 If Emacs was compiled to use only the Lucid Motif-lookalike menu widgets, |
2485 way to specify the font of the menubar would be | 2497 then one way to specify the font of the menubar would be |
2486 | 2498 |
2487 @example | 2499 @example |
2488 Emacs*menubar*font: *-courier-medium-r-*-*-*-120-*-*-*-*-*-* | 2500 Emacs*menubar*font: *-courier-medium-r-*-*-*-120-*-*-*-*-*-* |
2489 @end example | 2501 @end example |
2502 | |
2503 If both the Lucid Motif-lookalike menu widgets and X Font Sets are | |
2504 configured to allow multilingual menubars, then one uses | |
2505 | |
2506 @example | |
2507 *menubar*FontSet: -*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-*, \ | |
2508 -*-*-*-*-*-*-*-120-*-jisx0208.1983-0 | |
2509 @end example | |
2510 | |
2511 That would specify fonts for a Japanese menubar. Specifying only one | |
2512 XLFD is acceptable; specifying more than one for a given registry | |
2513 (language) is also allowed. When X Font Sets are configured, some .font | |
2514 resources (eg, menubars) are ignored in favor of the corresponding | |
2515 .fontSet resources. | |
2490 | 2516 |
2491 If the Motif library is being used, then one would have to use | 2517 If the Motif library is being used, then one would have to use |
2492 | 2518 |
2493 @example | 2519 @example |
2494 Emacs*menubar*fontList: *-courier-medium-r-*-*-*-120-*-*-*-*-*-* | 2520 Emacs*menubar*fontList: *-courier-medium-r-*-*-*-120-*-*-*-*-*-* |