comparison man/new-users-guide/custom1.texi @ 290:c9fe270a4101 r21-0b43

Import from CVS: tag r21-0b43
author cvs
date Mon, 13 Aug 2007 10:36:47 +0200
parents 376386a54a3c
children 74fd4e045ea6
comparison
equal deleted inserted replaced
289:6e6992ccc4b6 290:c9fe270a4101
17 @file{.emacs} file and save it, the changes will be effective only after 17 @file{.emacs} file and save it, the changes will be effective only after
18 you start Emacs again i.e. for a new Emacs process. To try out some of 18 you start Emacs again i.e. for a new Emacs process. To try out some of
19 the examples in this section, highlight that region and evaluate the 19 the examples in this section, highlight that region and evaluate the
20 region by giving the command @kbd{M-x eval-region}. You will be able to 20 region by giving the command @kbd{M-x eval-region}. You will be able to
21 see the results of your customizations in that Emacs session only 21 see the results of your customizations in that Emacs session only
22 (@pxref{Lisp Eval,,,,XEmacs User's Manual}). 22 (@pxref{Lisp 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
30 @node Customizing key Bindings, Customizing Menus, Customization Basics, Customization Basics 30 @node Customizing key Bindings, Customizing Menus, Customization Basics, Customization Basics
31 @section Customize key bindings 31 @section Customize key bindings
32 @cindex key bindings 32 @cindex key bindings
33 @cindex keystrokes 33 @cindex keystrokes
34 34
35 Most of Emacs commands use key sequences. @xref{Keystrokes,,,,XEmacs 35 Most of Emacs commands use key
36 Manual}, for more information about Keys and Commands. In Emacs, the 36 sequences. @xref{Keystrokes,,,xemacs,XEmacs User's Manual}, for more
37 keys themselves carry no meaning unless they are bound to a 37 information about Keys and Commands. In Emacs, the keys themselves carry
38 function. For example, @kbd{C-n} moves the cursor to the next line 38 no meaning unless they are bound to a function. For example, @kbd{C-n}
39 because its bound to the function @b{next-line}. Similarly, @kbd{C-p} 39 moves the cursor to the next line because its bound to the function
40 moves to the previous line because its bound to the function 40 @b{next-line}. Similarly, @kbd{C-p} moves to the previous line because
41 @b{previous-line}. The functions themselves define a particular 41 its bound to the function @b{previous-line}. The functions themselves
42 behavior. You can customize the key @kbd{C-n} to move to the previous 42 define a particular behavior. You can customize the key @kbd{C-n} to
43 line by binding it to @b{previous-line} and @kbd{C-p} to move to the 43 move to the previous line by binding it to @b{previous-line} and
44 next line by binding it to @b{next-line}. To bind keys to globally run 44 @kbd{C-p} to move to the next line by binding it to @b{next-line}. To
45 commands you need to use the following syntax in your @b{.emacs} file: 45 bind keys to globally run commands you need to use the following syntax
46 in your @b{.emacs} file:
46 47
47 @cindex binding keys 48 @cindex binding keys
48 @example 49 @example
49 @code{(global-set-key @var{keys} @var{cmd})} 50 @code{(global-set-key @var{keys} @var{cmd})}
50 @end example 51 @end example
140 @end example 141 @end example
141 142
142 @findex make-symbolic-link 143 @findex make-symbolic-link
143 @noindent 144 @noindent
144 Both the examples bind the key @kbd{C-xl} to run the function 145 Both the examples bind the key @kbd{C-xl} to run the function
145 @code{make-symbolic-link} (@pxref{Misc File Ops,,,,XEmacs User's 146 @code{make-symbolic-link} (@pxref{Misc File Ops,,,xemacs,XEmacs User's
146 Manual}). However, the second example will bind the key only for C 147 Manual}). However, the second example will bind the key only for C
147 mode. @xref{Major Modes,,,,XEmacs User's Manual}, for more 148 mode. @xref{Major Modes,,,xemacs,XEmacs User's Manual}, for more
148 information on Major Modes in XEmacs. 149 information on Major Modes in XEmacs.
149 150
150 151
151 152
152 @comment node-name, next, previous, up 153 @comment node-name, next, previous, up
164 Menus}. 165 Menus}.
165 166
166 Some of the functions which are available to you for customization are: 167 Some of the functions which are available to you for customization are:
167 @enumerate 168 @enumerate
168 169
169 @item add-menu-item: @var{(menu-name item-name function enabled-p 170 @item
171 add-menu-item: @var{(menu-name item-name function enabled-p
170 &optional before)} 172 &optional before)}
171 173
172 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
173 necessary. If the named item already exists, the menu will remain 175 necessary. If the named item already exists, the menu will remain
174 unchanged. For example, if you add the following example to your 176 unchanged. For example, if you add the following example to your
255 menu. When you select the submenu @b{Management}, it will contain three 257 menu. When you select the submenu @b{Management}, it will contain three
256 submenus: @b{Copy File}, @b{Delete File} and @b{Rename File}. 258 submenus: @b{Copy File}, @b{Delete File} and @b{Rename File}.
257 259
258 @findex delete-menu-item 260 @findex delete-menu-item
259 @cindex deleting menu items 261 @cindex deleting menu items
260 @item delete-menu-item: @var{(menu-path)} 262 @item
263 delete-menu-item: @var{(menu-path)}
261 This function will remove the menu item defined by @var{menu-name} from 264 This function will remove the menu item defined by @var{menu-name} from
262 the menu hierarchy. Look at the following examples and the comments just 265 the menu hierarchy. Look at the following examples and the comments just
263 above them which specify what the examples do. 266 above them which specify what the examples do.
264 267
265 @example 268 @example
280 @end example 283 @end example
281 284
282 285
283 @findex disable-menu-item 286 @findex disable-menu-item
284 @cindex disabling menu items 287 @cindex disabling menu items
285 @item disable-menu-item: @var{(menu-name)} 288 @item
289 disable-menu-item: @var{(menu-name)}
286 Disables the specified menu item. The following example 290 Disables the specified menu item. The following example
287 291
288 @example 292 @example
289 (disable-menu-item '("File" "Management" "Copy File")) 293 (disable-menu-item '("File" "Management" "Copy File"))
290 @end example 294 @end example
294 still be there but it will appear faded which would mean that it cannot 298 still be there but it will appear faded which would mean that it cannot
295 be selected. 299 be selected.
296 300
297 @findex enable-menu-item 301 @findex enable-menu-item
298 @cindex enabling menu items 302 @cindex enabling menu items
299 @item enable-menu-item: @var{(menu-name)} 303 @item
304 enable-menu-item: @var{(menu-name)}
300 Enables the specified previously disabled menu item. 305 Enables the specified previously disabled menu item.
301 306
302 @example 307 @example
303 (enable-menu-item '("File" "Management" "Copy File")) 308 (enable-menu-item '("File" "Management" "Copy File"))
304 @end example 309 @end example
307 This will enable the sub-menu @b{Copy File}, which was disabled by the 312 This will enable the sub-menu @b{Copy File}, which was disabled by the
308 earlier command. 313 earlier command.
309 314
310 @findex relabel-menu-items 315 @findex relabel-menu-items
311 @cindex relabelling menu items 316 @cindex relabelling menu items
312 @item relabel-menu-item: @var{(menu-name new-name)} 317 @item
318 relabel-menu-item: @var{(menu-name new-name)}
313 Change the string of the menu item specified by @var{menu-name} to 319 Change the string of the menu item specified by @var{menu-name} to
314 @var{new-name}. 320 @var{new-name}.
315 321
316 @example 322 @example
317 (relabel-menu-item '("File" "Open...") "Open File") 323 (relabel-menu-item '("File" "Open...") "Open File")