comparison man/programs.texi @ 38238:6d50c21307ed

Minor clarifications. Explain how to use imenu-sort-function. Fix name of imenu-add-menubar-index.
author Richard M. Stallman <rms@gnu.org>
date Fri, 29 Jun 2001 17:53:41 +0000
parents a94c26975e95
children d6fff7f22127
comparison
equal deleted inserted replaced
38237:9b3aa64643fa 38238:6d50c21307ed
231 231
232 @kindex C-M-h @r{(C mode)} 232 @kindex C-M-h @r{(C mode)}
233 @findex c-mark-function 233 @findex c-mark-function
234 To operate on the current defun, use @kbd{C-M-h} (@code{mark-defun}) 234 To operate on the current defun, use @kbd{C-M-h} (@code{mark-defun})
235 which puts point at the beginning and mark at the end of the current 235 which puts point at the beginning and mark at the end of the current
236 or next defun. this is the easiest way to get ready to kill the defun 236 defun. This is the easiest way to get ready to kill the defun in
237 in order move it to a different place in the file. 237 order to move it to a different place in the file. If you use the
238 command while point is between defuns, it uses the following defun.
238 239
239 In C mode, @kbd{C-M-h} runs the function @code{c-mark-function}, 240 In C mode, @kbd{C-M-h} runs the function @code{c-mark-function},
240 which is almost the same as @code{mark-defun}; the difference is that 241 which is almost the same as @code{mark-defun}; the difference is that
241 it backs up over the argument declarations, function name and returned 242 it backs up over the argument declarations, function name and returned
242 data type so that the entire C function is inside the region. 243 data type so that the entire C function is inside the region.
249 @subsection Imenu 250 @subsection Imenu
250 @cindex indexes of buffer contents 251 @cindex indexes of buffer contents
251 @cindex buffer content indexes 252 @cindex buffer content indexes
252 @cindex tags 253 @cindex tags
253 254
254 The Imenu facility offers a way to find the definitions in a file by 255 The Imenu facility offers a way to find the the major definitions in
255 name. It is also useful in text formatter major modes, where it 256 a file by name. It is also useful in text formatter major modes,
256 treats each chapter, section, etc., as a definition. (@pxref{Tags}, 257 where it treats each chapter, section, etc., as a definition.
257 for a more powerful feature that handles multiple files together.) 258 (@pxref{Tags}, for a more powerful feature that handles multiple files
259 together.)
258 260
259 @findex imenu 261 @findex imenu
260 @findex imenu-add-menu-bar-index 262 If you type @kbd{M-x imenu}, it reads the name of a definition using
261 If you type @kbd{M-x imenu}, it reads the name of a definition in 263 the minibuffer, then goes to that definition. You can use completion
262 the current buffer, then goes to that definition. You can use 264 to specify the name, and a complete list of possible names is always
263 completion to specify the name, and a complete list of possible names 265 displayed.
264 is always displayed. 266
265 267 @findex imenu-add-menubar-index
266 Alternatively, you can bind the command @code{imenu} to a mouse 268 Alternatively, you can bind the command @code{imenu} to a mouse
267 click. Then it displays mouse menus for you to select the definition 269 click. Then it displays mouse menus for you to select the definition
268 you want. You can also add the buffer's index to the menu bar by 270 you want. You can also add the buffer's index to the menu bar by
269 calling @code{imenu-add-menu-bar-index}. If you want to have this 271 calling @code{imenu-add-menubar-index}. If you want to have this
270 menu bar item available for all buffers in a certain major mode, you 272 menu bar item available for all buffers in a certain major mode, you
271 can do this by adding @code{imenu-add-menu-bar-index} to its mode 273 can do this by adding @code{imenu-add-menubar-index} to its mode
272 hook. But then you will have to wait for the buffer to be searched 274 hook. But then you will have to wait for the buffer to be searched
273 for definitions, each time you visit a file which uses that mode. 275 for definitions, each time you visit a file which uses that mode.
274 276
275 @vindex imenu-auto-rescan 277 @vindex imenu-auto-rescan
276 When you change the contents of a buffer, if you add or delete 278 When you change the contents of a buffer, if you add or delete
281 in the text. 283 in the text.
282 284
283 @vindex imenu-sort-function 285 @vindex imenu-sort-function
284 You can customize the way the menus are sorted by setting the 286 You can customize the way the menus are sorted by setting the
285 variable @code{imenu-sort-function}. By default names are ordered as 287 variable @code{imenu-sort-function}. By default names are ordered as
286 they occur in the buffer; alphabetic sorting is provided as an 288 they occur in the buffer; if you want alphabetic sorting, use the
287 alternative. 289 symbol @code{imenu--sort-by-name} as the value. You can also
290 define your own comparison function by writing Lisp code.
288 291
289 Imenu provides the information to guide Which Function mode 292 Imenu provides the information to guide Which Function mode
290 @ifnottex 293 @ifnottex
291 (@pxref{Which Function}). 294 (@pxref{Which Function}).
292 @end ifnottex 295 @end ifnottex