comparison man/new-users-guide/custom2.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 8de8e3f6228a
children 712931b4b71d
comparison
equal deleted inserted replaced
461:120ed4009e51 462:0784d089fdc9
4 @cindex customize 4 @cindex customize
5 @cindex hook 5 @cindex hook
6 @cindex font-lock-mode 6 @cindex font-lock-mode
7 7
8 You can modify the behavior of Emacs in minor ways permanently by 8 You can modify the behavior of Emacs in minor ways permanently by
9 putting your changes in your @file{.emacs} file. This file contains Lisp 9 putting your changes in your @file{init.el} file. This file contains Lisp
10 function call expressions. Each of these expressions will consist of a 10 function call expressions. Each of these expressions will consist of a
11 function name followed by arguments, all surrounded by parentheses. For 11 function name followed by arguments, all surrounded by parentheses. For
12 example, to turn on the auto-fill-mode (i.e. break lines automatically 12 example, to turn on the auto-fill-mode (i.e. break lines automatically
13 when they become too long) , put the following line in your 13 when they become too long) , put the following line in your
14 @file{.emacs} file: 14 @file{init.el} file:
15 15
16 @example 16 @example
17 (add-hook 'text-mode-hook 17 (add-hook 'text-mode-hook
18 '(lambda() (auto-fill-mode 1))) 18 '(lambda() (auto-fill-mode 1)))
19 @end example 19 @end example
33 turn on the auto-fill-mode, add the appropriate hook as shown in the 33 turn on the auto-fill-mode, add the appropriate hook as shown in the
34 example above. 34 example above.
35 35
36 Similarly, to enable the "font-lock mode" which displays your program in 36 Similarly, to enable the "font-lock mode" which displays your program in
37 different fonts and colors(@pxref{Modes}), put the following in your 37 different fonts and colors(@pxref{Modes}), put the following in your
38 @file{.emacs} file. The comments above the statement explain what the 38 @file{init.el} file. The comments above the statement explain what the
39 statements do. 39 statements do.
40 40
41 @example 41 @example
42 ;;; enables the font-lock-mode in Lisp Mode 42 ;;; enables the font-lock-mode in Lisp Mode
43 (add-hook 'lisp-mode-hook 'turn-on-font-lock) 43 (add-hook 'lisp-mode-hook 'turn-on-font-lock)
62 (set-face-foreground 'font-lock-comment-face "forest green") 62 (set-face-foreground 'font-lock-comment-face "forest green")
63 @end example 63 @end example
64 64
65 @noindent 65 @noindent
66 For other customizations regarding the font-lock face, look at the file 66 For other customizations regarding the font-lock face, look at the file
67 @file{/usr/local/lib/xemacs-19.11/etc/sample.emacs}. 67 @file{/usr/local/lib/xemacs-VERSION/etc/sample.init.el}.
68 68
69 69
70 70
71 @comment node-name, next, previous, up 71 @comment node-name, next, previous, up
72 @menu 72 @menu
73 * Setting Variables:: Customizing Emacs variables 73 * Setting Variables:: Customizing Emacs variables
74 * Init File:: Some examples of Lisp expressions in 74 * Init File:: Some examples of Lisp expressions in
75 .emacs file 75 init.el file
76 @end menu 76 @end menu
77 77
78 @node Setting Variables, Init File, Other Customizations, Other Customizations 78 @node Setting Variables, Init File, Other Customizations, Other Customizations
79 @section Other Customizations 79 @section Other Customizations
80 @cindex setting variables 80 @cindex setting variables
130 @noindent 130 @noindent
131 Type "nil" and hit @key{RET}. Now if you again use @kbd{M-x describe 131 Type "nil" and hit @key{RET}. Now if you again use @kbd{M-x describe
132 variable} , you will see that the new value of case-fold-search will be 132 variable} , you will see that the new value of case-fold-search will be
133 "nil" and your searches will be case-sensitive. This will be effective 133 "nil" and your searches will be case-sensitive. This will be effective
134 only for that Emacs session. If you want to change the value of a 134 only for that Emacs session. If you want to change the value of a
135 variable permanently put the following statement in your @file{.emacs} 135 variable permanently put the following statement in your @file{init.el}
136 file : 136 file :
137 137
138 @example 138 @example
139 (setq case-fold-search nil) 139 (setq case-fold-search nil)
140 @end example 140 @end example
141 141
142 @noindent 142 @noindent
143 This statement will make searches case-sensitive only in the current 143 This statement will make searches case-sensitive only in the current
144 buffer which is the @file{.emacs} file. This will not be very useful. To 144 buffer which is the @file{init.el} file. This will not be very useful. To
145 make searches case-sensitive globally in all buffers, use: 145 make searches case-sensitive globally in all buffers, use:
146 146
147 @example 147 @example
148 (setq-default case-fold-search nil) 148 (setq-default case-fold-search nil)
149 @end example 149 @end example
202 @node Init File, , Setting Variables, Other Customizations 202 @node Init File, , Setting Variables, Other Customizations
203 @section Init File Examples 203 @section Init File Examples
204 @cindex init file examples 204 @cindex init file examples
205 205
206 For customizing Emacs, you need to put Lisp expressions in your 206 For customizing Emacs, you need to put Lisp expressions in your
207 @file{.emacs} file. The following are some useful Lisp expressions. If 207 @file{init.el} file. The following are some useful Lisp expressions. If
208 you find any of them useful, just type them in your @file{.emacs} file: 208 you find any of them useful, just type them in your @file{init.el} file:
209 209
210 @itemize @bullet 210 @itemize @bullet
211 @item 211 @item
212 The following expression will make @key{TAB} in C mode insert a real tab 212 The following expression will make @key{TAB} in C mode insert a real tab
213 character if the cursor or point is in the middle of the line. Now 213 character if the cursor or point is in the middle of the line. Now
288 @end example 288 @end example
289 289
290 @noindent 290 @noindent
291 If we use "setq" instead of "setq-default" then searches will be 291 If we use "setq" instead of "setq-default" then searches will be
292 case-sensitive only in the current buffer's local value. In this case the 292 case-sensitive only in the current buffer's local value. In this case the
293 buffer would be the @file{.emacs} file. Since this would not be too 293 buffer would be the @file{init.el} file. Since this would not be too
294 helpful and we want to have case-sensitive searches in all buffers, we 294 helpful and we want to have case-sensitive searches in all buffers, we
295 have to use "setq-default". 295 have to use "setq-default".
296 296
297 @item 297 @item
298 This expression will enable the font-lock mode when you are using 298 This expression will enable the font-lock mode when you are using
368 @end example 368 @end example
369 369
370 @item 370 @item
371 If you don't want the text to be highlighted when you use commands for 371 If you don't want the text to be highlighted when you use commands for
372 marking regions so as to use the @dfn{kill} and @dfn{yank} commands 372 marking regions so as to use the @dfn{kill} and @dfn{yank} commands
373 later, you can use the following expression in your @file{.emacs} file: 373 later, you can use the following expression in your @file{init.el} file:
374 374
375 @vindex zmacs-regions 375 @vindex zmacs-regions
376 @example 376 @example
377 (setq zmacs-regions nil) 377 (setq zmacs-regions nil)
378 @end example 378 @end example
408 (set-menubar nil) 408 (set-menubar nil)
409 @end example 409 @end example
410 410
411 @item 411 @item
412 If you want an extensive menu-bar use the following expression in your 412 If you want an extensive menu-bar use the following expression in your
413 @file{.emacs} file. 413 @file{init.el} file.
414 414
415 @example 415 @example
416 (load "big-menubar") 416 (load "big-menubar")
417 @end example 417 @end example
418 418
419 @noindent 419 @noindent
420 If you want to write your own menus, you can look at some of the 420 If you want to write your own menus, you can look at some of the
421 examples in 421 examples in
422 @file{/usr/local/lib/xemacs-20.0/lisp/packages/big-menubar.el} file. 422 @file{/usr/local/lib/xemacs-VERSION/lisp/packages/big-menubar.el} file.
423 423
424 @end itemize 424 @end itemize
425 425
426 For more information on initializing your @file{.emacs} file, 426 For more information on initializing your @file{init.el} file,
427 @xref{Init File,,,xemacs,XEmacs User's Manual}. You should also look at 427 @xref{Init File,,,xemacs,XEmacs User's Manual}. You should also look at
428 @file{/usr/local/lib/xemacs-20.0/etc/sample.emacs}, which is a sample 428 @file{/usr/local/lib/xemacs-VERSION/etc/sample.init.el}, which is a sample
429 @file{.emacs} file. It contains some of the commonly desired 429 @file{init.el} file. It contains some of the commonly desired
430 customizations in Emacs. 430 customizations in Emacs.
431 431
432 432
433 433
434 434