aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2001-06-29 03:23:32 +0000
committerRichard M. Stallman2001-06-29 03:23:32 +0000
commitd2fab8383d074e6570d703a2919e03f09cafc9f3 (patch)
treed79ba493ddaa03fd7d82107929dc6e14630c39a5
parentc6fcb73d2a8b2f024885ff52654622b56e993e4e (diff)
downloademacs-d2fab8383d074e6570d703a2919e03f09cafc9f3.tar.gz
emacs-d2fab8383d074e6570d703a2919e03f09cafc9f3.zip
Explain purpose of mode hooks.
Xref to Tags from Imenu. Don't use "sections or definitions" in Imenu. Cindex "pretty printer". Mention LINEFEED. Explain uses of values of lisp-indent-function. Explain why C-M-DEL is sometimes not available. Doc values of hs-isearch-open. Minor cleanups.
-rw-r--r--man/programs.texi137
1 files changed, 82 insertions, 55 deletions
diff --git a/man/programs.texi b/man/programs.texi
index 2787a07bf95..ec9c7a70a0e 100644
--- a/man/programs.texi
+++ b/man/programs.texi
@@ -112,12 +112,13 @@ Mode, ada-mode, Ada Mode}), C/C++/Objective C/Java/Corba IDL
112@vindex emacs-lisp-mode-hook 112@vindex emacs-lisp-mode-hook
113@vindex lisp-interaction-mode-hook 113@vindex lisp-interaction-mode-hook
114@vindex scheme-mode-hook 114@vindex scheme-mode-hook
115 Turning on a major mode runs a normal hook called the @dfn{mode hook}, 115 Turning on a major mode runs a normal hook called the @dfn{mode
116which is the value of a Lisp variable. Each major mode has a mode hook, 116hook}, which is the value of a Lisp variable. Each major mode has a
117and the hook's name is always made from the mode command's name by 117mode hook, and the hook's name is always made from the mode command's
118adding @samp{-hook}. For example, turning on C mode runs the hook 118name by adding @samp{-hook}. For example, turning on C mode runs the
119@code{c-mode-hook}, while turning on Lisp mode runs the hook 119hook @code{c-mode-hook}, while turning on Lisp mode runs the hook
120@code{lisp-mode-hook}. @xref{Hooks}. 120@code{lisp-mode-hook}. The purpose of the mode hook is to give you a
121place to set up customizations for that major mode. @xref{Hooks}.
121 122
122@node Defuns 123@node Defuns
123@section Top-Level Definitions, or Defuns 124@section Top-Level Definitions, or Defuns
@@ -250,38 +251,40 @@ any or all of these key bindings for that purpose.
250@cindex buffer content indexes 251@cindex buffer content indexes
251@cindex tags 252@cindex tags
252 253
253 The Imenu facility offers a way to find the definitions or sections 254 The Imenu facility offers a way to find the definitions in a file by
254in a file. 255name. It is also useful in text formatter major modes, where it
256treats each chapter, section, etc., as a definition. (@pxref{Tags},
257for a more powerful feature that handles multiple files together.)
255 258
256@findex imenu 259@findex imenu
257@findex imenu-add-menu-bar-index 260@findex imenu-add-menu-bar-index
258 If you type @kbd{M-x imenu}, it reads the name of a section or 261 If you type @kbd{M-x imenu}, it reads the name of a definition in
259definition in the current buffer, then goes to that section or 262the current buffer, then goes to that definition. You can use
260definition. You can use completion to specify the name, and a 263completion to specify the name, and a complete list of possible names
261complete list of possible names is always displayed. 264is always displayed.
262 265
263 Alternatively you can bind the command @code{imenu} to a mouse 266 Alternatively, you can bind the command @code{imenu} to a mouse
264click. Then it displays mouse menus for you to select the section or 267click. Then it displays mouse menus for you to select the definition
265definition you want. You can also add the buffer's index to the menu 268you want. You can also add the buffer's index to the menu bar by
266bar by calling @code{imenu-add-menu-bar-index}. If you want to have 269calling @code{imenu-add-menu-bar-index}. If you want to have this
267this menu bar item available for all buffers in a certain major mode, 270menu bar item available for all buffers in a certain major mode, you
268you can do this by adding @code{imenu-add-menu-bar-index} to its mode 271can do this by adding @code{imenu-add-menu-bar-index} to its mode
269hook. But then you will have to wait for the buffer to be searched 272hook. But then you will have to wait for the buffer to be searched
270for sections and definitions, each time you visit a file which uses 273for definitions, each time you visit a file which uses that mode.
271that mode.
272 274
273@vindex imenu-auto-rescan 275@vindex imenu-auto-rescan
274 When you change the contents of a buffer, if you add or delete 276 When you change the contents of a buffer, if you add or delete
275definitions or sections, you can update the buffer's index to 277definitions, you can update the buffer's index to correspond to the
276correspond to the new contents by invoking the @samp{*Rescan*} item in 278new contents by invoking the @samp{*Rescan*} item in the menu.
277the menu. Rescanning happens automatically if 279Rescanning happens automatically if @code{imenu-auto-rescan} is
278@code{imenu-auto-rescan} is non-@code{nil}. There is no need to 280non-@code{nil}. There is no need to rescan because of small changes
279rescan because of small changes in the text. 281in the text.
280 282
281@vindex imenu-sort-function 283@vindex imenu-sort-function
282 You can customize the way the menus are sorted via the variable 284 You can customize the way the menus are sorted by setting the
283@code{imenu-sort-function}. By default names are ordered as they 285variable @code{imenu-sort-function}. By default names are ordered as
284occur in the buffer; alphabetic sorting is provided as an alternative. 286they occur in the buffer; alphabetic sorting is provided as an
287alternative.
285 288
286 Imenu provides the information to guide Which Function mode 289 Imenu provides the information to guide Which Function mode
287@ifnottex 290@ifnottex
@@ -326,22 +329,23 @@ inside a single parenthetical grouping.
326* Custom C Indent:: Controlling indentation style for C and related modes. 329* Custom C Indent:: Controlling indentation style for C and related modes.
327@end menu 330@end menu
328 331
332@cindex pretty-printer
329 Emacs also provides a Lisp pretty-printer in the library @code{pp}. 333 Emacs also provides a Lisp pretty-printer in the library @code{pp}.
330This program reformats a Lisp object with indentation chosen to look nice. 334This program reformats a Lisp object with indentation chosen to look nice.
331 335
332@node Basic Indent 336@node Basic Indent
333@subsection Basic Program Indentation Commands 337@subsection Basic Program Indentation Commands
334 338
335 Programming language major modes define the @key{TAB} key to indent 339 The basic indentation commands indent a single line according to the
336according to the usual conventions of the language you are editing. 340usual conventions of the language you are editing.
337@kbd{C-j} is normally defined to do @key{RET} followed by @key{TAB};
338thus, it too indents in a mode-specific fashion.
339 341
340@table @kbd 342@table @kbd
341@item @key{TAB} 343@item @key{TAB}
342Adjust indentation of current line. 344Adjust indentation of current line.
343@item C-j 345@item C-j
344Equivalent to @key{RET} followed by @key{TAB} (@code{newline-and-indent}). 346Equivalent to @key{RET} followed by @key{TAB} (@code{newline-and-indent}).
347@item @key{LINEFEED}
348This key is a way to enter @kbd{C-j}, on some keyboards.
345@end table 349@end table
346 350
347@kindex TAB @r{(programming modes)} 351@kindex TAB @r{(programming modes)}
@@ -459,24 +463,25 @@ such lines are always indented @code{lisp-indent-offset} more columns than
459the containing list. 463the containing list.
460 464
461@vindex lisp-body-indent 465@vindex lisp-body-indent
462 The standard pattern is overridden for certain functions. Functions 466 Certain functions override the standard pattern. Functions whose
463whose names start with @code{def} always indent the second line by 467names start with @code{def} treat the the second lines as the start of
464@code{lisp-body-indent} extra columns beyond the open-parenthesis 468a @dfn{body}, by indenting the second line @code{lisp-body-indent}
465starting the expression. 469additional columns beyond the open-parenthesis that starts the
470expression.
466 471
467 The standard pattern can be overridden in various ways for individual 472 You can override the standard pattern in various ways for individual
468functions, according to the @code{lisp-indent-function} property of the 473functions, according to the @code{lisp-indent-function} property of the
469function name. There are four possibilities for this property: 474function name. There are four possibilities for this property:
470 475
471@table @asis 476@table @asis
472@item @code{nil} 477@item @code{nil}
473This is the same as no property; the standard indentation pattern is used. 478This is the same as no property---use the standard indentation pattern.
474@item @code{defun} 479@item @code{defun}
475The pattern used for function names that start with @code{def} is used for 480Handle this function like a @samp{def} construct: treat the second
476this function also. 481line the start of a @dfn{body}.
477@item a number, @var{number} 482@item a number, @var{number}
478The first @var{number} arguments of the function are 483The first @var{number} arguments of the function are
479@dfn{distinguished} arguments; the rest are considered the @dfn{body} 484@dfn{distinguished} arguments; the rest are considered the body
480of the expression. A line in the expression is indented according to 485of the expression. A line in the expression is indented according to
481whether the first argument on it is distinguished or not. If the 486whether the first argument on it is distinguished or not. If the
482argument is part of the body, the line is indented @code{lisp-body-indent} 487argument is part of the body, the line is indented @code{lisp-body-indent}
@@ -484,7 +489,7 @@ more columns than the open-parenthesis starting the containing
484expression. If the argument is distinguished and is either the first 489expression. If the argument is distinguished and is either the first
485or second argument, it is indented @emph{twice} that many extra columns. 490or second argument, it is indented @emph{twice} that many extra columns.
486If the argument is distinguished and not the first or second argument, 491If the argument is distinguished and not the first or second argument,
487the standard pattern is followed for that line. 492the line uses the standard pattern.
488@item a symbol, @var{symbol} 493@item a symbol, @var{symbol}
489@var{symbol} should be a function name; that function is called to 494@var{symbol} should be a function name; that function is called to
490calculate the indentation of a line within this expression. The 495calculate the indentation of a line within this expression. The
@@ -710,7 +715,11 @@ opposite direction.
710(@code{kill-sexp}) or @kbd{C-M-@key{DEL}} (@code{backward-kill-sexp}). 715(@code{kill-sexp}) or @kbd{C-M-@key{DEL}} (@code{backward-kill-sexp}).
711@kbd{C-M-k} kills the characters that @kbd{C-M-f} would move over, and 716@kbd{C-M-k} kills the characters that @kbd{C-M-f} would move over, and
712@kbd{C-M-@key{DEL}} kills the characters that @kbd{C-M-b} would move 717@kbd{C-M-@key{DEL}} kills the characters that @kbd{C-M-b} would move
713over. 718over. On some machines, @kbd{C-M-@key{DEL}} typed on the console is a
719command to reboot; when that is so, you cannot use it as an Emacs
720command. This conflict is rare, though: usually the @key{DEL} key for
721Emacs is really @key{BACKSPACE}, and the reboot command is
722@kbd{C-M-@key{DELETE}}, so there is no conflict.
714 723
715@cindex transposition of expressions 724@cindex transposition of expressions
716@kindex C-M-t 725@kindex C-M-t
@@ -787,7 +796,7 @@ parenthesis structure. To move @emph{up} one (or @var{n}) levels, use
787@kbd{C-M-u} (@code{backward-up-list}). @kbd{C-M-u} moves backward up 796@kbd{C-M-u} (@code{backward-up-list}). @kbd{C-M-u} moves backward up
788past one unmatched opening delimiter. A positive argument serves as a 797past one unmatched opening delimiter. A positive argument serves as a
789repeat count; a negative argument reverses the direction of motion, so 798repeat count; a negative argument reverses the direction of motion, so
790that the command forward and up one or more levels. 799that the command moves forward and up one or more levels.
791 800
792 To move @emph{down} in the parenthesis structure, use @kbd{C-M-d} 801 To move @emph{down} in the parenthesis structure, use @kbd{C-M-d}
793(@code{down-list}). In Lisp mode, where @samp{(} is the only opening 802(@code{down-list}). In Lisp mode, where @samp{(} is the only opening
@@ -1145,13 +1154,15 @@ for ``w/o (without) man,'' since it doesn't use the @code{man}
1145program.}. Unlike @kbd{M-x man}, it does not run any external 1154program.}. Unlike @kbd{M-x man}, it does not run any external
1146programs to format and display the man pages; instead it does the job 1155programs to format and display the man pages; instead it does the job
1147in Emacs Lisp, so it works on systems such as MS-Windows, where the 1156in Emacs Lisp, so it works on systems such as MS-Windows, where the
1148@code{man} program and the other programs it needs are not readily 1157@code{man} program (and the other programs it uses) are not generally
1149available. @kbd{M-x woman} prompts for a name of a manual page, and 1158available.
1150provides completion based on the list of manual pages that are 1159
1151installed on your machine; the list of available manual pages is 1160 @kbd{M-x woman} prompts for a name of a manual page, and provides
1152computed automatically the first time you invoke @code{woman}. The 1161completion based on the list of manual pages that are installed on
1153word at point in the current buffer is used to suggest the default 1162your machine; the list of available manual pages is computed
1154for the name the manual page. 1163automatically the first time you invoke @code{woman}. The word at
1164point in the current buffer is used to suggest the default for the
1165name the manual page.
1155 1166
1156 With a numeric argument, @kbd{M-x woman} recomputes the list of the 1167 With a numeric argument, @kbd{M-x woman} recomputes the list of the
1157manual pages used for completion. This is useful if you add or delete 1168manual pages used for completion. This is useful if you add or delete
@@ -1280,10 +1291,26 @@ Hide all blocks @var{n} levels below this block
1280@table @code 1291@table @code
1281@item hs-hide-comments-when-hiding-all 1292@item hs-hide-comments-when-hiding-all
1282Non-@code{nil} says that @kbd{hs-hide-all} should hide comments too. 1293Non-@code{nil} says that @kbd{hs-hide-all} should hide comments too.
1294
1283@item hs-isearch-open 1295@item hs-isearch-open
1284Specifies what kind of hidden blocks to open in Isearch mode. 1296Specifies what kind of hidden blocks to open in Isearch mode.
1297The value should be one of these four symbols.
1298
1299@table @code
1300@item block
1301Open only blocks.
1302@item comment
1303Open only comments.
1304@item t
1305Open both blocks and comments.
1306@item nil
1307Open neither blocks nor comments.
1308@end table
1309
1285@item hs-special-modes-alist 1310@item hs-special-modes-alist
1286Specifies how to initialize Hideshow variables for different modes. 1311A list of elements, each Specifying how to initialize Hideshow
1312variables for one major mode. See the variable's documentation string
1313for more information.
1287@end table 1314@end table
1288 1315
1289@node Symbol Completion 1316@node Symbol Completion
@@ -1338,8 +1365,8 @@ based on the spell-checker's dictionary. @xref{Spelling}.
1338@findex glasses-mode 1365@findex glasses-mode
1339 1366
1340 Glasses minor mode makes @samp{unreadableIdentifiersLikeThis} 1367 Glasses minor mode makes @samp{unreadableIdentifiersLikeThis}
1341readable by altering the display. It can do this in two different 1368readable by altering the display. It knows two different ways to do
1342ways: by displaying underscores between an lower-case letter and the 1369this: by displaying underscores between a lower-case letter and the
1343following capital letter, or by emboldening the capital letters. It 1370following capital letter, or by emboldening the capital letters. It
1344does not alter the buffer text, only the way they display, so you can 1371does not alter the buffer text, only the way they display, so you can
1345use it even on read-only buffers. You can use the command @kbd{M-x 1372use it even on read-only buffers. You can use the command @kbd{M-x