Mercurial > hg > xemacs-beta
comparison man/new-users-guide/custom1.texi @ 462:0784d089fdc9 r21-2-46
Import from CVS: tag r21-2-46
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:44:37 +0200 |
parents | 3ecd8885ac67 |
children | 47c30044fc4e |
comparison
equal
deleted
inserted
replaced
461:120ed4009e51 | 462:0784d089fdc9 |
---|---|
1 @comment node-name, next, previous, up | 1 @comment node-name, next, previous, up |
2 @node Customization Basics, Help, Edit, Top | 2 @node Customization Basics, Help, Edit, Top |
3 @chapter Customize key bindings and menus | 3 @chapter Customize key bindings and menus |
4 @cindex .emacs | 4 @cindex init.el |
5 @cindex customize | 5 @cindex customize |
6 @findex eval-region | 6 @findex eval-region |
7 | 7 |
8 When you start Emacs, it reads the file @file{~/.emacs} in your home | 8 When you start Emacs, it reads the file @file{~/.xemacs/init.el} in the |
9 directory. You can use this file to initialize and customize Emacs to | 9 @file{.xemacs/} subdirectory of your home directory. You can use this |
10 your liking. This file should contain lisp-code. You can customize your | 10 file to initialize and customize Emacs to your liking. This file should |
11 @file{.emacs} file to create new | 11 contain lisp-code. You can customize your @file{init.el} file to create |
12 menus, disable menus, change key bindings, enable a minor mode, etc. Any | 12 new menus, disable menus, change key bindings, enable a minor mode, |
13 kind of customization affects | 13 etc. Any kind of customization affects only a particular Emacs job that |
14 only a particular Emacs job that you do them in. If you want to save | 14 you do them in. If you want to save your customizations `permanently' |
15 your customizations `permanently' i.e. for future use also, you have to | 15 i.e. for future use also, you have to put it in your @samp{init.el} |
16 put it in your @samp{.emacs} file. After you make changes to your | 16 file. After you make changes to your @file{init.el} file and save it, the |
17 @file{.emacs} file and save it, the changes will be effective only after | 17 changes will be effective only after you start Emacs again i.e. for a |
18 you start Emacs again i.e. for a new Emacs process. To try out some of | 18 new Emacs process. To try out some of the examples in this section, |
19 the examples in this section, highlight that region and evaluate the | 19 highlight that region and evaluate the region by giving the command |
20 region by giving the command @kbd{M-x eval-region}. You will be able to | 20 @kbd{M-x eval-region}. You will be able to see the results of your |
21 see the results of your customizations in that Emacs session only | 21 customizations in that Emacs session only (@pxref{Lisp |
22 (@pxref{Lisp Eval,,,xemacs,XEmacs User's Manual}). | 22 Eval,,,xemacs,XEmacs User's Manual}). |
23 | 23 |
24 @comment node-name, next, previous, up | 24 @comment node-name, next, previous, up |
25 @menu | 25 @menu |
26 * Customizing key Bindings:: Changing Key Bindings | 26 * Customizing key Bindings:: Changing Key Bindings |
27 * Customizing Menus:: Adding, Deleting, Enabling and Disabling Menus | 27 * Customizing Menus:: Adding, Deleting, Enabling and Disabling Menus |
41 its bound to the function @b{previous-line}. The functions themselves | 41 its bound to the function @b{previous-line}. The functions themselves |
42 define a particular behavior. You can customize the key @kbd{C-n} to | 42 define a particular behavior. You can customize the key @kbd{C-n} to |
43 move to the previous line by binding it to @b{previous-line} and | 43 move to the previous line by binding it to @b{previous-line} and |
44 @kbd{C-p} to move to the next line by binding it to @b{next-line}. To | 44 @kbd{C-p} to move to the next line by binding it to @b{next-line}. To |
45 bind keys to globally run commands you need to use the following syntax | 45 bind keys to globally run commands you need to use the following syntax |
46 in your @b{.emacs} file: | 46 in your @b{init.el} file: |
47 | 47 |
48 @cindex binding keys | 48 @cindex binding keys |
49 @example | 49 @example |
50 @code{(global-set-key @var{keys} @var{cmd})} | 50 @code{(global-set-key @var{keys} @var{cmd})} |
51 @end example | 51 @end example |
52 @noindent | 52 @noindent |
53 Here, @code{global-set-key} is a function which will bind the | 53 Here, @code{global-set-key} is a function which will bind the |
54 @dfn{keys} to the specified @dfn{cmd}. For example, if you type the | 54 @dfn{keys} to the specified @dfn{cmd}. For example, if you type the |
55 following in your @b{.emacs} file: | 55 following in your @b{init.el} file: |
56 | 56 |
57 @example | 57 @example |
58 (global-set-key "\C-p" 'next-line) | 58 (global-set-key "\C-p" 'next-line) |
59 (global-set-key "\C-n" 'previous-line) | 59 (global-set-key "\C-n" 'previous-line) |
60 @end example | 60 @end example |
67 in the syntax stated above. Here, @samp{nil} stands for @samp{false} | 67 in the syntax stated above. Here, @samp{nil} stands for @samp{false} |
68 which means disable a command or turn off a feature. If you want to | 68 which means disable a command or turn off a feature. If you want to |
69 enable a command or turn on a particular feature use @samp{t} | 69 enable a command or turn on a particular feature use @samp{t} |
70 which stands for @samp{true}. For example, if you do not wish @kbd{C-x | 70 which stands for @samp{true}. For example, if you do not wish @kbd{C-x |
71 C-c} to @samp{Exit Emacs} you can type the following expression in your | 71 C-c} to @samp{Exit Emacs} you can type the following expression in your |
72 @file{.emacs} file: | 72 @file{init.el} file: |
73 | 73 |
74 @example | 74 @example |
75 (global-set-key "\C-x\C-c" nil) | 75 (global-set-key "\C-x\C-c" nil) |
76 @end example | 76 @end example |
77 | 77 |
78 @noindent | 78 @noindent |
79 You might want to have this statement in your @file{.emacs} file because | 79 You might want to have this statement in your @file{init.el} file because |
80 its easy to hit this command by mistake and it could be annoying to exit | 80 its easy to hit this command by mistake and it could be annoying to exit |
81 Emacs unintentionally. There is a @b{Exit Emacs} option in the @b{File | 81 Emacs unintentionally. There is a @b{Exit Emacs} option in the @b{File |
82 menu} which you might want to use instead. To make a particular key | 82 menu} which you might want to use instead. To make a particular key |
83 undefined you can also use: | 83 undefined you can also use: |
84 | 84 |
172 &optional @var{before}) | 172 &optional @var{before}) |
173 | 173 |
174 This function will add a menu item to a menu, creating the menu first if | 174 This function will add a menu item to a menu, creating the menu first if |
175 necessary. If the named item already exists, the menu will remain | 175 necessary. If the named item already exists, the menu will remain |
176 unchanged. For example, if you add the following example to your | 176 unchanged. For example, if you add the following example to your |
177 @file{.emacs} file or evaluate it (@pxref{Customization Basics}), | 177 @file{init.el} file or evaluate it (@pxref{Customization Basics}), |
178 | 178 |
179 @example | 179 @example |
180 (add-menu-item '("Edit") "Replace String" replace-string t "Clear") | 180 (add-menu-item '("Edit") "Replace String" replace-string t "Clear") |
181 @end example | 181 @end example |
182 | 182 |